GWT Multiple Independent Entry Points
I"m working on a GWT application that has three different areas (top nav bar, content pane, and bottom panel) on the page that are more or less independent of each other. One area is updated based on the action from the other area; for example, clicking on a link at the top nav bar will update the content area with the relevant info. The bottom panel is totally independent of the others and only updates itself upon some server push.
I'm thinking of having开发者_JAVA百科 three modules or three entry points in one module for these three areas. The problem I'm facing is "how can I refresh only the content pane while at the same time supporting history stack?" It's probably similar to Gmail app: clicking on Inbox or Sent only refreshes the list of emails but not the other parts of the screen.
I know I can easily do the refresh part in JavaScript. My concern is how to support the history stack. Thanks!
Did you take a look at the Activities and Places framework? This approach totally solves your problem while taking care of the history stack for you.
In short, you only need a single entry point. Your application would be divded into three display areas. And each display area is a container for an "Activity" where the activity decides what gets displayed.
If you click on a link in the nav bar you go to a new "Place" which might update the Activity in the content pane or even start a different Activity there (e.g. going from Inbox to Outbox will discard InboxActivity and start an OutboxActivity). Going to a new place will also update the URL and thus handle the back button.
This will make more sense to you if read the documentation and maybe this article.
精彩评论