dsto.dfc.swing.commands
Class AbstractBooleanCommand

java.lang.Object
  extended by dsto.dfc.swing.commands.AbstractCommand
      extended by dsto.dfc.swing.commands.AbstractMutableCommand
          extended by dsto.dfc.swing.commands.AbstractBooleanCommand
All Implemented Interfaces:
Command, CustomMenuProvider, CustomToolBarProvider, Iconic, Copyable, PropertyEventSource, ActionListener, Cloneable, EventListener

public abstract class AbstractBooleanCommand
extends AbstractMutableCommand
implements CustomMenuProvider, CustomToolBarProvider

Base class for commands that can be 'on' or 'off'. Provides custom checkbox menu item creation to show command state.

Version:
$Revision$

Field Summary
 
Fields inherited from class dsto.dfc.swing.commands.AbstractMutableCommand
listeners
 
Fields inherited from class dsto.dfc.swing.commands.AbstractCommand
displayName, icon
 
Fields inherited from interface dsto.dfc.swing.icons.Iconic
NULL_ICON
 
Constructor Summary
AbstractBooleanCommand()
           
AbstractBooleanCommand(String iconName)
           
 
Method Summary
 void addChangeListener(ChangeListener l)
          Custom menu providers should fire change events when the menu UI needs to be updated.
 List createMenuItems()
          Create the menu items that represent the UI for the command.
 JComponent createToolBarComponent()
          Create the Component that represent the UI for the command.
 void destroyMenuItems(List items)
          Destroy menu items created by createMenuItems ().
 void destroyToolBarComponent(JComponent component)
          Destroy the Component created by createToolBarComponent ().
 boolean getValue()
           
 void removeChangeListener(ChangeListener l)
           
 void setValue(boolean newValue)
           
 
Methods inherited from class dsto.dfc.swing.commands.AbstractMutableCommand
addPropertyChangeListener, clone, isEnabled, removePropertyChangeListener, setEnabled, setIcon
 
Methods inherited from class dsto.dfc.swing.commands.AbstractCommand
actionPerformed, canReplace, execute, getAccelerator, getDefaultDisplayName, getDescription, getDisplayName, getGroupInView, getIcon, getLargeIcon, getLogString, getMnemonic, getName, isInteractive, setDisplayName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBooleanCommand

public AbstractBooleanCommand()

AbstractBooleanCommand

public AbstractBooleanCommand(String iconName)
Method Detail

getValue

public boolean getValue()

setValue

public void setValue(boolean newValue)

createMenuItems

public List createMenuItems()
Description copied from interface: CustomMenuProvider
Create the menu items that represent the UI for the command.

Specified by:
createMenuItems in interface CustomMenuProvider
Returns:
A new list of JComponent's to be added to the menu for the command.

destroyMenuItems

public void destroyMenuItems(List items)
Description copied from interface: CustomMenuProvider
Destroy menu items created by createMenuItems ().

Specified by:
destroyMenuItems in interface CustomMenuProvider

createToolBarComponent

public JComponent createToolBarComponent()
Description copied from interface: CustomToolBarProvider
Create the Component that represent the UI for the command.

Specified by:
createToolBarComponent in interface CustomToolBarProvider
Returns:
A new Component to be added to the ToolBar for the command.

destroyToolBarComponent

public void destroyToolBarComponent(JComponent component)
Description copied from interface: CustomToolBarProvider
Destroy the Component created by createToolBarComponent ().

Specified by:
destroyToolBarComponent in interface CustomToolBarProvider

addChangeListener

public void addChangeListener(ChangeListener l)
Description copied from interface: CustomMenuProvider
Custom menu providers should fire change events when the menu UI needs to be updated. This event will trigger any interested listeners to destroy old menu items (destroyMenuItems ()) and create new ones (createMenuItems ()).

Specified by:
addChangeListener in interface CustomMenuProvider
Specified by:
addChangeListener in interface CustomToolBarProvider

removeChangeListener

public void removeChangeListener(ChangeListener l)
Specified by:
removeChangeListener in interface CustomMenuProvider
Specified by:
removeChangeListener in interface CustomToolBarProvider


Copyright © 2008 Commonwealth of Australia