org.bs.mdi.swing
Class SwingCommandMenu

java.lang.Object
  extended byorg.bs.mdi.swing.SwingCommandTrigger
      extended byorg.bs.mdi.swing.SwingCommandMenu
All Implemented Interfaces:
ActionListener, CommandTrigger, EventListener

public class SwingCommandMenu
extends SwingCommandTrigger
implements ActionListener

A Wrapper for JMenus which adds CommandTrigger functionality.


Constructor Summary
SwingCommandMenu(SwingCommand command)
          Creates a new SwingCommandMenu and associates it with the given command.
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void commandUpdated()
          Informs this trigger that the associated command has changed.
static JMenu createMenu(SwingCommand command)
          Creates a new menu and associates it with the given command.
 JMenu getMenu()
          Gets the menu "wrapped" behind this object.
 boolean removeFrom(Container container)
          Removes this trigger from the sepecified container.
 void setEnabled(boolean enabled)
          Enables or disables this command trigger.
 
Methods inherited from class org.bs.mdi.swing.SwingCommandTrigger
commandExecuted, execute, getCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingCommandMenu

public SwingCommandMenu(SwingCommand command)
Creates a new SwingCommandMenu and associates it with the given command.

Parameters:
command - the command to associate this menu with
Method Detail

createMenu

public static JMenu createMenu(SwingCommand command)
Creates a new menu and associates it with the given command. This is just a convenience function for calling return new SwingCommandMenu(command).getMenu()

Parameters:
command - the command to associated this menu with
Returns:
the new menu

getMenu

public JMenu getMenu()
Gets the menu "wrapped" behind this object.

Returns:
the wrapped menu

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: CommandTrigger
Enables or disables this command trigger.

Specified by:
setEnabled in interface CommandTrigger
Specified by:
setEnabled in class SwingCommandTrigger

actionPerformed

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

commandUpdated

public void commandUpdated()
Description copied from interface: CommandTrigger
Informs this trigger that the associated command has changed. This typically includes name or description changes. The trigger should update itself to reflect that changes.

Specified by:
commandUpdated in interface CommandTrigger
Overrides:
commandUpdated in class SwingCommandTrigger

removeFrom

public boolean removeFrom(Container container)
Description copied from class: SwingCommandTrigger
Removes this trigger from the sepecified container.

Specified by:
removeFrom in class SwingCommandTrigger
Parameters:
container - the container which is supposed to contain this trigger
Returns:
true if the trigger has been removed, false otherwise