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.


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.
 void forwardToChild(AppEvent event)
          Forwards an event to any child controllers who can handle the event.
static void forwardToView(View view, AppEvent event)
          Forward an event to a view.
static void forwardToView(View view, int type, java.lang.Object data)
          Forward an event to a view.
abstract  void handleEvent(AppEvent<?> event)
          Processes the event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controller

public Controller()
Method Detail

forwardToView

public static 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 static void forwardToView(View view,
                                 int 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

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

forwardToChild

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

Parameters:
event - the event to forward

handleEvent

public abstract void handleEvent(AppEvent<?> event)
Processes the event.

Parameters:
event - the current event