dsto.dfc.swing.commands
Class CompositeCmdMenuProvider

java.lang.Object
  extended by dsto.dfc.swing.commands.CompositeCmdMenuProvider
All Implemented Interfaces:
CustomMenuProvider, ActionListener, EventListener

public class CompositeCmdMenuProvider
extends Object
implements CustomMenuProvider, ActionListener

Implements the command menu provider interface for composite commands.

Version:
$Revision$
Author:
shahinm

Field Summary
protected  ButtonGroup buttonGroup
           
protected  ArrayList changeListeners
           
protected  CompositeCommand compositeCmd
           
 
Constructor Summary
CompositeCmdMenuProvider(CompositeCommand command)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void addChangeListener(ChangeListener l)
          Custom menu providers should fire change events when the menu UI needs to be updated.
protected  JMenuItem createMenuItem(ButtonGroup itemButtonGroup, Command childCmd)
          Create a menu item for the child command
 List createMenuItems()
          Create the menu items that represent the UI for the command.
 void destroyMenuItems(List menuItems)
          Destroy menu items created by createMenuItems ().
protected  void fireStateChanged()
           
protected  void fireStateChanged(ChangeEvent e)
          Informs all the change listeners that the state of this menu provider has changed.
 boolean isSelected(Command childCmd)
           
 void removeChangeListener(ChangeListener l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

compositeCmd

protected CompositeCommand compositeCmd

changeListeners

protected transient ArrayList changeListeners

buttonGroup

protected ButtonGroup buttonGroup
Constructor Detail

CompositeCmdMenuProvider

public CompositeCmdMenuProvider(CompositeCommand command)
Method Detail

isSelected

public boolean isSelected(Command childCmd)

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 menuItems)
Description copied from interface: CustomMenuProvider
Destroy menu items created by createMenuItems ().

Specified by:
destroyMenuItems in interface CustomMenuProvider

createMenuItem

protected JMenuItem createMenuItem(ButtonGroup itemButtonGroup,
                                   Command childCmd)
Create a menu item for the child command

Parameters:
itemButtonGroup - the button group to add the menu item to.
childCmd - the command that a menu item is to be created for.
Returns:
The JMenuItem that represents the child command.

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

removeChangeListener

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

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

fireStateChanged

protected void fireStateChanged()

fireStateChanged

protected void fireStateChanged(ChangeEvent e)
Informs all the change listeners that the state of this menu provider has changed.



Copyright © 2008 Commonwealth of Australia