Multiple modules (how to share outer container state and structure)

77 views
Skip to first unread message

Shaun Tarves

unread,
Aug 30, 2012, 4:02:32 PM8/30/12
to google-we...@googlegroups.com
I have read a whole bunch of articles on multiple modules, and I'm still not sure I fully understand what they are (or their limitations) so I'm hoping someone can help.

1. Can multiple modules be loaded in the same host page?

2. Can multiple modules live inside of the same RootLayoutPanel, or do they each have to attach themselves to the RootLayoutPanel?

If the answers to 1. and 2. are yes, how do you switch between the modules?

Can, for example, a common event bus be used between all the modules?

My use case is that I have a rather complex outer application shell (in GWT) which is concerned with basic navigation, alerts, etc. I would like the user to be able to perform 3 distinctly different functions from within that same frame (managing a library, working within a community, and some users will have administrative tasks).

I'm struggling with the best way to layout the entire application. Do I continue with one monolithic app where all context switching is done by places/activities?

Thanks.

Jens

unread,
Aug 30, 2012, 5:28:21 PM8/30/12
to google-we...@googlegroups.com
1.) Yes
2.) Never tried it but I would say yes as RootLayoutPanel is a singleton LayoutPanel and a LayoutPanel can have multiple childs. See LayoutPanel.add() JavaDoc.

Some general thoughts:
- one monolithic app gives you the best optimizations (code size, number of http requests while loading app/resources). But as your app grows DevMode will become slower and needs more RAM. To counter this, you should split your app into smaller GWT modules (without entrypoints), e.g. library.gwt.xml, community.gwt.xml, admin.gwt.xml, and then inherit them as library in App.gwt.xml. This allows you to use DevMode/SuperDevMode with your smaller GWT modules instead of the whole app. Some more information can be found here: https://groups.google.com/d/topic/google-web-toolkit/cFRWX5ziLZc/discussion

- When you want to use an outer shell application that loads "inner" GWT apps, each GWT app should have its own host page and the outer app shell should load them through an iframe. This gives you the ability to update each app independently but also provides some overhead as your clients need to download common code multiple times (e.g. GWT's own framework code, which is included in each app's JS). If you then need communication between your "inner" GWT app and the outer shell app, take a look at: https://groups.google.com/d/topic/google-web-toolkit/c8RP6TIYbqQ/discussion

Personally I would go with the monolithic app that is split up into smaller pieces for easier development. Only if I would have a lot of different areas in my app and I want to update them independently I would consider an outer app + multiple independent "inner" apps approach.

Hope this helps.

-- J.

Reply all
Reply to author
Forward
0 new messages