you said (a Place is akin to a URL, it represents the "current state" of your app.),
in my app this url (http://demo4gwt.ecardbase.com/#exam:5--student:4-- menu:admin) represents 3 regions activity's lastPlaceName(with token), current state is "exam:5",student:5 and menu:admin is other region's last state, when user request a place it actually changes current state's of url , other two tokenes shows us the other regions (which not changed) last state,THE reason I changed URL is when user refresh browser my app will load all regions places according to tokens in url, ExamActivity's start method is like this public void start(AcceptsOneWidget panel, EventBus eventBus) { panel.setWidget(display.asWidget()); String curr=History.getToken(); if(curr.startsWith(ExamPlace.TOKEN_NAME)&&curr.contains("--")) {// if true ===refresh or forward the url..... String[] places=curr.split("--"); for(int i=places.length-1;i>=0;i--){ History.newItem(places[i]); } } } ------------------------------------------------------ I hava PlaceHistoryMapper and PlaceHistoryHandler ,it works well in same Activity's different place(place name is different,try it on http://demo4gwt.ecardbase.com/, load a place and click defferent page NUM in the HTML tables page bar, then go back to previous page) ,but it couldn't reconstruct the Activity (between different activity's place) when I press go back . (click defferent menu item, then try to go back to previous page). THAT is the problem. I tried what you said (have 4 ActivityManagers, each one with its ActivityMapper, each one controlling a "display region".) in this case my app only displayed the requested place in correct region,but other regions changed to blank, may be I didn't understand exactly what you said , the code is : NorthActivityMapper northActivityMapper =new NorthActivityMapper(); ActivityManager northActivityManager = new ActivityManager(northActivityMapper, eventBus); northActivityManager.setDisplay(north); CenterActivityMapper centerActivityMapper =new CenterActivityMapper(); ActivityManager centerActivityManager = new ActivityManager(centerActivityMapper, eventBus); centerActivityManager.setDisplay(center); WestActivityMapper westActivityMapper =new WestActivityMapper(); ActivityManager westActivityManager = new ActivityManager(westActivityMapper, eventBus); westActivityManager.setDisplay(west); ---------------------------------------------------------------------- Other region dispaly blank is because of the code in XXXActivityMapper is like this: public Activity getActivity(Place place) { if(place instanceof XXXPlace){ Activity activity=((XXXPlace) place).getActivity(); return activity; } return null; } if the code should not like this ,why should I have 4 ActivityMapper? and please tell me what should I do to make my app to be able to load differrent region's activity when user refresh the browser(http:// demo4gwt.ecardbase.com/#exam:5 it cant load all 3 region's last state,but current state ),when user A forward the url to user B,user B should see 3 regions display just like user A are looking right now,not only one. On 6月15日, 下午8时24分, Thomas Broyer <[email protected]> wrote: > Ouch! Total misunderstanding! > > First, a Place is akin to a URL, it represents the "current state" of your > app. Given a Place instance, you should be able to determine which Activity > goes into each "region" (btw, that's the role of ActivityMappers to return > an Activity given a Place). > You should have one ActivityManager *per* region you place Activities in; so > you'll have 4 ActivityManagers, each one with its ActivityMapper, each one > controlling a "display region". Given an "ExamPlace" for instance, the > ActivityManager for the north region will ask its ActivityMapper which > Activity (if any) to display (in the north region), the ActivityManager for > the east region will ask its ActivityMapper which Activity to put in the > east region, etc. > And the PlaceHistoryManager will turn the Place into an history token thanks > to its PlaceHistoryMapper; that's what you see in the URL; and if you go > back to that URL (copy/paste, bookmark, back/next in the browser), the Place > will be built back from the token, dispatched on the event bus, and each > ActivityManager will then reconstruct the Activity for its "display region". > > For a more in-depth look, seehttp://tbroyer.posterous.com, where I wrote a > couple articles on Places, and couple others on Activities. -- 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.
