This package contains the implementation of the Command pattern.
The actions provided by an application can be implemented as Command
objects. Such an object has a well-defined interface (namely the
Command
interface) and will be run in a separate thread. This is
important for the application to stay responsive even when it executes complex
tasks.
The CommandQueue
interface allows executing command objects: just
pass an object implementing the Command
interface to its
execute()
method. It will then be executed by a working thread (as
soon as one becomes available). The Command
interface provides some
methods that define a kind of life-cycle for a command object. In addition to
the main execute()
method that contains the main logic of the
command methods for error handling are available. There is also support
for updating the GUI after the execution of the command. Special care has to be
taken about this topic because GUI updates must be performed by the event
dispatch thread only.
Interested components can register itself as CommandQueueListener
s
at a command queue object. They will then receive notifications when commands
are executed or the status of the queue changes.
$Id: package.html 205 2012-01-29 18:29:57Z oheger $