com.borland.primetime.actions
Class ActionMenu

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.AbstractButton
                          |
                          +--javax.swing.JMenuItem
                                |
                                +--javax.swing.JMenu
                                      |
                                      +--com.borland.primetime.actions.ActionMenu

public class ActionMenu
extends javax.swing.JMenu
implements ActionWidget

The ActionMenu subclass of JMenu defines a physical menu that is dynamically built from the contents of the ActionGroup it is constructed with. As the menu is expanded, the sub-items are dynamically created on the fly to display the current hierarchy of the ActionGroup. Between each poping-up of the menu, the contents of the ActionGroup may completely change, and the ActionMenu will handle it. When an ActionMenu is about to be displayed, its contained Actions are scanned for instances of UpdateableAction, which are updated before the menu displays. When a menu item is clicked, the associated Action's actionPerformed method is called.

The ActionMenu instantiates UI widgets to represent Action objects on the fly - as the menu and submenus are popped-up. The following Action sub- types are displayed using the follwing widgets:

Action sub-type Attributes UI Widget
ActionGroup POPUP = true ActionMenu
ActionGroup POPUP = false (recurse between separators)
StateAction JMenuItem (special check)
Action JMenuItem

ActionMenus are constructed with a source Object and an ActionGroup to represent. The source Object will be passed as the source of the ActionEvent in the associated actions' actionPerformed methods. This allows an ActionMenu to pass a particular source object (not the menu or menuitems themselves), so the associated Actions can have direct access to a specific Object. This source is determined by the code that instantiates the ActionMenu.

In all cases, the SHORT_DESCRIPTION attribute is used for the text, the SMALL_ICON attribute is used for the icon (icons on/off with static 'showIcons' property), the MNEMONIC attribute is used for the mnemonic, and the ACCELLERATOR attribute is used for the accellerator.

See Also:
Action, ActionGroup, StateAction, UpdateableAction, Serialized Form

Inner classes inherited from class javax.swing.JMenu
javax.swing.JMenu.AccessibleJMenu, javax.swing.JMenu.WinListener
 
Inner classes inherited from class javax.swing.JMenuItem
javax.swing.JMenuItem.AccessibleJMenuItem
 
Inner classes inherited from class javax.swing.AbstractButton
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
protected  ActionGroup aGroup
           
protected  java.lang.Object source
           
 
Fields inherited from class javax.swing.JMenu
popupListener
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
ActionMenu(java.lang.Object source, ActionGroup group)
          Constructs an ActionMenu with the specified source object and ActionGroup.
 
Method Summary
static void expandMenuGroup(java.lang.Object source, java.awt.Container container, ActionGroup group, boolean boldDefault)
           
 javax.swing.Action getAction()
          Returns the action (ActionGroup) for this ActionMenu.
 ActionGroup getGroup()
          Returns the ActionGroup for this ActionMenu.
 java.lang.Object getSource()
          Returns the object source for this ActionMenu.
static boolean scanForIcons(java.awt.Container container)
           
static void stripIcons(java.awt.Container container)
           
static void stripMnemonics(java.awt.Container container)
           
 
Methods inherited from class javax.swing.JMenu
add, add, add, add, addMenuListener, addSeparator, createActionChangeListener, createWinListener, doClick, fireMenuCanceled, fireMenuDeselected, fireMenuSelected, getAccessibleContext, getComponent, getDelay, getItem, getItemCount, getMenuComponent, getMenuComponentCount, getMenuComponents, getPopupMenu, getSubElements, getUIClassID, insert, insert, insert, insertSeparator, isMenuComponent, isPopupMenuVisible, isSelected, isTearOff, isTopLevelMenu, menuSelectionChanged, paramString, processKeyEvent, remove, remove, remove, removeAll, removeMenuListener, setAccelerator, setDelay, setMenuLocation, setModel, setPopupMenuVisible, setSelected, updateUI
 
Methods inherited from class javax.swing.JMenuItem
addMenuDragMouseListener, addMenuKeyListener, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, init, isArmed, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setArmed, setEnabled, setUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createChangeListener, createItemListener, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getDisabledIcon, getDisabledSelectedIcon, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getLabel, getMargin, getMnemonic, getModel, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setLabel, setMargin, setMnemonic, setMnemonic, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, processComponentKeyEvent, processFocusEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

source

protected java.lang.Object source

aGroup

protected ActionGroup aGroup
Constructor Detail

ActionMenu

public ActionMenu(java.lang.Object source,
                  ActionGroup group)
Constructs an ActionMenu with the specified source object and ActionGroup.
Parameters:
source - The source object
group - The action group
Method Detail

getSource

public java.lang.Object getSource()
Returns the object source for this ActionMenu.
Specified by:
getSource in interface ActionWidget
Returns:
The source object

getAction

public javax.swing.Action getAction()
Returns the action (ActionGroup) for this ActionMenu.
Specified by:
getAction in interface ActionWidget
Returns:
The action group

getGroup

public ActionGroup getGroup()
Returns the ActionGroup for this ActionMenu.
Returns:
The ActionGroup

scanForIcons

public static boolean scanForIcons(java.awt.Container container)

stripIcons

public static void stripIcons(java.awt.Container container)

stripMnemonics

public static void stripMnemonics(java.awt.Container container)

expandMenuGroup

public static void expandMenuGroup(java.lang.Object source,
                                   java.awt.Container container,
                                   ActionGroup group,
                                   boolean boldDefault)