Building Mobile Applications with Java by Joshua Marinacci

Building Mobile Applications with Java by Joshua Marinacci

Author:Joshua Marinacci [Joshua Marinacci]
Language: eng
Format: epub, pdf
Tags: COMPUTERS / Hardware / Handheld Devices
ISBN: 9781449308223
Publisher: O'Reilly Media
Published: 2012-03-08T16:00:00+00:00


GWT Mobile UI

To use GWT Mobile UI we first need to get it. You can download the source from here and compile it by hand, or download the prebuilt jar from my website here. It is important to note that GWT jars aren’t like regular jars. They contain more than just compiled Java classes. They also have the source that will be needed by the gwtc compiler to generate the JavaScript. They also have XML definitions for the entire library. This makes them a bit trickier to use but far more portable and encapsulated.

To add a 3rd party module to your project you have to update a few files. First, put the gwtmobileui.jar in a lib directory, then add it to your build script so that gwtc can find it. Open your build.xml file and go to the section that defines the project.class.path variable. It should be near the top of the file. Add a line referencing your new jar.

<path id="project.class.path"> <pathelement location="war/WEB-INF/classes"/> ... <!-- Add any additional non-server libs (such as JUnit) --> <fileset dir="war/WEB-INF/lib" includes="**/*.jar"/> <pathelement location="lib/gwtmobile-ui-1.1.jar"/> </path>

Now you need to add the functionality of this jar to your project. Remember from the earlier chapter that your project is a module defined by an XML file. Open this XML file, MyFirstApp.gwt.xml and add this line near the top:

<inherits name='com.google.gwt.user.User'/> <inherits name='com.gwtmobile.ui.gwtmobile_ui'/>

This will import the GWT Mobile UI classes into your module. Finally, you may also need to tell your IDE to add the jar to your classpath if it isn’t already aware of the GWT XML files. I use IntelliJ and had to manually add the jar to my classpath. With all of that in place we can start building the app.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.