Re: menus with UIBinder

2014-04-30 Thread Juan Pablo Gardella
Agree on use links, but as is a very common requirement would be nice have a built-in menu component that accepts links. 2014-04-30 10:31 GMT-03:00 Ümit Seren : > I can only emphasize what Jens said regarding hyperlinks and actions. > With Single Page Application (SPA) people tend to forgot abou

Re: menus with UIBinder

2014-04-30 Thread Ümit Seren
I can only emphasize what Jens said regarding hyperlinks and actions. With Single Page Application (SPA) people tend to forgot about the importance of hyperlinks/links. People use buttons and javascript to alter the view. This way they encode implicit state in the view and make it impossible to

Re: menus with UIBinder

2014-04-29 Thread Jens
> > This still looks terrible to me! :-) > Well with Java 8 syntax it will become itm_Login.setScheduledCommand(this::executeLogin());. (without any new ScheduledCommand() { ... }) http://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html Well ok personally I would never use

Re: menus with UIBinder

2014-04-29 Thread Magnus
> > Personally I would live with it until GWT understands Java8 lambda's and > method references which would eliminate most anonymous classes in GWT > sooner or later. To make the init() method look nicer I would think about > writing it as: > > > void init() { > itm_Login.setScheduledCommand

Re: menus with UIBinder

2014-04-28 Thread Jens
> > 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.set

Re: menus with UIBinder

2014-04-28 Thread Magnus
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 Me

Re: menus with UIBinder

2013-12-30 Thread Jens
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 (not 100% sure, could also be that only String, Enum, Integer, etc are allowed), e.g. and in your Java file

menus with UIBinder

2013-12-30 Thread Magnus
Hi, with UIBinder you can define a complex menu structure very quiclkly: ... But to use these structures in real-life projects you have to blow them with a lot of boilerplate code like this: itm_Login.setScheduledCommand ( new ScheduledCommand () { public vo