com.glaivestone.mv
Class ApplicationModel

java.lang.Object
  |
  +--com.glaivestone.javax.util.EventManager
        |
        +--com.glaivestone.mv.ApplicationModel
Direct Known Subclasses:
DialogApplicationModel, FrameWindowApplicationModel

public class ApplicationModel
extends EventManager

ApplicationModel is the root of the model-view framework for implementing UI applications which follow the design pattern of separating state and logic from presentation rendering. The application model holds data representing the application state and implements operations which provide the application logic. A view on the model provides a presentation of the state and operations and is responsible for all rendering and user interaction.

Much of the interaction between an application model and a view is provided by configuring loosely coupled connections using event notifications.

An application model is responsible for implementing the application logic and providing data models which hold the state of the application and provide change notifications which a view can use to update its presentation. An application model should provide accessor methods for its data models to enable views to initialize their state properly and configure their dependencies to ensure that the view is correctly updated as the model data changes.

The application model-view framework is supported by a UISessionManager which provides session services. A UI session manager observes window open and close events to monitor the activity level of the session. The default UI session control policy terminates the session when the last main window in the session is closed. Applications can install an alternate control policy in the session manager to obtain a different termination policy. Applications can force session termination using the SessionManager.shutdown or the SessionManager.exit service. Application session termination should always be done through the session manager (not the base system System.exit service).

Origins

The model-view framework is based on the well-known MVC (model-view-controller) design pattern that originated in the Xerox PARC Smalltalk-80. Specific techniques and conventions have also been inspired by the Visual Smalltalk ApplicationModel design for model-view architecture.

Author:
Deb Lewis

Constructor Summary
ApplicationModel()
          Creates a new application model.
 
Method Summary
 void closeWindow(java.awt.Window aWindow)
          Close a window which provides a view on this application.
 java.util.Collection getAllViews()
          Answer a collection containing all ApplicationView windows which are currently open on this application.
static java.util.Collection getAllViews(ApplicationModel appModel)
          Answer a collection containing all ApplicationView windows which are currently open on the specified application model.
static java.util.Collection getAllViews(java.lang.Class appModelClass)
          Answer a collection containing all ApplicationView windows which are currently open on instances of the specified application model class.
 ApplicationView getView()
          Answer the ApplicationView window that is currently open on this application.
 java.awt.Window getWindow()
          Answer the window that is currently open on the receiver.
 java.awt.Window openWindow()
          Open a standard view on this application.
 java.awt.Window openWindow(java.awt.Window aWindow)
          Open the given window as a view on this application.
 boolean requestCloseWindow(java.awt.Window aWindow)
          Request that a window which provides a view on this application be closed.
 java.net.URL resolveResourceReference(java.lang.String resourceName)
          Resolve the name of an application resource to the URL which references the resource on the CLASSPATH.
 
Methods inherited from class com.glaivestone.javax.util.EventManager
addFirstListener, addListener, getEventTable, getEventTableForEdit, getListeners, removeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationModel

public ApplicationModel()
Creates a new application model.

Method Detail

getAllViews

public static java.util.Collection getAllViews(ApplicationModel appModel)
Answer a collection containing all ApplicationView windows which are currently open on the specified application model.


getAllViews

public static java.util.Collection getAllViews(java.lang.Class appModelClass)
Answer a collection containing all ApplicationView windows which are currently open on instances of the specified application model class.


closeWindow

public void closeWindow(java.awt.Window aWindow)
Close a window which provides a view on this application.

This is a absolute demand to close the view, even if under "normal" circumstances there might be reason why the close request should not be allowed to proceed (e.g., so the user can resolve some issue related to the state of the application).

See Also:
requestCloseWindow(java.awt.Window)

getAllViews

public java.util.Collection getAllViews()
Answer a collection containing all ApplicationView windows which are currently open on this application.


getView

public ApplicationView getView()
Answer the ApplicationView window that is currently open on this application. Returns null if there is no open view.


getWindow

public java.awt.Window getWindow()
Answer the window that is currently open on the receiver. Returns null if there is no open view.


openWindow

public java.awt.Window openWindow()
Open a standard view on this application. Answer the window.


openWindow

public java.awt.Window openWindow(java.awt.Window aWindow)
Open the given window as a view on this application. Answer the window.


requestCloseWindow

public boolean requestCloseWindow(java.awt.Window aWindow)
Request that a window which provides a view on this application be closed. Answer whether the close operation completed.

A window close request can be vetoed if the application model or another interested observer determines that the close operation should not be allowed to proceed at this time.

See Also:
closeWindow(java.awt.Window)

resolveResourceReference

public java.net.URL resolveResourceReference(java.lang.String resourceName)
Resolve the name of an application resource to the URL which references the resource on the CLASSPATH.


GFL 1.1 API