Skip to content

02. Integration

Frank Hossfeld edited this page Nov 29, 2017 · 5 revisions

Introduction

To integrate Mvp4g into your project, the following steps need to be done:

  1. Add needed library to your project or add a Maven dependency
  2. Modify your GWT configuration file (*.gwt.xml)
  3. Set your entry point
  4. Create your event bus, presenters, views...

Dependencies

To use mvp4g you have to add the mvp4g jars and the following libraries to your project:

You can also download the Mvp4g examples and copy the libraries inside the lib directory

Maven Dependency

Add the maven dependency:

<dependency>
   <groupId>com.googlecode.mvp4g</groupId>
   <artifactId>mvp4g</artifactId>
   <version>1.5.3</version>
</dependency>

Mvp4g is available on Maven central.

GWT configuration file

Insert Mvp4g module into your project:

<inherits name='com.mvp4g.Mvp4gModule'/>

Set an entry point

Using RootPanel

If you want to display your project inside a RootPanel, you can:

  • either choose the Mvp4g Entry Point as an entry-point by modifying your GWT configuration file:
<entry-point class='com.mvp4g.client.Mvp4gEntryPoint'/>
  • or have the following lines (and only the following lines) in your entry-point
Mvp4gModule module = (Mvp4gModule) GWT.create(Mvp4gModule.class);
module.createAndStartModule();  
RootPanel.get().add((Widget)module.getStartView());  
Using RootLayoutPanel?

If you want to display your project inside a RootLayoutPanel (needed incase you use Layout), you need the following lines (and only the following lines) in your entry-point :

Mvp4gModule module = (Mvp4gModule) GWT.create(Mvp4gModule.class);
module.createAndStartModule();
RootLayoutPanel.get().add((Widget) module.getStartView());
Event bus, presenters, views...

Now that you have configured your project to use Mvp4g, you can look at the rest of the documentation to create the different elements you need.

You can’t perform that action at this time.