|
Controllers are created by extending the Scope API's Basic Controller
Controllers have three responsibilities:
-
Set the model and the view (usually in the constructor)
public LoginController() {
setModel(new CheckoutModel());
setView(mainView);
}
-
Handle controls in the doHandleControl method
Controllers respond to Control objects from two sources:
protected void doHandleControl(Control inControl) throws ControlException {
if (inControl.matchesID(VALIDATE_LOGIN)) {
doValidateLogin();
}
}
-
Issued from Views as a result of user interaction
-
Issued from child Sub-Controllers in the chain of responsibility
-
Issued locally using the handleControl command
-
Startup
public void startup() {
LoginView myView = (LoginView)getView();
myView.setViewBounds(myView.CENTRED);
showView(myView);
}
|