Is it possible to use mgwt to add mobile support to an existing browser based app without breaking normal browser usage for people using a pc?
We currently have a browser based app made with gwt, but we would like to add some mobile specific features such as swipe support to this app if the user uses a mobile phone.
The app should still continue to work in a normal browser. When I visit the mgwt showcases (http://mobilegwt.appspot.com/showcase/) with firefox I get an error message, saying that my browser is not supported. Is this a general limitation of mgwt or just because their showcase only works on mobile?
You can use mgwt and GWT widgets in parallel.
There are two ways to do it. One option is to substitute some of GWT widgets with mgwt widgets, and then apply styling to mgwt widgets to make them look consistent with the rest of the app when used on desktops.
The other option is to create two versions of each view that you want to work on mobile devices, and then tell the compiler which version to use based on a platform, device, etc., using deferred binding. For example:
<replace-with class="com.xxx.WelcomeScreenMobileImpl">
<when-type-is class="com.xxx.WelcomeScreen" />
<when-property-is name="mgwt.formfactor" value="phone" />
</replace-with>
or
<replace-with class="com.xxx.WelcomeScreenMobileImpl">
<when-type-is class="com.xxx.WelcomeScreen" />
<when-property-is name="mgwt.user.agent" value="mobile" />
</replace-with>
You can find many similar statements within the mgwt library itself as it uses different widgets implementations or appearances based on user agent, form factor, screen density, os, etc.
If you keep your views simple, i.e. all the logic is in activities/presenters, then creating an alternative version of a view using mgwt widgets can be done easily and quickly.