Skip to content

Getting started with mgwt

svkirans edited this page Nov 16, 2014 · 9 revisions

Getting started

Download

You need to download and place mgwt on your classpath. Download the latest version of mgwt here or you can use maven:

<dependencies>
   <dependency>
      <groupId>com.googlecode.mgwt</groupId>
      <artifactId>mgwt</artifactId>
      <version>2.0.0</version>
   </dependency>
</dependencies>

GWT.XML

In order for mgwt to become available for a GWT compile you need to inherit its gwt.xml file:

<inherits name='com.googlecode.mgwt.MGWT'/>

EntryPoint

Here is a simple entry point that shows a HelloWorld example using mgwt.

public class MGWTEntryPoint implements EntryPoint {
  public void onModuleLoad() {
    // set viewport and other settings for mobile
    MGWT.applySettings(MGWTSettings.getAppSetting());
    
    // build animation helper and attach it
    AnimationHelper animationHelper = new AnimationHelper();
    RootPanel.get().add(animationHelper);
    
    // build some UI
    RootFlexPanel rootFlexPanel = new RootFlexPanel();
    Button button = new Button("Hello mgwt");
    rootFlexPanel.add(button);

     // animate
     animationHelper.goTo(rootFlexPanel, Animations.SLIDE);
   }
}