Monday, April 28, 2014

Re: menus with UIBinder

What about reflection? I noticed that java.lang.reflect is not available in GWT.

I would have done it like this:

@UiField MenuItem itm_Login;

private void init ()
{
 setCommand (itm_Login,"cmd_Login"); // one line per item
 ... 
}

private void setCommand (MenuItem itm,String cmd)
{
 final Method m = this.class.getMethod (cmd,null);

  itm.setScheduledCommand
  (
   new ScheduledCommand ()
   {
    public void execute ()
    {
     m.invoke ...
    }
   }
  );
}

Aren't there similar methods to do this?

I will try everything before going on with so much boilerplate code...

Magnus


--
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/d/optout.

No comments:

Post a Comment