To integrate Mvp4g into your project, the following steps need to be done:
- Add needed library to your project or add a Maven dependency
- Modify your GWT configuration file (*.gwt.xml)
- Set your entry point
- Create your event bus, presenters, views...
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
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:
Set an entry point
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:
- 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());
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.