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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With