This morning I asked this question and received a really great answer for it. I'm now trying to prototype the design and am running into a similar (but not same) issue. Essentially I'm trying to have a 100% configuration-driven GWT UI, where changes to a DB can produce radically different UIs but without any code changes.
My architecture is simple:
- I will use a separate tool (or at first, by hand) to produce a .xul (XUL) file and save it to a database; probably a document database like Mongo or something similar
- On the server-side, I will write a
XulParser
that reads the XUL file out of the database and turns it into aContainerProxy
instance- A
ContainerProxy
is my "proxy" equivalent to acom.google.gwt.user.client.ui.Panel
or something similar; it is just a bean/POJO that contains a list of other widget proxies (see code snippet below) - For instance, I might have a XUL file that defines a
Button
like the one below - This
ButtonProxy
would be added to aContainerProxy
(along with any other UI widgets in the same container/view/panel)
- A
- On the client-side, I'll query for the
ContainerProxy
somehow (???), and pull it down from the server. - I'll then have a mechanism that translates each of the
ContainerProxy
's children (theButtonProxy
, etc.) into actual UI widgets.
This way, at first I can put a certain XUL file into the database and the UI might only contain the "Order Now" button on it. But down the road, I might want to use a totally different UI, so I design a different XUL file, update the document in the database, and - voila - the UI changes for all users without any code changes. Please note: I understand this is not a normal way of doing things: I have a special use case where I need such config-driven UIs.
To help clarify the XUL-parsing process:
<button id="order" label="orderNow" clickHandler="org.myapp.OrderButtonHandler" />
after the XulParser reads the above snippet, we get:
ButtonProxy orderButton = new ButtonProxy("order", "OrderNow");
orderButton.addClickHandler(new OrderButtonHandler());
Anyways, my questions:
- What do I need to do on the client-side to query for my
ContainerProxy
? Can anyone provide pseudo-code to help me visualize it? - Once I have the
ContainerProxy
on the client-side, what UI mechanisms are available for me to translate the proxied classes into actual UI widgets? Is UIBinder available? Again, can someone provide some pseudo-code?
Thanks in advance for any help here!