|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Controllers arranged in a hierarchy of chains of command provide the
structure of an application's logic, mirroring independent contexts of
discrete View
s and their bound model objects. Each context can be
treated as an independent component. Application logic invoked by sending
Control
s 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 Control
s issued to it via the handleControl
method from one of two places:
View
s issue Controls to indicate that the user has invoked
some application logic by interacting with the user interface, eg by
pressing a Button,
To implement a Controller see the basic implementation provided in BasicController
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 |
public Controller getParent()
public void setModel(java.lang.Object inModel)
inModel
- the model object bound to the View that this Controller
maintainspublic java.lang.Object getModel()
public void setView(View inView)
inView
- set the View that this Controller maintainspublic View getView()
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.
inControl
- the Control to respond to by examination of its ID: see
Control.matchesID(java.lang.String)
BasicController.handleControl(org.scopemvc.core.Control)
public Controller getTopParent()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |