See this http://tbroyer.posterous.com/gwt-21-activities-nesting-yagni
2011/3/24 Kayode Odeyemi <[email protected]> > Hello, > > Is there any complex example on how to nest Views when using the GWT > Activity and Place. For example, I have a MainWidget which acts as a parent > View for all other Views that have got a Place. My question is, how can I > place other Views in the MainWidget? If this is not possible, does this mean > every View can outrightly be its own widget? My reason for wanting the > MainWidget to house other Views is because I want the MainWidget to control > the entire layout of the application, so that other Views (URL based > widgets) can just go ahead and do their own specific things. > > From the HelloMVP, there's this line: > > private Place defaultPlace = new HelloPlace("World!"); > private SimplePanel appWidget = new SimplePanel(); > > // Start ActivityManager for the main widget with our ActivityMapper > ActivityMapper activityMapper = new AppActivityMapper(clientFactory); > ActivityManager activityManager = new ActivityManager(activityMapper, > eventBus); > activityManager.setDisplay(appWidget); > > Taking this one level up, does this mean that the GoodbyeView and HelloView > Views are attached to appWidget and are both visible at Place "World"? What > about if I have widgets and not Views, can these widgets be attached to for > example appWidget? Also, assuming I have another Place at "Heaven", with its > own Views, how can I discard the widgets already showing in appWidget? Is > this something the ActivityManager takes care of automatically? > > One other question, I have an Hyperlink that's got a #profile token. From > my understanding of Place, if I click on the Hyperlink which appends > #profile to the URL, the ActivityManager should call the corresponding Place > which is set at "profile". Right now this is not working for me. I have > this: > > registerHandler(display.showAgentProfileView().addClickHandler(new > ClickHandler() { > @Override > public void onClick(ClickEvent event) { > //eventBus.fireEvent(new MainSignupEvent()); > getAgentProfileActivity(); > } > > public void getAgentProfileActivity() { > Window.alert("getAgentProfileActivity Request is called"); > > History.newItem("profile"); > History.addValueChangeHandler(this); > History.fireCurrentHistoryState(); > > // Start ActivityManager for the main widget with our > ActivityMapper > ActivityMapper activityMapper = new AppActivityMapper(mainp); > ActivityManager activityManager = new > ActivityManager(activityMapper, geventBus); > > > activityManager.setDisplay((AcceptsOneWidget)mainp.getDisplay().getAgentProfileView().asWidget()); > > Place agentprofile = new AgentProfilePlace("profile"); > PlaceController agentprofilePlaceController = > mainp.getPlaceController(); > AgentProfilePlaceHistoryMapper agentprofilehistoryMapper= > GWT.create(AgentProfilePlaceHistoryMapper.class); > PlaceHistoryHandler historyHandler = new > PlaceHistoryHandler(agentprofilehistoryMapper); > historyHandler.register(placecontroller, geventBus, > agentprofile); > > } > > > I will also like to know, can the ActivityManager be called anywhere else > other than in onModuleLoad. My reason is because, since the issue of > decoupling is a big factor in MVP, I tend to have my events handled in the > Presenter implementing class. Please correct me if I'm wrong with the > interpretation. > > -- > Odeyemi 'Kayode O. > > B.Sc(Hons) Econs, Application Developer & Systems Engineer (Sun Certified > Professional), > Oracle Certified Associate, Solaris Systems Administrator, Drupal Developer > > Website: http://sinati.com <http://www.sinati.com> > Socialize with me: http://profile.to/charyorde, > http://twitter.com/charyorde, > http://www.google.com/profiles/dreyemi > Skype:drecute > > -- > 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. > -- 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.
