- model:
- extends org.moock.util.Observable
- methods
- addObserver()
- deleteObserver()
- notifyObservers()
- (other Observable methods...)
- application-specific logic methods
- application-specific data getters
- application-specific data setters
- properties
- observers
- application-specific data
view:
- implements org.moock.util.Observer
- implements org.moock.util.View
- methods
- update()
- getModel()
- setModel()
- getController()
- setController()
- application-specific UI creators
- properties
- model
- controller
- application-specific UI components
controller:
- extends org.moock.util.AbstractController
- methods
- getModel()
- setModel()
- getView()
- setView()
- application-specific UI event handlers
- properties
AbstractController class source code:
// PACKAGE
AsSetupPackage("org.moock.util");
// CLASS AbstractController
/**
* Provides basic facilities for the "controller" of
* a Model/View/Controller triad. (The view
* implements the View interface, while the model
* is a descendent of Observable.)
*
* @param m The model this controller's view is observing.
*/
org.moock.util.AbstractController = function (m) {
// Register the model for this controller.
this.setModel(m);
}
// PROPERTIES
org.moock.util.AbstractController.prototype.model = null;
org.moock.util.AbstractController.prototype.view = null;
// METHODS
/**
* Sets the model for this controller.
*/
org.moock.util.AbstractController.prototype.setModel = function (m) {
this.model = m;
}
/**
* Returns the model for this controller.
*/
org.moock.util.AbstractController.prototype.getModel = function () {
return this.model;
}
/**
* Sets the view this controller is servicing.
*/
org.moock.util.AbstractController.prototype.setView = function (v) {
this.view = v;
}
/**
* Returns this controller's view.
*/
org.moock.util.AbstractController.prototype.getView = function () {
return this.view;
}
- View interface source code:
/**
* interface org.moock.util.View
*
* This interface specifies the minimum facilities that must be
* provided by the "view" of a Model/View/Controller triad.
* (The controller is a descendent of AbstractController,
* while the model is a descendent of Observable.)
*/
/**
* View.setModel(m)
*
* Sets the model this view is observing.
*/
/**
* View.getModel()
*
* Returns the model this view is observing.
*/
/**
* View.setController(c)
*
* Sets the controller for this view.
*/
/**
* View.getController()
*
* Returns this view's controller.
*/