Sunday, June 24, 2012

Re: Runtime extensions to a GWT application

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

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/qRvj4fUs0QkJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate