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="com.google...ScheduledCommand" />

<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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment