Hi Odeyemi,

See slides 32-47 here:
http://www.slideshare.net/turbomanage/whats-new-in-gwt-22

Also, this sample project has two ActivityManagers showing how the same
Place can be mapped in both (albeit one is null).
http://code.google.com/p/listwidget/

Inline comments below...

HTH,
/dmc

On Thu, Mar 24, 2011 at 10:18 AM, Kayode Odeyemi <drey...@gmail.com> wrote:

> 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"?
>

Each ActivityManager is responsible for its own area of the screen. Each
ActivityManager has its own ActivityMapper, and each can map the same Place
to a different Activity.


> 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?
>

When you change Place, the new Activity(ies) start() method(s) should call
panel.setWidget() to replace the current contents of the panel.
ActivityManager does not discard widgets automatically unless the new
Activity is null.


>
> 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);
>
>         }
>

When using Activities & Places, you don't need to call any methods on
History directly. Instead use historyHandler.handleCurrentHistory(). The
rest of the code in your getAgentProfileActivity() method should be run
during application setup (called from onModuleLoad, not a ClickHandler as
shown here). Finally, the ClickHandler should call placeController.goTo(new
AgentProfilePlace());


>
>
> 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 google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>



-- 
David Chandler
Developer Programs Engineer, Google Web Toolkit
w: http://code.google.com/
b: http://googlewebtoolkit.blogspot.com/
t: @googledevtools

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to