Reputation: 305
I'm trying to create a user interface using Google Web Toolkit v2.4. For a variety of reasons, I need to specify the contents of the interface on the server, at run-time. I don't just mean the the buttons need dynamic labels etc, but rather the whole UI needs to be created at run-time.
Much of my UI can be specified as straight-forward HTML. But I also want widgets like Scrollpane. Of course I need to somehow attach actions to things like buttons.
I tried creating the UI server-side by creating instances of com.google.gwt.user.client.ui.Button, and returning them to the client via RPC call. However the Button class is not serializable. (Also the package name is telling me this is an object which should live on the client only.)
I considered generating a UiBinder template on the fly. However it seems UI binder templates need to be compiled.
I'm now looking at sending HTML to the client with placeholder XML elements where the GWT widgets should go. On the client, I would use DOM methods to find and replace them with GWT widgets. But it feels I've gone far astray, at this point.
It feels like there should be a straight-forward way to do this, but it is eluding me.
Suggestions?
Upvotes: 3
Views: 3483
Reputation: 1
You can refer link http://code.google.com/p/acris/wiki/DynamicUiBinder for dynamicUiBinder
Upvotes: 0
Reputation: 1867
I think you are looking for XForms. There are several implementations of XForms (http://www.w3.org/MarkUp/Forms/wiki/XForms_Implementations) and some of them work on the server side and some of them work in browser. Some of the second type may work as a browser plugin, flash or java script, but my favouite is EMC Formula XForms Engine (https://community.emc.com/docs/DOC-4345) that was developed to work with GWT.
If you need some example, here it is: http://svn.yuppy.pl/projects/trunk/sample-gwt-xforms/.
Upvotes: 0
Reputation: 21634
You should look at Vaadin. Server-side control generating client side GWT.
Upvotes: 1
Reputation: 9910
GWT has no built-in support for stuff like this (since it is totally missing the point of gwt). So you have two choices,
build your own framework, so you will be able to send from server to client some layout page data, client will parse it and will create ui
or
you can use some other framework, for example Vaadin which basically does what you want, or a combination of some JavaScript UI Framework + Node.js where you can easily share the code between client and server.
Upvotes: 2