Apr 02 2008
Gwt-Ext solutions by forum community
The Gwt-Ext forum is very active and I try to participate when I can. In the process, I have bookmarked a few threads with solutions that I could use later. I am posting some of them below so that more people can stumble upon them. Within brackets is the forum id of the community member who suggested the solution.
-
Expand / collapse a panel on button click in another panel (daverh and sjivan)
1 2 3 4 5 6 7 8 9 10
panelB.setCollapsible(true); ... panelA.getSaveButton().addListener(new ButtonListenerAdapter(){ public void onClick(Button button, EventObject e) { panelB.setCollapsed(false); panelA.setTitle("Saved"); panelB.doLayout(); panelA.doLayout(); } });
-
Attach a clicklistener to a panel (me)
1 2 3 4 5 6 7 8 9
panel.addListener(new ContainerListenerAdapter(){ public void onRender(Component component) { panel.getEl().addListener("click", new EventCallback(){ public void execute(EventObject e) { MessageBox.alert("Panel clicked"); } }); } });
-
Force a combo box to always go back to the server for the list items (sjivan)
1 2 3 4 5
cb.addListener(new ComboBoxListenerAdapter() { public void onExpand(ComboBox comboBox) { store.reload(); } });
-
BorderLayout throws an exception when nothing is added to its center region (sjivan)
When using BorderLayout, you *must* have a Panel assigned to the CENTER region.
-
Update a text field’s contents (e.g. force all lowercase) when user leaves text field (takeustoyourleader)
1 2 3 4 5 6 7 8 9 10 11 12 13 14
final TextField lcaseTextField = new TextField(); lcaseTextField.addListener(new TextFieldListenerAdapter(){ public void onBlur(Field field) { updateValue(); } public void onSpecialKey(Field field, EventObject e){ updateValue(); } private void updateValue(){ lcaseTextField.setRawValue(lcaseTextField.getValueAsString().toLowerCase()); } });
The “onBlur” catches the user leaving the field by clicking off, the onSpecialKey catches them leaving by enter or tab or anything like that.
-
Wait for an IFrame to load and then execute some code (grabka)
1 2 3 4 5
EventManager.addListener(frame.getElement(), "load", new EventCallback() { public void execute(EventObject e) { /* do some stuff */ } }, new ListenerConfig());
I may post some more links as and when I bookmark them.
