1

I have an AWT applet application that needs to be ported over to GWT. The applet screens are described in meta data and the applet renders each screen dynamically using reflection.

We'd like the same thing in GWT/ExtGWT.

I've built a working version of this ExtJS whereby the metadata is turned into ExtJS Screen configs in the form of JSON. The drawback with this approach is the "wiring" of controls to data needs to be written in Javascript.

GWT is preferred since it'd be all Java code, no JS. Upon digging in it's possible to render the screens using GWT off the metadata using GWT.create().

The problem I'm having is the wiring to hook a dynamically created button for example to an event handler requires reflection which is not supported in GWT.

Is this conclusion correct? and if so, are there any other ways to achieve this type of dynamic UI using ExtGWT?

Francis Shanahan
  • 2,043
  • 19
  • 21
  • can you give an example how the meta data looks like? why do you need reflection at all if you already got the meta data? – Fabian Apr 06 '10 at 10:22
  • The metadata describes the screen's widgets, windows, panels, buttons, grid. I need to wire events such as "clicked" which fire on those objects to event handlers written in java. Something like myButton.addActionListener( (ActionListener)EventHandler.create(ActionListener.class, frame, "HandleClicked")); where "HandleClicked" comes from the metadata and refers to a function defined elsewhere. – Francis Shanahan Apr 06 '10 at 14:30

1 Answers1

0

For extGWT where we don't have declarative UI's the easiest solution might be to just add a mapping/config your handlers in java which refer to instantiated classes. of the handlers, i.e.:

Map<String, ActionListener> mapping = new HashMap<String, ActionListener>();
mapping.put("HandleClicked", new HandleClickedActionListener());

then you can try to find an implementing class for your meta data.

For pure GWT 2 you can take a look at http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideUiBinder.html#Simple_binding on how it's done there. it might be possible to create a similiar solution which annotated methods for you own extgwt solution like the one in gwt.

Fabian
  • 2,428
  • 2
  • 21
  • 19