views:

258

answers:

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?

A: 

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