aino-komal / mvp4g

Automatically exported from code.google.com/p/mvp4g
0 stars 0 forks source link

Allow to define submodule with gwt xml file #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I need to change application's locale on the client side after user's 
login. To do it I split application into three modules: 
 - application - which is root module,
 - login - responsible for user's login and setting user's locale in 
variable __gwt_Locale,
 - main - rest of application.

Now I need to define property provider for variable locale in main 
submodule. To do this mvp4g have to read submodule definition from gwt xml 
file what is missing in current version.

This enhancement has other benefits, i.e. login module can inherit less 
modules than main module so the first one will load faster.

Original issue reported on code.google.com by tlemp...@gmail.com on 1 Apr 2010 at 10:31

GoogleCodeExporter commented 9 years ago
If I understand it correctly, your issue is that you define local properties in 
your 
main submodule gwt xml and you would like to have the login submodule to be 
able to 
read them? Now I'm not sure how defining Mvp4g submodules in gwt xml file will 
help 
you, would you like Mvp4g to be able to parse the gwt xml file?

Couldn't you have the application GWT module inherit from login & main GWT 
modules 
(I'm assuming that you define one GWT module for each Mvp4g module) and define 
your 
locale properties in the application gwt xml file? This way, will all modules 
have 
the same locale properties?

Also I don't think login module will be faster to load because no matter how 
many 
modules login has to inherit, GWT compiler will remove the unnecessary code so 
at 
the end, your login module will be the same size.

Original comment by plcoir...@gmail.com on 1 Apr 2010 at 11:49

GoogleCodeExporter commented 9 years ago
I will try to complete my description of problem.

Login module after successful login retrieves from server user's locale (i.e. 
"pl_PL"). Than writes user's locale in javascript window:

        private native void setLocale(String locale) /*-{
                $wnd['__gwt_Locale'] = locale
        }-*/;

and sends event goToMain to Main module through Application module. Before 
loading 
Main module uses this variable to select corresponding compiled version of 
module (see 
http://code.google.com/webtoolkit/doc/latest/DevGuideI18nLocale.html#LocaleProvi
der).

I have only one gwt xml file for Application module (Application.gwt.xml). 
Event bus 
for this module looks like:

@Events(startView = ApplicationView.class, debug = false)
@ChildModules( { @ChildModule(moduleClass = LoginModule.class, async = false, 
autoDisplay = true), @ChildModule(moduleClass = MainModule.class, async = true, 
autoDisplay = false) })
public interface ApplicationEventBus extends EventBus {
   // ...
}

 If I am right, I could not define gwt xml files for such modules like Login and 
Main. Am I right?

 Concerning loading speed of modules you have right. It should not be issue.

Original comment by tlemp...@gmail.com on 1 Apr 2010 at 12:39

GoogleCodeExporter commented 9 years ago
I'm not sure to see what problem you have and how defining each Mvp4g module in 
each 
own GWT module will help you.

However you can define Login and Main modules in their own GWT module (ie they 
can 
have their own gwt xml file). You will just have to inherit those 2 modules in 
your 
Application GWT module:
<inherits name='com.example.Main'/>
<inherits name='com.example.Login'/>

Since the Application module is the Mvp4g root module, it is associated with 
the 
default Mvp4g Module (ie its module class is Mvp4gModule). This means that the 
only 
class the Login and Main modules need to be aware of is Mvp4gModule.java, which 
is 
part of the Mvp4g library.

Hope this help,
Pierre

Original comment by plcoir...@gmail.com on 2 Apr 2010 at 12:17

GoogleCodeExporter commented 9 years ago

Original comment by plcoir...@gmail.com on 5 Sep 2013 at 4:28