| The Engine is responsible for the relationship between the user context
(selected object, window, whatever can influence action presence or
enablement). By design it does not use a "push" model, but
rather a "pull" model. That is, it, and only it, manages the
state of the action presenters in the system. It is responsible for
deciding when something needs to be displayed/painted/updated. The
system can provide hints that now would be a good time to update something,
but it will decide what to do.
For toolbar enablement, the intention is to implement handling enablement
issues using a polling model - rather than trying to push updates for
every change in context (lots of work and most of the time nothing changes),
it will perform such updates in a timely way, but based on its analysis of
the current circumstances. This may be influenced by such things as requests
for visibility on its presenters, idle time in the AWT thread, a timer or
the phase of the moon. In practice the visual result should be no different
than that of a push model, except that it does far less work.
Note the complete absence of use of the listener pattern - this is by design.
author: Tim Boudreau |