Events are triggered in the view, and are intercepted by the controller. The controller finds that action to perform. Exceptions are forwarded to the ViewManager to handle, which are "shown" in the original source view. Successful events result in the destination view being shown.
The ViewManager is a custom component, designed to show views in a particular environment. For example, a Swing View Manager knows how to load a view "panel" into the root pane. A Web View Manager is a Servlet that knows how to forward to the view's "template", and the Shell View manager knows how to present views on the command-line.
Encapsulating the view seperates the view-model from the view-layout. A common base class is recommended that defines the view-model, along with accessors.
This framework encourages widget-based views.
Actions are standard Swing AbstractActions. Action classes are required to extend MvcAction. The MvcAction provides resources for the action, (the application context), handles exceptions, and sends messages for the action.
The framework can handle any type of validation mechanism. At the core, the View is required to return a IValidator. Typically, a bean populated with data to be validated is sent to the validator. The Action requiring valid data simply calls the validate() method on the validator.
By using a common model in the view, it is possible to design applications that are not bound to their user interface. For example, Swing widgets could be swapped for SWT widgets. And with a change in the View Manager, the application could just as easily use Html widgets and become a web application.
The workzen.ui.widget.model package contains the "common" model for UI components. It consists of three basic models:
The following standard widgets that have been developed for Swing, Html, and CLI (command line interface).
All widget implemented the common-ui model.
The MVC configuration file is xml. It is composed of views, actions and events. See an example configuration.