com.extjs.gxt.ui.client.mvc
Class Controller

java.lang.Object
  extended by com.extjs.gxt.ui.client.mvc.Controller

public abstract class Controller
extends java.lang.Object

Controllers process and respond to application events.


Field Summary
protected  java.util.List<Controller> children
           
protected  boolean initialized
           
protected  Controller parent
           
 
Constructor Summary
Controller()
           
 
Method Summary
 void addChild(Controller controller)
          Add a child controller.
 boolean canHandle(AppEvent event)
          Determines if the controller can handle the particular event.
 boolean canHandle(AppEvent event, boolean bubbleDown)
          Determines if the controller can handle the particular event.
 void forwardToChild(AppEvent event)
          Forwards an event to any child controllers who can handle the event.
 void forwardToView(View view, AppEvent event)
          Forward an event to a view.
 void forwardToView(View view, EventType type, java.lang.Object data)
          Forward an event to a view.
abstract  void handleEvent(AppEvent event)
          Processes the event.
protected  void initialize()
          Called once prior to handleEvent being called.
protected  void registerEventTypes(EventType... types)
          Registers the event type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

children

protected java.util.List<Controller> children

initialized

protected boolean initialized

parent

protected Controller parent
Constructor Detail

Controller

public Controller()
Method Detail

addChild

public void addChild(Controller controller)
Add a child controller.

Parameters:
controller - the controller to added

canHandle

public boolean canHandle(AppEvent event)
Determines if the controller can handle the particular event. Default implementation checks against registered event types then queries all child controllers.

Parameters:
event - the event
Returns:
true if event can be handled, false otherwise

canHandle

public boolean canHandle(AppEvent event,
                         boolean bubbleDown)
Determines if the controller can handle the particular event. Default implementation checks against registered event types then queries all child controllers if bubbleUp set to true.

Parameters:
event - the event
bubbleDown - true to bubble down children controllers
Returns:
true if event can be handled, false otherwise

forwardToChild

public void forwardToChild(AppEvent event)
Forwards an event to any child controllers who can handle the event.

Parameters:
event - the event to forward

forwardToView

public void forwardToView(View view,
                          AppEvent event)
Forward an event to a view. Ensures the view is initialized before forwarding the event.

Parameters:
view - the view to forward the event
event - the event to be forwarded

forwardToView

public void forwardToView(View view,
                          EventType type,
                          java.lang.Object data)
Forward an event to a view. Ensures the view is initialized before forwarding the event.

Parameters:
view - the view to forward the event
type - the event type
data - the event data

handleEvent

public abstract void handleEvent(AppEvent event)
Processes the event.

Parameters:
event - the current event

initialize

protected void initialize()
Called once prior to handleEvent being called.


registerEventTypes

protected void registerEventTypes(EventType... types)
Registers the event type.

Parameters:
types - the event types