Package com.glaivestone.mv

Provides a simple framework for building applications following the model-view design pattern of separating UI and presentation (view) from fundamental application state and logic (model).

See:
          Description

Interface Summary
ApplicationView The ApplicationView interface is supported by windows which implement a view on an application model.
SessionControlPolicy A SessionControlPolicy is used to manage an application session.
ValueChangeListener Listener interface for receiving ValueChange event notifications about changes in an observed value.
WindowEventListener Listener interface for receiving window life-cycle event notifications.
 

Class Summary
AbstractValueHolder Abstract superclass for typed implementations of models which hold an observed value.
ApplicationModel 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.
BasicSessionControlPolicy A basic session control policy which does nothing.
BooleanHolder A value holder which contains an observed boolean value.
DialogApplicationModel An application model which supports dialog views.
FrameWindowApplicationModel An application model which supports frame window views.
IntegerHolder A value holder which contains an observed int value.
MasterWindowSessionControlPolicy A session control policy for an application session which is controlled by a single master window and terminated when the controlling master window is closed.
MultipleWindowsSessionControlPolicy A session control policy for an application session which allows multiple top-level main windows and which is terminated when the last main window is closed.
StringHolder A value holder which contains an observed String value.
UISessionManager A UISessionManager should be installed as the current session manager for an application with UI elements.
ValueChangeEvent A ValueChange event is fired when an observed value changes.
ValueHolder A value holder which contains an observed Object value.
WindowEvent A window event is fired to notify listeners of window life-cycle events.
WindowEventAdaptor Default event listener adapter for receiving winoow life cycle events.
 

Package com.glaivestone.mv Description

Provides a simple framework for building applications following the model-view design pattern of separating UI and presentation (view) from fundamental application state and logic (model).

Glaivestone Model-View (MV) Application Framework

The basic approach is to implement an ApplicationModel class which provides the application logic and holds the application state in data models. A view on the application is constructed by implementing a UI view which is responsible for providing presentation and UI for the application. A view registers event handlers on the application model so it can update the presentation when the underlying application state changes. The view is also responsible for invoking application services in response to user actions.

The Application Model

An application model provides state and behavior for the application. It implements public methods to allow views or other clients to access the application state and invoke the application's operations. Events must be supported to notify clients when the state changes.

An application model is implemented by subclassing ApplicationModel. The FrameWindowApplicationModel and DialogApplicationModel provide some additional framework support for common scenarios for main windows (frames) and for dialogs which are used to obtain a result.

The application model framework provides a standard approach for hooking into window life cycle open and close events of the WindowListener interface. The close events are of particular interest, as they allow an application to ensure that unsaved state changes made from a user view on the application are handled or to ensure that resource cleanup is taken care of when views close.

An application model can trigger events directly by supporting listener interface(s) or can support event notifications via data models holding its state.

Data Models for Application State

State data is usually stored in data models which hold the values and provide event support for change notifications. The standard Java Swing UI library provides a number of data models.

Several simple data models are provided in the MV framework for holding single data values (BooleanHolder, IntegerHolder, StringHolder, and a general object ValueHolder). The com.glaivestone.mv.swing package also provides ListHolder and TableHolder which bundle the standard Swing list/table models with a selection model to provide clients with convenience services for common operations and support for common scenarios where selection changes should be coordinated with state changes made to the data model.

The Application View

A view on an application model is an implementation of the ApplicationView interface. Standard application views for Swing main windows are provided in the com.glaivestone.mv.swing package. The standard views can be subclassed to add application-specific view components and user interaction.

Managing the Application Execution Session

The MV application framework works in conjunction with a session manager which supports application sessions with one or more windows. The UISessionManager.current for an application execution session monitors all open main windows in the session. In addition to providing services for accessing the open windows in the session, it is configured with a control policy which determines whether a window close event should terminate the execution session (i.e., exit the java process).

Two standard session control policies are provided:

The default UI application session policy is MultipleWindowsSessionControlPolicy. Customized control policies can be configured by providing your own implementation of the SessionControlPolicy interface and installing it on the current session manager in your application's initialization logic.


GFL 1.1 API