Saturday, February 19, 2011

Re: best practice for callbacks

MyClassWidget widget = (MyClassWidget) event.getSource();

If all the widgets are different, and your not sure of the type, I'll stick the handler after init of the widget.
for (int i=0; i < 10; i++) {
  MyClassWidget widget = new MyClassWidget();
  widget.addChangeHandler(new ChangeHandler() {

      public void onChange(ChangeEvent event) {

        MapIcon mi = (MapIcon) event.getSource();

        int e = mi.getChangeEvent();

        if (e == AppEventManager.MAPICONSELECTED) {

          setMapIconDataSelected(mi.getMapIconSelected());

        }

      }

    });

}

Not sure that was what your aiming for.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate