Runtime extensions to a GWT application

90 views
Skip to first unread message

Maitri

unread,
Jun 24, 2012, 8:07:21 AM6/24/12
to google-we...@googlegroups.com
We want to create certain "hooks" into our GWT program.  For example, we have a general user interface with toolbars, forms, etc.  We want to be enable third parties to add icons to out toolbars through some predefined specification (UI Binder Type spec perhaps) so that when the app user starts the UI they see our icons and the extended set as well.  

Then when the icon is clicked a portion of the GUI is controlled by the third party specification for it (again with UI Binder type spec) along with the associated code.  So these are akin the Java plugin extensions of a GWT application.  

Does anyone have any ideas about how we may go about this?

Thanks,
Kevin

Joseph Lust

unread,
Jun 24, 2012, 10:17:41 AM6/24/12
to google-we...@googlegroups.com
I've not seen many examples of it, but using UiBinder and @UiChild annotation, you can make an interface for the buttons they might want to add, and then have a handler for them. This way, the 3rd parties could just implement your interface (i.e. GenericIcon) and put it inside your toolbar. I've used this for generic sidebar infoPanels, flipbook panels, and the like in my projects. The setup seems a little non-intuitive/verbose at first, but is really pretty simple.

For example:
<!-- UiBinder file -->
<someNamespace:YourToolbarWidget>
    <someNamespace:iconpanel>
        <3rdPartyNamespace:ImplementsGenericIcon />
    </someNamespace:iconpanel>
</someNamespace:YourToolbarWidget>
You just need to add the @UiChild handler to the YourToolbarWidget class to handle the creation of icons.

    // inside YourToolbarWidget.java
    @UiChild(limit=10,tagname="iconpanel")
    public void addIconPanel(Widget panel) {
        // "panel" Widget about is the content of the "iconpanel" tag
        GenericIcon content = (GenericIcon) panel;
        someContainer.add(content);
    }

As mentioned in other posts, @UiChild does not have many extant examples. I've been meaning to put one online. I hope the above helps as I had to dig for it the first time I used it too.


Sincerely,
Joseph

Maitri

unread,
Jun 29, 2012, 11:09:27 AM6/29/12
to google-we...@googlegroups.com
Joseph,

Thanks for pointing us to UIChild...looks interesting and hopefully meets our needs since it was the only suggestion we got.

Best,
Kevin

Reply all
Reply to author
Forward
0 new messages