Monday, December 30, 2013

Re: menus with UIBinder

Doesn't save you a lot but you can call any setter method through UiBinder and I think you can pass any object to that setter as long as you define it as a UiBinder reference using <ui:with>  (not 100% sure, could also be that only String, Enum, Integer, etc are allowed), e.g.

<ui:with field="quitCommand" type="" />

<g:MenuItem scheduledCommand="{quitCommand}" />

and in your Java file

@UiField(provided = true)
ScheduledCommand quitCommand = new ScheduledCommand() {
  // ... implement

In the future, with Java8 support, this can become

@UiField(provided = true) 
ScheduledCommand quitCommand = this::doQuit;

-- J.

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment