What is the easiest/correct way to optionally install a module? We have a case where we would like to have a presenter and view only available in the application when running in "development" mode, where that mode is set by a flag in the .gwt.xml file.
Previously, we were running GXT with an MVC architecture and would do the following in our module:
<replace-with class="com.mypackage.DevEditController" >
<all>
<when-property-is name="isDevelopment" value="true" />
<when-type-is class="com.mypackage.EditController" />
</all>
</replace-with>
<replace-with class="com.mypackage.StubEditController" >
<all>
<when-property-is name="isDevelopment" value="false" />
<when-type-is class="com.mypackage.EditController" />
</all>
</replace-with>
And would create the controller with the following:
(EditController)GWT.create(EditController.class);
I would like to do something similar with GWTP, where the non-development compile of the application wouldn't know anything about this presenter. Essentially, doing something along the lines of this in our module file:
<set-configuration-property name="gin.ginjector.modules"
value="com.mypackage.gin.SharedModule"/>
if this is development mode:
<set-configuration-property name="gin.ginjector.module.desktop"
value="com.mypackage.gin.DevDesktopModule"/>
else:
<set-configuration-property name="gin.ginjector.module.desktop"
value="com.mypackage.gin.DesktopModule"/>
Where DesktopModule and DevModule would do the same things, but DevDesktopModule would load an additional module containing the presenter/view binding.
Is this doable from a configuration perspective, or is it easier to just have two .gwt.xml files and alternate them as part of the build?
Thank you.