org.scopemvc.core
Interface Controller

All Known Implementing Classes:
BasicController

public interface Controller

Controllers arranged in a hierarchy of chains of command provide the structure of an application's logic, mirroring independent contexts of discrete Views and their bound model objects. Each context can be treated as an independent component. Application logic invoked by sending Controls into the chain executes in the context of a Controller that specifically recognises and responds to the Control by its ID.

For example, a Controller might manage a search panel (eg CustomerSearchView and bound CustomerSearchModel) that can be embedded within other arbitrary views. The search panel context has certain Controls that are recognised by the Controller which has no knowledge of anything outside the immediate context. Controls that the Controller doesn't explicitly recognise are simply passed to the parent Controller.

A Controller responds to Controls issued to it via the handleControl method from one of two places:

To implement a Controller see the basic implementation provided in BasicController

Version:
$Revision: 1.6 $ $Date: 2002/09/06 16:11:45 $
Author:
Steve Meyfroidt

Method Summary
 java.lang.Object getModel()
          Return the model bound to this Controller
 Controller getParent()
          Get the parent of this Controller
 Controller getTopParent()
          Find the top-most parent Controller at the head of the chain of command.
 View getView()
          Return the View bound to this Controller.
 void handleControl(Control inControl)
           Respond to a Control (from either a View or a child Controller) or pass up to the parent Controller in the chain of command if the Control is not recognised in this context.
 void setModel(java.lang.Object inModel)
          Bind a new model to this Controller.
 void setView(View inView)
          Bind a new view to this Controller.
 

Method Detail

getParent

public Controller getParent()
Get the parent of this Controller

Returns:
the parent Controller of this Controller in the chain of command

setModel

public void setModel(java.lang.Object inModel)
Bind a new model to this Controller.
The controller will automatically bind the model and the view together.

Parameters:
inModel - the model object bound to the View that this Controller maintains

getModel

public java.lang.Object getModel()
Return the model bound to this Controller

Returns:
the model object bound to the View that this Controller maintains

setView

public void setView(View inView)
Bind a new view to this Controller.
The controller will automatically bind the model and the view together.

Parameters:
inView - set the View that this Controller maintains

getView

public View getView()
Return the View bound to this Controller.

Returns:
the View that this Controller maintains

handleControl

public void handleControl(Control inControl)

Respond to a Control (from either a View or a child Controller) or pass up to the parent Controller in the chain of command if the Control is not recognised in this context.

Parameters:
inControl - the Control to respond to by examination of its ID: see Control.matchesID(java.lang.String)
See Also:
BasicController.handleControl(org.scopemvc.core.Control)

getTopParent

public Controller getTopParent()
Find the top-most parent Controller at the head of the chain of command. This is the application Controller that initialises the rest of the Controllers as children to handle specific areas of functionality.

Returns:
The topParent value


Copyright © 2000-2002 The Scope Team. All Rights Reserved.