diff options
author | Julien Dramaix <julien.dramaix@gmail.com> | 2011-03-06 08:08:05 +0000 |
---|---|---|
committer | Julien Dramaix <julien.dramaix@gmail.com> | 2011-03-06 08:08:05 +0000 |
commit | 295867b35ae9eb2d483367b903cf6bbd8131e2be (patch) | |
tree | e35ec78c7b8ef2210bafcf87677aff9b08247f46 /samples | |
parent | 536f355e11bf593e59d2cb136c7cae57211ef0f4 (diff) | |
download | gwtquery-295867b35ae9eb2d483367b903cf6bbd8131e2be.tar.gz gwtquery-295867b35ae9eb2d483367b903cf6bbd8131e2be.zip |
use a initializer object instead of Function
Diffstat (limited to 'samples')
-rw-r--r-- | samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java index 29a20d2a..63f8cf5e 100644 --- a/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java +++ b/samples/src/main/java/gwtquery/samples/client/GwtQueryWidgetModule.java @@ -19,9 +19,10 @@ import static com.google.gwt.query.client.GQuery.$; import static com.google.gwt.query.client.plugins.Widgets.Widgets;
import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.query.client.Function;
+import com.google.gwt.query.client.plugins.widgets.WidgetInitializer;
import com.google.gwt.query.client.plugins.widgets.ListBoxWidgetFactory.ListBoxOptions;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
@@ -35,15 +36,15 @@ public class GwtQueryWidgetModule implements EntryPoint { $(".inputText").as(Widgets).textBox();
$(".inputPsw").as(Widgets).passwordBox();
- $(".btn").as(Widgets).button(new Function() {
-
- public void f(Widget w) {
+ $(".btn").as(Widgets).button(new WidgetInitializer() {
+ public void initialize(Widget w, Element e) {
+ final String tag = e.getTagName();
Button button = (Button) w;
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
- Label l = new Label("You click on a GWT Button !");
+ Label l = new Label("You click on a GWT Button create from a "+tag);
PopupPanel panel = new PopupPanel(true, true);
panel.setGlassEnabled(true);
panel.add(l);
|