Hi Isomorphic,
please see this BuiltInDS based testcase (v10.0p_2015-11-18).
BuiltInDS.java:
While I think that b1 is just a bug, b4 needs more explanation.
What is supposed to work here?
In my real usecase I have a method returning an object that gets added to an AdvancedCriteria. The object added is either Criteria/Criterion/AdvancedCriteria so I thought having a Criteria-signature should work, but it does not.
Best regards
Blama
please see this BuiltInDS based testcase (v10.0p_2015-11-18).
BuiltInDS.java:
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.data.Criterion; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout mainLayout; private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(); } }); mainLayout.addMember(recreateBtn); recreate(); mainLayout.draw(); } private void recreate() { Window w = new Window(); w.setWidth("95%"); w.setHeight("95%"); w.setMembersMargin(0); w.setModalMaskOpacity(70); w.setTitle("Criteria subclasses"); w.setShowMinimizeButton(false); w.setIsModal(true); w.setShowModalMask(true); w.centerInPage(); IButton b1 = new IButton("Not OK. Criterion destroyed.", new ClickHandler() { @Override public void onClick(ClickEvent event) { Criterion c = new Criterion("f1", OperatorId.EQUALS, 1000); SC.say(c.asAdvancedCriteria().asString()); } }); b1.setWidth(300); IButton b1a = new IButton("Above working.", new ClickHandler() { @Override public void onClick(ClickEvent event) { Criterion c = new Criterion("f1", OperatorId.EQUALS, 1000); SC.say(new AdvancedCriteria(c).asString()); } }); b1a.setWidth(300); IButton b2 = new IButton("OK", new ClickHandler() { @Override public void onClick(ClickEvent event) { AdvancedCriteria ac = new AdvancedCriteria("f2", OperatorId.EQUALS, 2000); SC.say(ac.asAdvancedCriteria().asString()); } }); IButton b3 = new IButton("OK", new ClickHandler() { @Override public void onClick(ClickEvent event) { Criterion c = new Criterion("f1", OperatorId.EQUALS, 1000); AdvancedCriteria ac = new AdvancedCriteria("f2", OperatorId.EQUALS, 2000); ac.addCriteria(c); SC.say(ac.asString()); } }); IButton b4 = new IButton("Wrong error message. \"ac\" is not of type Criteria.", new ClickHandler() { @Override public void onClick(ClickEvent event) { Criteria wrongClass = new Criterion("f1", OperatorId.EQUALS, 1000); final AdvancedCriteria ac = new AdvancedCriteria("f2", OperatorId.EQUALS, 2000); ac.addCriteria(wrongClass); SC.say(ac.asString()); } }); b4.setWidth(300); w.addItem(b1); w.addItem(b1a); w.addItem(b2); w.addItem(b3); w.addItem(b4); w.show(); } }
What is supposed to work here?
In my real usecase I have a method returning an object that gets added to an AdvancedCriteria. The object added is either Criteria/Criterion/AdvancedCriteria so I thought having a Criteria-signature should work, but it does not.
Best regards
Blama
Comment