Loading a different UI class on the fly

Hi all,

We’re developing a business application with OSGi and Vaadin and we’re designing it so we can serve default (desktop-oriented) views, but also device-optimized views (i.e. mobile) if they are available for a certain part of the application. This may not always be the case if a mobile optimized view has not (yet) been developed for a certain application part.

I’ve also been reading up on TouchKit and it offers several performance benefits as well as its own Widgetset. In the future we may want to use TouchKit but we may not provide a TouchKit-specific UI for all views. Of course we could combine the TouchKit and normal Widgetsets so we can always serve a “default” (non TouchKit) view, but that would not be a good option performance-wise.

I think it would be useful in this scenario to be able to load a different UI class with the normal Vaadin Widgetset to fall back on a “normal view” if a TouchKit view is not available. Is there a way to do this? Or should we for example use a dedicated TouchKit servlet (i.e. at /touch/) and simply redirect to the “normal” servlet?

Hi Auke,

Pretty interesting stuff, BTW did you have a look at UIProvider? Here is a
wiki page
that talks about the scenario you described. May be not exactly, but closer to what you are looking at. You can evaluate this example with your scenario and get back in case you require something different.

Thanks,
Krishna.

Hi Krishna,

Thanks for the link. I did take a look a UIProvider, but I was unsure how to trigger a UI change if a TouchKitUI is already selected. But I might play around with it a little. I could set some flag somewhere that even though the client is mobile, the standard UI should be used and then somehow fire a UIClassSelectionEvent (or just a reload or navigation event).

Hi Auke,

Just “thinking loud” a bit but, if by convention you name the views in a certain way like “salesView / salesView-mobile”, could you maybe wire in Spring-Mobile project interceptor to fallback to a different view in case it’s not available or also depending on the device that is being used?


http://projects.spring.io/spring-mobile/#quick-start​

Good luck in any case as this is quite interesting stuff. We’ll probably be in the same case at some point.

Fran