Wednesday, April 30, 2014

Re: menus with UIBinder

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 link to a specific view. I would try to embrace hyperlinks as much as possible and make those views only depend on the state that is passed via the URL. That way you can easily share and if you use Activites and Places or any other framework the forward/back button will also work fine. 




On Tuesday, April 29, 2014 5:54:36 PM UTC+2, Jens wrote:
This still looks terrible to me! :-)

Well with Java 8 syntax it will become itm_Login.setScheduledCommand(this::executeLogin());. (without any new ScheduledCommand() { ... })




Well ok personally I would never use MenuBar + MenuItem because I like to have real hyperlinks so I can open things in tabs. I would have used something like FlowPanel + PopupPanel to build the menu and Hyperlink + GWT Places to build the menu items.


Sounds interesting. Can you give an example? 

Eh no sorry, would be too much code. Take a look at http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCheckBox and notice how the URL hash fragment changes when switching menu items. In the showcase a click handler is used on the menu items so you can not open them in tabs. But instead of a click handler you can also use a Hyperlink that contains the hash fragment, e.g. #!CwCheckBox. Then you have an URL that can be opened in tabs easily and the app can put itself into the correct state based on the URL hash fragment.

This Google Groups UI is a good example for having such URLs.


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

No comments:

Post a Comment