questions of a new user.

44 views
Skip to first unread message

clem...@gmail.com

unread,
Mar 13, 2015, 9:33:16 AM3/13/15
to gwt-pl...@googlegroups.com
I have been using gwt and mgwt but I am really new to GWTP

When and why would I have several modules that extend AbstractPresenterModule?

I know we need a clientModule that initialise the placemanager and then initiliase the "MainModule".

the MainModule initialise module1 and module2 which would themself bind presenters.

why not bind all the presenters in the MainModule?




another question is what is the difference between set-configuration-property and extend-configuration-property?
I looked for the exemples and found the mobile exemple...
If someone can explain a litlle 


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN"
<module rename-to='gwtpmobilesample'>
    <!-- Inherit the core Web Toolkit stuff. -->
    <inherits name="com.gwtplatform.mvp.MvpWithFormFactor"/>
    <inherits name='com.gwtplatform.dispatch.Dispatch'/>

    <!-- Inherit the default GWT style sheet. -->
    <inherits name='com.google.gwt.user.theme.standard.Standard'/>

    <!-- Form factor specific modules -->
    <set-configuration-property name="gin.ginjector.module.desktop"
                                value="com.gwtplatform.samples.mobile.client.gin.DesktopModule"/>
    <set-configuration-property name="gin.ginjector.module.mobile"
                                value="com.gwtplatform.samples.mobile.client.gin.MobileModule"/>
    <set-configuration-property name="gin.ginjector.module.tablet"
                                value="com.gwtplatform.samples.mobile.client.gin.TabletModule"/>

    <!-- Shared modules -->
    <set-configuration-property name="gin.ginjector.modules"
                                value="com.gwtplatform.dispatch.rpc.client.gin.RpcDispatchAsyncModule"/>
    <extend-configuration-property name="gin.ginjector.modules"
                                   value="com.gwtplatform.samples.mobile.client.gin.SharedModule"/>

    <!-- Specify the paths for translatable code -->
    <source path='client'/>
    <source path='shared'/>
</module>







Richard Wallis

unread,
Mar 13, 2015, 9:55:15 AM3/13/15
to gwt-pl...@googlegroups.com
The reason to use different modules for each presenter is to help with keeping each presenter separate from the others.

In general it's good practice to make each of your presenters completely unaware of all the others and have them communicate via events rather than having one presenter call another presenter's methods.

And also to never have anything other than the presenter itself communicate with its view.

This will make your code a lot easier to maintain and test because each package with a Presenter View & AbstractPresenterModule is completely separated and unconcerned with all the others.

It will work to bind all your presenters in your main module.  But doing it for each presenter separately in its own package allows you to enforce modularity by eg setting your presenter view etc to be package private rather than public.

***

set configuration property overrides any previous set configuration property calls

extend configuration property adds the new property to any existing set of properties

--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages