GUI Commands 2.0 has arrived! Find out what's new and improved.
Delegating Commands

Delegating commands are typically used whenever the behaviour of a standard menu or toolbar item changes based on the current context of the application.  Such examples would include cut, copy, paste and print.

The behaviour of each command is provided by CommandDelegate instances that are managed by a DelegateMediator.  The following diagram shows a typical example.

When the delegates of a context are loaded into the mediator all commands are notified and update their state appropriately.  Each command will attach to the delegate that shares it's ID, if no match is found the command will disable itself.

DefaultDelegateMediator

The DefaultDelegateMediator class provides a default implementation of DelegateMediator.  It is also suitable for use as a support class for other classes that wish to implement the DelegateMediator interface.

SwingActionDelegate

SwingActionDelegate's are a CommandDelegate implementation that wraps a standard Swing Action. They are a convenient wrapper for actions such as the cut, copy and paste actions of a JTextComponent.