DESY ACOP Beans Home

com.cosylab.gui.components.util
Class Actions

java.lang.Object
  extended by com.cosylab.gui.components.util.Actions

public final class Actions
extends java.lang.Object

Convenience class with set of utilities to help work with Action instances. Supports enhencments to Action framework by Abeans.

If ActionList contains null action, than separator menu item is used.

Version:
$id$
Author:
Miha Kadunc, Igor Kriznar

Nested Class Summary
static class Actions.ListenerForMenu
          DOCUMENT ME!
 
Field Summary
static java.lang.String LARGE_ICON
          Action value key for large icon image.
static javax.swing.Action SEPARATOR
          Action, which is used as placeholder for separator menu item.
 
Constructor Summary
Actions()
           
 
Method Summary
static javax.swing.AbstractButton createButton(javax.swing.Action action)
          Creates a button using the provided action.
static javax.swing.JButton createButton(ActionList info)
          Constructs a button from the provided ActionList.
static javax.swing.JMenu createMenu(ActionList actions)
          Constructs a menu with the given actions as menu items.
static javax.swing.JMenu createMenu(ActionList actions, int orientation)
          Constructs a menu with given actions as menu items.
static javax.swing.JMenuBar createMenuBar(ActionList actions)
          Constructs a menu bar with the give actions.
static javax.swing.JComponent createMenuComponent(javax.swing.Action action)
          Creates new JMenuItem or JSeparator, depending on provided action.
static javax.swing.JComponent createMenuComponent(javax.swing.Action action, boolean radio, int orientation)
          Creates new JMenuItem or JSeparator, depending on provided action.
static javax.swing.JMenuItem createMenuItem(javax.swing.Action action)
          Creates new JMenuItem.
static javax.swing.JMenuItem createMenuItem(javax.swing.Action action, boolean radio)
          Creates new JMenuItem.
static javax.swing.JMenuItem createMenuItem(ActionList actions)
          Creates a menu item with the given action.
static javax.swing.JMenuItem createMenuItem(ActionList actions, boolean radio)
          Creates a menu item with the given action.
static javax.swing.JPopupMenu createPopupMenu(ActionList info)
          Creates a popup menu with the given actions.
static boolean isSeparator(javax.swing.Action action)
          Returns true if action should be mapped to separator menu item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LARGE_ICON

public static final java.lang.String LARGE_ICON
Action value key for large icon image.

See Also:
Constant Field Values

SEPARATOR

public static final javax.swing.Action SEPARATOR
Action, which is used as placeholder for separator menu item.

Constructor Detail

Actions

public Actions()
Method Detail

createButton

public static javax.swing.AbstractButton createButton(javax.swing.Action action)
Creates a button using the provided action.

Parameters:
action -
Returns:
new button with assigned action

createButton

public static javax.swing.JButton createButton(ActionList info)
Constructs a button from the provided ActionList.

Parameters:
info -
Returns:
button with assigned action

createMenuItem

public static javax.swing.JMenuItem createMenuItem(javax.swing.Action action)
Creates new JMenuItem. If action is null or has SEPARATORvalue true, null is returned.

Parameters:
action - action for which menu item should be created
Returns:
JMenuItem or null if action is null or has SEPARATORvalue true

createMenuComponent

public static javax.swing.JComponent createMenuComponent(javax.swing.Action action)
Creates new JMenuItem or JSeparator, depending on provided action. If action is null or has SEPARATORvalue true, then is reckognized as separator and instance of JSeparator with provided orientation is returned.

Same as createMenuComponent(Action action, boolean radio, int orientation) with false for radio and SwingConstants.HORIZONTAL for orientation.

Parameters:
action - action for which menu item should be created
Returns:
JMenuItem or JSeparator if action is null or has SEPARATORvalue true

createMenuComponent

public static javax.swing.JComponent createMenuComponent(javax.swing.Action action,
                                                         boolean radio,
                                                         int orientation)
Creates new JMenuItem or JSeparator, depending on provided action. If action is null or has SEPARATORvalue true, then is reckognized as separator and instance of JSeparator with provided orientation is returned.

Parameters:
action - action for which menu item should be created
radio - if true then JRadioButtonMenuItem is created
orientation - orientation used to
Returns:
JMenuItem or JSeparator if action is null or has SEPARATORvalue true

createMenuItem

public static javax.swing.JMenuItem createMenuItem(javax.swing.Action action,
                                                   boolean radio)
Creates new JMenuItem. If action is null or has SEPARATORvalue true, null is returned.

Parameters:
action - action for which menu item should be created
radio - if true then JRadioButtonMenuItem is created
Returns:
JMenuItem or null if action is null or has SEPARATORvalue true

isSeparator

public static boolean isSeparator(javax.swing.Action action)
Returns true if action should be mapped to separator menu item.

Parameters:
action -
Returns:
true if action should be mapped to separator menu item

createPopupMenu

public static javax.swing.JPopupMenu createPopupMenu(ActionList info)
Creates a popup menu with the given actions.

Parameters:
info - actions to be included in the popup
Returns:
popup menu with assigned actions

createMenuItem

public static javax.swing.JMenuItem createMenuItem(ActionList actions)
Creates a menu item with the given action.

Parameters:
actions -
Returns:
menu item with assigned action

createMenuItem

public static javax.swing.JMenuItem createMenuItem(ActionList actions,
                                                   boolean radio)
Creates a menu item with the given action.

Parameters:
actions -
radio - if true the menu item will be a radio button
Returns:
menu item with assigned action

createMenu

public static javax.swing.JMenu createMenu(ActionList actions)
Constructs a menu with the given actions as menu items.

Parameters:
actions - menu items actions
Returns:
menu with assigned actions

createMenu

public static javax.swing.JMenu createMenu(ActionList actions,
                                           int orientation)
Constructs a menu with given actions as menu items.

Parameters:
actions - menu items actions
orientation -
Returns:
menu with assigned actions

createMenuBar

public static javax.swing.JMenuBar createMenuBar(ActionList actions)
Constructs a menu bar with the give actions.

Parameters:
actions -
Returns:
menu bar with assigned action


Copyright © 2010. All Rights Reserved.