Sunday, October 17, 2010

TriStateFormModel, EditorFormModel and EditorForm

For many line-of-business applications there is a common requirement for user-interfaces that can function in one of three contextual modes; view, edit, new. Typically these user-interfaces are often shown in modal dialog scenarios. To cater for this specific scenario the view-model class, TriStateFormModel, was created.

The TriStateFormModel class exposes a number of properties that assist in making dynamic user-interfaces that are dependent on the contextual state of the model.

The EditorFormModel class extends this by providing built-in support for dirty state management and including hooks for saving changes.  The accompanying EditorForm class inherits from Form and extends the ChildWindow template by including additional buttons to handle “save and close”, “apply changes” and “close” commands.

The buttons have the following behaviour;

  • The “apply changes” button is optional and is only enabled if the model is dirty.
  • The “save and close” button is only shown if the model is dirty.
  • The “close” button is marked “cancel” if the view-model is dirty.

These classes are heavily used in one of my serious LOB applications… Smile

No comments:

Post a Comment