Skip to content

01. Integration

Frank Hossfeld edited this page May 1, 2018 · 21 revisions

Introduction

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

  • for GWT 2.x:
  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...
  • for GWT 3.0:

Once GWT 3 / J2Cl is available, we will update this section.

Dependencies

Mvp4g2 has dependencies to the following projects:

Maven Dependency

Add the maven dependency:

    <dependency>
      <groupId>com.github.mvp4g</groupId>
      <artifactId>mvp4g2</artifactId>
      <version>1.0.0</version>
    </dependency>
    <dependency>
      <groupId>com.github.mvp4g</groupId>
      <artifactId>mvp4g2-processor</artifactId>
      <version>1.0.0</version>
    </dependency>

Mvp4g2 is available on Maven central.

Requirements

Mvp4g2 requires Java 8 and GWT 2.8.x. We recommand to always use the latest GWT 2 version.

Using with GWT 2

GWT configuration file

Add dependecies

Insert Mvp4g module into your project:

  <inherits name='com.github.mvp4g.mvp4g2.Mvp4g2'/>
Set an entry point
  <entrypoint class='[path to your entrypoint]'/>

Implement Entrypoint

To implement Mvp4g2 in your application, first create an application interface:

@Application(eventBus = MyEventBus.class,
             loader = MyApplicationLoader.class)
interface MyApplication
  extends IsApplication {
}

The application interface must extends IsApplicationand needs the @Application annotation. The eventbus attribute of the @Application annotation is required, where as the loader-attribute is optional. (more informations about Mvp4g2 application loader).

Create the application EntryPoint:

public class MyApplicationEntryPoint
	implements EntryPoint {
	
	public void onModuleLoad() {
		MyApplication application = new MyApplicationImpl();
		application.run();
	}
}

The MyApplicationImpl-class will be generated by the annotation processor and is available once a build is done.

Event bus, Presenters, Views...

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

com.github.mvp4g.mvp4g2.core.internal.*

All code inside the com.github.mvp4g.mvp4g2.core.internal.* packages is considered private API and should not be relied upon at all. It can change at any time and with no announcement.