I do something kinda similar. I make the assumption that a Place object should store all the state/data for the particular place. I then have something called a ContextWatcher which controls any application wide state or data. I use a static Cache class to actually store any data.
The impl also makes it very easy to rebuild application state from a refresh or bookmark Everything is controlled by a PlaceChangeEvent. So, on a PCE the new Activity (ActivityMapper calles setPlace(NewPlace) - which makes the start() method somewhat irrelevant but allows the same place to be called consecutively and have new params for each place) and ContextWatcher (implements PCE.Handler) so both have a reference to the new Place. The Activity adds an a callback to the place (addOnValidCallback - other objects which need to know when the Place and AppWide info is valid) and the ContextWatcher adds a callback to the place for onContextCheck (basically the place will make sure it has the necessary data it needs then hands control over to the ContextWatcher. The ContextWatcher does its thing and then calls place.startOnValidCallbacks. The place will then go through all callbacks that need to know everything is valid (The activity and any other object that have been put on hold) The method has been working extremely well for keeping Application State, Place specific data, Refresh, Bookmark, Caching etc It does add some custom complexity to the mix and slightly changes the way an activity is started but has proved well worth it. on a PCE the place will take the String token given to its constructor and then check to make sure the Client Cache has all the necessary data (retrieving it when needed). On Jun 10, 2:08 pm, Ben Imp <[email protected]> wrote: > The bundle is presenter-agnostic. It only contains application-wide state > and control objects. > > I do have two classes of presenters in my application, however. Those that > get passed the ApplicationBundle are page presenters, and control the whole > screen (or at least the central content portion of it anyway). They are > created in response to navigation events. These, in turn, may create > component presenters and pass them specific bits of information, like an > instance of their view that was retrieved from somewhere in the main page > view interface, or a specific implementation of their model interface that > will play well with the rest of the page. > > Something like this: > > public XxxPagePresenter(ApplicationBundle bundle, XxxPageView view) { > this.bundle = bundle; > this.view = view; > this.model = new XxxPageModelImpl(); > this.yyyComponentPresenter1 = new > YyyComponentPresenter(model.getYyyComponentModel(), > view.getYyyComponentView()); > ... > > } > > -Ben -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
