org.esa.beam.framework.ui.command
Class DefaultCommandUIFactory

java.lang.Object
  extended by org.esa.beam.framework.ui.command.DefaultCommandUIFactory
All Implemented Interfaces:
CommandUIFactory

public class DefaultCommandUIFactory
extends Object
implements CommandUIFactory

The DefaultCommandUIFactory is used to create menu items and tool bar buttons for a given Command. It is also used to add context dependent menu items to a menu.


Constructor Summary
DefaultCommandUIFactory()
          Constructs a new factory.
 
Method Summary
 JPopupMenu addContextDependentMenuItems(String context, JPopupMenu popup)
          Adds menu items to the given popup menu.
 JMenuItem createMenuItem(CommandGroup commandGroup)
          Creates a menu item for the given command group.
 JMenuItem createMenuItem(ExecCommand command)
          Creates a menu item for the given executable command.
 JMenuItem createMenuItem(ToolCommand command)
          Creates a menu item for the given tool command.
 AbstractButton createToolBarButton(CommandGroup commandGroup)
          Creates a tool bar button for the given command group.
 AbstractButton createToolBarButton(ExecCommand command)
          Creates a tool bar button for the given executable command.
 AbstractButton createToolBarButton(ToolCommand command)
          Creates a tool bar button for the given tool command.
 CommandManager getCommandManager()
          Gets the command manager for this factory.
 boolean isShowingDisabledMenuItems()
          Gets whether or not disabled menut items should be added to a menu in the addContextDependentMenuItems(java.lang.String, javax.swing.JPopupMenu) method.
 void setCommandManager(CommandManager commandManager)
          Sets the command manager for this factory.
 void setShowingDisabledMenuItems(boolean showingDisabledMenuItems)
          Sets whether or not disabled menut items should be added to a menu in the addContextDependentMenuItems(java.lang.String, javax.swing.JPopupMenu) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCommandUIFactory

public DefaultCommandUIFactory()
Constructs a new factory.

Method Detail

getCommandManager

public CommandManager getCommandManager()
Gets the command manager for this factory.

Specified by:
getCommandManager in interface CommandUIFactory
Returns:
the command manager, can be null.

setCommandManager

public void setCommandManager(CommandManager commandManager)
Sets the command manager for this factory.

Specified by:
setCommandManager in interface CommandUIFactory
Parameters:
commandManager - the command manager, can be null.

isShowingDisabledMenuItems

public boolean isShowingDisabledMenuItems()
Gets whether or not disabled menut items should be added to a menu in the addContextDependentMenuItems(java.lang.String, javax.swing.JPopupMenu) method.

Specified by:
isShowingDisabledMenuItems in interface CommandUIFactory
Returns:
true if so

setShowingDisabledMenuItems

public void setShowingDisabledMenuItems(boolean showingDisabledMenuItems)
Sets whether or not disabled menut items should be added to a menu in the addContextDependentMenuItems(java.lang.String, javax.swing.JPopupMenu) method.

Specified by:
setShowingDisabledMenuItems in interface CommandUIFactory
Parameters:
showingDisabledMenuItems - true if so

createMenuItem

public JMenuItem createMenuItem(ExecCommand command)
Creates a menu item for the given executable command.

Specified by:
createMenuItem in interface CommandUIFactory
Parameters:
command - the executable command, must not be null
Returns:
the menu item

createMenuItem

public JMenuItem createMenuItem(ToolCommand command)
Creates a menu item for the given tool command. The method is not implemented.

Specified by:
createMenuItem in interface CommandUIFactory
Parameters:
command - the tool command, must not be null
Returns:
currently always null

createMenuItem

public JMenuItem createMenuItem(CommandGroup commandGroup)
Creates a menu item for the given command group.

Specified by:
createMenuItem in interface CommandUIFactory
Parameters:
commandGroup - the command group, must not be null
Returns:
the menu item

createToolBarButton

public AbstractButton createToolBarButton(ExecCommand command)
Creates a tool bar button for the given executable command.

Specified by:
createToolBarButton in interface CommandUIFactory
Parameters:
command - the executable command, must not be null
Returns:
the tool bar button

createToolBarButton

public AbstractButton createToolBarButton(ToolCommand command)
Creates a tool bar button for the given tool command.

Specified by:
createToolBarButton in interface CommandUIFactory
Parameters:
command - the tool command, must not be null
Returns:
the tool bar button

createToolBarButton

public AbstractButton createToolBarButton(CommandGroup commandGroup)
Creates a tool bar button for the given command group.

Specified by:
createToolBarButton in interface CommandUIFactory
Parameters:
commandGroup - the command group, must not be null
Returns:
the tool bar button

addContextDependentMenuItems

public JPopupMenu addContextDependentMenuItems(String context,
                                               JPopupMenu popup)
Adds menu items to the given popup menu. A command manager must have been set before this method can be used.

Specified by:
addContextDependentMenuItems in interface CommandUIFactory
Parameters:
context - the context string
popup - the popup menu, must not be null
Returns:
the given popup menu, all context matching menu items added.
See Also:
setCommandManager(org.esa.beam.framework.ui.command.CommandManager)


Copyright © 2002-2012 Brockmann Consult GmbH. All Rights Reserved.