Apr 02
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.

May 20th, 2008 at 7:05 am
Hello my friends
July 6th, 2008 at 4:40 am
How its going?
October 13th, 2008 at 2:20 am
hi, i have a strange problem. the panel clicklistener code reports error:
The type new EventCallback(){} must implement the inherited abstract method
EventCallback.execute(EventObject)
however it is obviously implemented. i copy and paste the code from this page.
i have no clue what to do. do you? i have restarted eclipse, but even the gwt shell says so.
October 13th, 2008 at 2:40 am
keep up the good work.
October 13th, 2008 at 5:53 am
Can you post your code and error stack trace?
November 19th, 2008 at 11:50 pm
Hello. It is test.
November 28th, 2008 at 6:54 pm
jb3, you should remove the @Override annotation from the method exexcute. Eclipse adds automatically this annotation when a methods is overridden, but the java compiler screams when it’s present on an interface method.