|
HowtoIntegrateMvp4g
How to integrate Mvp4g to your project
Featured IntroductionTo integrate Mvp4g into your project, the following steps need to be done
LibraryAdd the following libraries to your project:
You can also download the Mvp4g examples and copy the libraries inside the lib directory Maven DependencyAdd the maven dependency: <dependency> <groupId>com.googlecode.mvp4g</groupId> <artifactId>mvp4g</artifactId> <version>1.3.1</version> </dependency> Mvp4g is available on Maven central. GWT configuration fileInsert Mvp4g module into your project: <inherits name='com.mvp4g.Mvp4gModule'/> Set an entry pointUsing RootPanelIf you want to display your project inside a RootPanel, you can:
<entry-point class='com.mvp4g.client.Mvp4gEntryPoint'/> Mvp4gModule module = (Mvp4gModule)GWT.create( Mvp4gModule.class ); module.createAndStartModule(); RootPanel.get().add( (Widget)module.getStartView() ); Using RootLayoutPanelIf 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. Mvp4g APTBy default, all the errors due to wrong Mvp4g configuration are detected when you start the GWT compilation or the GWT dev mode. Thanks to the APT, you can detect most of these errors directly in the IDE. You can check Mvp4g APT for more information. | |
btw, why don't you provide 'ant' or 'maven' script for examples building?
I guess I could easily provide ant files for the examples. I created issue 11 in order to add them in next delivery.
Hi! One question. It's posible add two or more packcages where are located presenters, views or servers??
Thanks!
You can have severals tag <presenters package="..." /> so you can enter several values for packages but it may make your configuration file messy (a part of this discusion is about this problem: http://groups.google.com/group/mvp4g/browse_thread/thread/7baeff82d0b7c480/2193edb0191b1ef8?lnk=gst&q=configuration#2193edb0191b1ef8).
In 1.0.0 version, there is no other way to do it. You can also define your class elements relatively to package attribute:
<presenters package="com.mvp4g.example">
</presenters>In 1.1.0 snapshot, you can use annotations which is much easier to configure than xml file or you can also divide your application into modules and have one configuration file for each module.
Thank you very much.
Awesome works Pierre! your framework is great !!
Info: tu use maven, add this in your pom.xml :
<repositories> <repository> <id>MVP4G</id> <name>MVP4G repository.</name> <url>http://mvp4g.googlecode.com/svn/maven2/releases</url> </repository> </repositories>Mvp4g 1.3.0/1.3.1 are now available on maven central
Hi There could I make a suggestion about following line...
RootPanel?.get().add( (Widget)module.getStartView() );
to be changed to
RootPanel?.get().add( ((IsWidget?)module.getStartView()).asWidget() );
This way the view itself can use composition or inheritance a bit more flexibility...
Thanks for the great framework! Any chance 1.4.0 will be added to maven central?
I hope to have it on maven central by the end of this month.