org.openide.awt
Class Actions

java.lang.Object
  |
  +--org.openide.awt.Actions

public class Actions
extends Object

Supporting class for manipulation with menu and toolbar presenters.


Inner Class Summary
static class Actions.CheckboxMenuItem
          CheckboxMenuItem extends the java.awt.CheckboxMenuItem and adds a connection to Corona boolean state actions.
static class Actions.MenuItem
          Actions.MenuItem extends the java.awt.MenuItem and adds a connection to Corona system actions.
static class Actions.SubMenu
          SubMenu provides easy way of displaying submenu items based on SubMenuModel.
static interface Actions.SubMenuModel
          Interface for the creating Actions.SubMenu.
static class Actions.ToolbarButton
          Component shown in toolbar, representing an action.
static class Actions.ToolbarToggleButton
          The Component for BooleeanState action that is to be shown in a toolbar.
 
Constructor Summary
Actions()
           
 
Method Summary
static void connect(AbstractButton button, BooleanStateAction action)
          Connects buttons to action.
static void connect(AbstractButton button, SystemAction action)
          Connects buttons to action.
static void connect(JCheckBoxMenuItem item, BooleanStateAction action, boolean popup)
          Attaches checkbox menu item to boolean state action.
static void connect(JMenuItem item, SystemAction action, boolean popup)
          Attaches menu item to an action.
static String cutAmpersand(String text)
          Replaces first occurence of '&?' by '?' or '(&??' by '' where ? is wildcard for any character.
static String findKey(SystemAction action)
          Method that finds the keydescription assigned to this action.
static void setMenuText(AbstractButton item, String text, boolean useMnemonic)
          Sets the text for the menu item or other subclass of AbstractButton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Actions

public Actions()
Method Detail

findKey

public static String findKey(SystemAction action)
Method that finds the keydescription assigned to this action.
Parameters:
action - action to find key for
Returns:
the text representing the key or null if there is no text assigned

connect

public static void connect(JMenuItem item,
                           SystemAction action,
                           boolean popup)
Attaches menu item to an action.
Parameters:
item - menu item
action - action
popup - create popup or menu item

connect

public static void connect(JCheckBoxMenuItem item,
                           BooleanStateAction action,
                           boolean popup)
Attaches checkbox menu item to boolean state action.
Parameters:
item - menu item
action - action
popup - create popup or menu item

connect

public static void connect(AbstractButton button,
                           SystemAction action)
Connects buttons to action.
Parameters:
button - the button
action - the action

connect

public static void connect(AbstractButton button,
                           BooleanStateAction action)
Connects buttons to action.
Parameters:
button - the button
action - the action

setMenuText

public static void setMenuText(AbstractButton item,
                               String text,
                               boolean useMnemonic)
Sets the text for the menu item or other subclass of AbstractButton. Cut from the name '&' char.
Parameters:
item - AbstractButton
text - new label
useMnemonic - if true and '&' char found in new text, next char is used as Mnemonic.

cutAmpersand

public static String cutAmpersand(String text)
Replaces first occurence of '&?' by '?' or '(&??' by '' where ? is wildcard for any character. '&?' is shortcut in English localization. '(&?)' is shortcut in Japanese localization. Used to remove shortcut from workspace names when shortcuts are not supported.
Returns:
string without first '&' if there was any.


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.