Hi Isomorphic,
please see this no-DataSource 5.1p testcase (tested with v10.1p_2017-03-02 in FF26 Dev Mode).
Observations:
BuiltInDS.java:
Best regards
Blama
please see this no-DataSource 5.1p testcase (tested with v10.1p_2017-03-02 in FF26 Dev Mode).
Observations:
- with FormItemIcon:
- The empty area next to the ButtonItem acts like the FormItemIcon when clicked (unexpected)
- The button itself also triggers the FormItemIcon clickhandler (see Developer Console log) (unexpected)
- without FormItemIcon:
- (OK)
- without FormItemIcon attached:
- Like "with FormItemIcon". This is really strange, as the FormItemIcon is not used and if you simplify the code, Eclipse will even warn that FormItemIcon is not used?!? (unexpected)
BuiltInDS.java:
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.Version; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.types.Alignment; 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.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.ButtonItem; import com.smartgwt.client.widgets.form.fields.FormItemIcon; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { 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(); } }); VLayout mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); { IButton btn = new IButton("Recreate with FormItemIcon"); btn.setWidth(300); btn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(true); } }); mainLayout.addMember(btn); } { IButton btn = new IButton("Recreate without FormItemIcon"); btn.setWidth(300); btn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(false); } }); mainLayout.addMember(btn); } { IButton btn = new IButton("Recreate without FormItemIcon attached"); btn.setWidth(300); btn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(null); } }); mainLayout.addMember(btn); } recreate(true); mainLayout.draw(); } private void recreate(Boolean withFormItemIcon) { Window w = new Window(); w.setWidth("95%"); w.setHeight("95%"); w.setMembersMargin(0); w.setModalMaskOpacity(70); w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); w.setTitle("ButtonItem-Titlearea acts like FormItemIcon" + w.getTitle()); w.setShowMinimizeButton(false); w.setIsModal(true); w.setShowModalMask(true); w.centerInPage(); w.addItem(new DynamicFormClearViewState(withFormItemIcon)); w.show(); } private final class DynamicFormClearViewState extends DynamicForm { public DynamicFormClearViewState(Boolean withFormItemIcon) { super(); setIsGroup(true); setGroupTitle("To see DynamicForm dimensions"); setWidth(400); final ButtonItem clearViewStateButton = new ButtonItem("TEST", "Testbutton"); clearViewStateButton.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { @Override public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { SC.say("Button clicked"); SC.logWarn("Button clicked"); }; }); clearViewStateButton.setWidth(190); clearViewStateButton.setAlign(Alignment.RIGHT); if (withFormItemIcon == null || withFormItemIcon == true) { FormItemIcon helperIcon = new FormItemIcon() { { setSrc("http://www.famfamfam.com/lab/icons/silk/icons/sport_soccer.png"); setTooltip("Explanation"); addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { SC.say("Explanation"); SC.logWarn("FormItemIcon clicked"); } }); } }; if (withFormItemIcon != null && withFormItemIcon == true) clearViewStateButton.setIcons(helperIcon); } setFields(clearViewStateButton); } } }
Blama
Comment