Screen Updates
Requirements
- The time required to update the visualization network and redraw the display(s) may vary widely.
- Thus, do not assume that all UI changes should cause an immediate screen update.
- Conversely, do not assume that all updates will be slow - for simple networks & data, don't make the user work harder than they have to.
- Support a wide variety of update policies - immediate update, update only when the user explicitly requests it, etc.
Design
UI components such as pqCheckBox and pqSpinBox do not update the visualization network directly - instead, they create pqCommand-derived "command" instances which encapsulate the changes to be made. These instances are handed-off to a pqCommandDispatcher-derived object, which is maintained by the pqCommandDispatcherManager singleton. pqCommandDispatcher is an abstract interface responsible for "executing" commands, and its different derivatives can provide a wide variety of different execution policies:
- pqImmediateCommandDispatcher - immediately executes each command it receives, and updates the display.
- pqTimeoutCommandDispatcher - caches incoming commands until a timeout expires, then executes the cached commands and updates the display.
- pqExplicitCommandDispatcher - caches incoming commands until the user explicitly decides to execute them.
Currently, the command dispatchers delete commands once they are executed, but if you look closely at pqCommand, you will see that it is designed for undo/redo support ... in the future, expect commands to be "moved" into storage in an undo/redo stack once they have been executed.