org.bs.mdi.swing
Class SwingCommandAdapter

java.lang.Object
  extended byorg.bs.mdi.Command
      extended byorg.bs.mdi.swing.SwingCommand
          extended byorg.bs.mdi.swing.SwingCommandAdapter
All Implemented Interfaces:
MessageProcessor
Direct Known Subclasses:
SwingWindowCommand

public class SwingCommandAdapter
extends SwingCommand

Adapter for SwingCommand to simplify subclassing


Constructor Summary
SwingCommandAdapter(String name, String description)
          Creates a new command.
 
Method Summary
protected  void doExecute()
          Executes this command.
 KeyStroke getAccelerator()
          Gets the "accelerator" for this action.
 Icon getIcon(int size)
          Gets an icon representing this command.
 void processMessage(Object source, int type, Object argument)
          Processes messages.
 
Methods inherited from class org.bs.mdi.swing.SwingCommand
getDescription, getName, removeFrom, setDescription, setName
 
Methods inherited from class org.bs.mdi.Command
addTrigger, countTriggers, execute, getLocalizedDescription, getLocalizedName, getTriggers, isAvailable, removeAllTriggers, removeTrigger, setAvailable, updateTriggers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingCommandAdapter

public SwingCommandAdapter(String name,
                           String description)
Creates a new command.

Parameters:
name - the name of the command
description - the command's description
Method Detail

doExecute

protected void doExecute()
Description copied from class: Command
Executes this command.

Specified by:
doExecute in class SwingCommand

getIcon

public Icon getIcon(int size)
Description copied from class: SwingCommand
Gets an icon representing this command.

Specified by:
getIcon in class SwingCommand
Parameters:
size - the requested size of the icon
Returns:
the icon, or null if no icon is available

processMessage

public void processMessage(Object source,
                           int type,
                           Object argument)
Description copied from class: Command
Processes messages. Using these messages, this method should try to determine if the command should be available or not and set the available status using Command.setAvailable(boolean). See: MessageProcessor.processMessage(Object, int, Object)

Specified by:
processMessage in interface MessageProcessor
Specified by:
processMessage in class SwingCommand

getAccelerator

public KeyStroke getAccelerator()
Description copied from class: SwingCommand
Gets the "accelerator" for this action. This is the key combination which is supposed to trigger the event.

Specified by:
getAccelerator in class SwingCommand
Returns:
the accelerator