[ Lit Window Library at SourceForge[ Lit Window Productions Homepage ]  [ wxWidgets Tips&Tricks ]  [  wxVisualSetup ]

Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
The name Mediator is taken from Design Patterns. A Mediator object is "... at run-time responsible for controlling and coordinating the interactions of a group of other objects".

Example:
You have a collection of user interface controls: listboxes, text controls, checkboxes etc... The text control shall be enabled only if the checkbox is checked AND the listbox selection is 2. A Mediator object encapsulates this behaviour. The individual controls are completely separate, they do not have any interdependencies ("don't know each other"). The Mediator object maintains references to all controls. Every control reports only to the Mediator object. When a state changes, the Mediator object updates all objects.
Or, in shorter words, the Mediator encapsulates the 'behaviour' of the UI.

What is the RapidUI mechanism?

The RapidUI mechanism is a small set of objects and functions that reduces the drugery work when creating user interface code.

How we write UI code today...

Implementing a user interface typically involves the following steps:
  1. create some data structures that take the user input.
  2. use a UI designer to create a graphical UI layout, place window controls etc...
  3. create a 'dialog' class that represents the UI layout.
  4. write 'TransferDataToDialog' to initialise the UI controls with values from the data structure.
  5. write 'TransferDataFromDialog' to validate the user input and transfer the values back to the data structure.
  6. write 'OnIdle' to update the state of controls that depend on the state of the dialog - enable/disable certain controls when a checkbox is checked/unchecked etc...
  7. write several 'OnAction' functions to be executed when a specific event occurs, such as a button pressed.
  8. compile, test, debug, compile, test, debug, curse & swear, debug, write some more code...

RapidUI aims to reduce the steps 3-8 dramatically. Its most important goal is to provide programmers with a ready made library of typical user interface patterns.

Example:
One of the most common user interface patterns is the 'Add/Modify/Delete' pattern. Almost everytime a user is presented a list of records, he also should be able to add new records and modify or delete existing records. If you look for it you will find the 'Add/Modify/Delete' everywhere:

What UI code looks like with RapidUI...

Implementing a user interface with rapidUI involves the following steps:
  1. create some data structures that take the user input.
  2. use a UI designer to create a graphical UI layout, place window controls etc.
  3. use rules to describe the interaction between controls and data structures.
  4. Pass data structures, UI layout and rules to a rapidUI Mediator object.

RapidUI design goals are:

The last point is especially important if the rapidUI mechanism is to be accepted by programmers. There are two reasons for this:

  1. There is some overhead neccessary to be able to use the rapidUI mechanism. This overhead must be kept to a minimum, so that using rapidUI makes sense even for very small user interface dialogues.
  2. rapidUI will be able to handle most, but not all situations. There must be some way to handle special situations, that cannot be implemented easily with rapidUI. In these situations, control-flow must pass from the rapidUI mechanism to hand-crafted code and back again. If the transition between the rapidUI world and the programming language is too difficult or cumbersome, rapidUI will not be used.

How RapidUI saves time and effort...

Step 3 above says: "use rules to describe the interactions between controls and data structures."

This is where rapidUI can save a lot of time.

  1. describing interdependencies between controls is a lot faster than hand-coding it.
  2. rules can be put into a library, just like the STL does with containers. Using rules from a library speeds up implementing UI code dramatically.

Example:
Take the 'Add/Modify/Delete' pattern from above. Rather than hand-crafting the mechanism - and repeating this work for every different data structure again and again and again - you simply
  1. define your data structure
  2. design your user interface
  3. use the 'Add/Modify/Delete' rule from the library and you are done.

The rapidUI elements...


Copyright 2004, Hajo Kirchhoff, Lit Window Productions