com.google.gwt.app.place
Class ActivityManager<P extends Place>

java.lang.Object
  extended by com.google.gwt.app.place.ActivityManager<P>
Type Parameters:
P - the type of Place objects that this ActivityManager can map to Activities
All Implemented Interfaces:
PlaceChangeEvent.Handler<P>, PlaceChangeRequestedEvent.Handler<P>, EventHandler

public class ActivityManager<P extends Place>
extends java.lang.Object
implements PlaceChangeEvent.Handler<P>, PlaceChangeRequestedEvent.Handler<P>

Experimental API: This class is still under rapid development, and is very likely to be deleted. Use it at your own risk.

Manages Activity objects that should be kicked off in response to PlaceChangeEvent events. Each activity can start itself asynchronously, and provides a widget to be shown when it's ready to run.


Constructor Summary
ActivityManager(ActivityMapper<P> mapper, HandlerManager eventBus)
          Create an ActivityManager.
 
Method Summary
 void onPlaceChange(PlaceChangeEvent<P> event)
          Deactive the current activity, find the next one from our ActivityMapper, and start it.
 void onPlaceChangeRequested(PlaceChangeRequestedEvent<P> event)
          Reject the place change if the current is not willing to stop.
 void setDisplay(Activity.Display display)
          Sets the display for the receiver, and has the side effect of starting or stopping its monitoring the event bus for place change events.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityManager

public ActivityManager(ActivityMapper<P> mapper,
                       HandlerManager eventBus)
Create an ActivityManager. Next call setDisplay(com.google.gwt.app.place.Activity.Display) and #activate.

Parameters:
mapper - finds the Activity for a given Place
eventBus - source of PlaceChangeEvent and PlaceChangeRequestedEvent events.
Method Detail

onPlaceChange

public void onPlaceChange(PlaceChangeEvent<P> event)
Deactive the current activity, find the next one from our ActivityMapper, and start it.

Specified by:
onPlaceChange in interface PlaceChangeEvent.Handler<P extends Place>
See Also:
PlaceChangeEvent.Handler.onPlaceChange(PlaceChangeEvent)

onPlaceChangeRequested

public void onPlaceChangeRequested(PlaceChangeRequestedEvent<P> event)
Reject the place change if the current is not willing to stop.

Specified by:
onPlaceChangeRequested in interface PlaceChangeRequestedEvent.Handler<P extends Place>
See Also:
PlaceChangeRequestedEvent.Handler.onPlaceChangeRequested(PlaceChangeRequestedEvent)

setDisplay

public void setDisplay(Activity.Display display)
Sets the display for the receiver, and has the side effect of starting or stopping its monitoring the event bus for place change events.

If you are disposing of an ActivityManager, it is important to call setDisplay(null) to get it to deregister from the event bus, so that it can be garbage collected.

Parameters:
display -