com.borland.primetime.actions
Class ActionMenuBar

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JMenuBar
                          |
                          +--com.borland.primetime.actions.ActionMenuBar

public class ActionMenuBar
extends javax.swing.JMenuBar

The ActionMenuBar subclass of JMenuBar defines a menubar that is dynamically built from the contents of the ActionGroups it is associated with.

ActionMenuBars are constructed with a source Object, which will be passed as the source of the ActionEvent when the actionPerformed methods are called in the associated actions. This allows the ActionMenuBar to pass a particular source object (not the menubar 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 ActionMenuBar.

Once instantiated, you can add top-level menus to the ActionMenuBar by calling the addGroup(ActionGroup) methods. An ActionMenu will be constructed and placed on the ActionMenuBar.

See Also:
ActionMenu, ActionGroup, Serialized Form

Inner classes inherited from class javax.swing.JMenuBar
javax.swing.JMenuBar.AccessibleJMenuBar
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
protected  java.util.ArrayList groups
           
protected  java.util.HashMap menuHash
           
protected  java.lang.Object source
           
 
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
ActionMenuBar(java.lang.Object source)
          Constructs an ActionMenuBar with the specified source object.
 
Method Summary
 void addGroup(ActionGroup group)
          Adds an ActionGroup (top-level menu) to this ActionMenuBar at the end.
 void addGroup(int index, ActionGroup group)
          Inserts an ActionGroup (top-level menu) into this ActionMenuBar at the specified index.
 ActionGroup getGroup(int index)
          Returns the ActionGroup (top-level menu) at the specified index.
 int getGroupCount()
          Returns the count of ActionGroups (top-level menus) in this ActionMenuBar.
 ActionGroup[] getGroups()
          Returns an array containing all ActionGroups (top-level menus) in this ActionMenuBar.
 java.lang.Object getSource()
          Returns the object source for this ActionMenuBar.
 void removeGroup(ActionGroup group)
          Removes the specified ActionGroup (top-level menu) from the ActionMenuBar.
 
Methods inherited from class javax.swing.JMenuBar
add, addNotify, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getHelpMenu, getMargin, getMenu, getMenuCount, getSelectionModel, getSubElements, getUI, getUIClassID, isBorderPainted, isManagingFocus, isSelected, menuSelectionChanged, paintBorder, paramString, processKeyEvent, processMouseEvent, removeNotify, setBorderPainted, setHelpMenu, setMargin, setSelected, setSelectionModel, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, 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, remove, remove, removeAll, 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

groups

protected java.util.ArrayList groups

menuHash

protected java.util.HashMap menuHash

source

protected java.lang.Object source
Constructor Detail

ActionMenuBar

public ActionMenuBar(java.lang.Object source)
Constructs an ActionMenuBar with the specified source object.
Parameters:
source - The source object
Method Detail

getSource

public java.lang.Object getSource()
Returns the object source for this ActionMenuBar.
Returns:
The source for this ActionMenuBar

getGroupCount

public int getGroupCount()
Returns the count of ActionGroups (top-level menus) in this ActionMenuBar.
Returns:
An int representing the count of ActionGroups

getGroup

public ActionGroup getGroup(int index)
Returns the ActionGroup (top-level menu) at the specified index.
Parameters:
index - The index of the ActionGroup
Returns:
The ActionGroup at the specified index

getGroups

public ActionGroup[] getGroups()
Returns an array containing all ActionGroups (top-level menus) in this ActionMenuBar.
Returns:
The ActionGroups in this ActionMenuBar

addGroup

public void addGroup(ActionGroup group)
Adds an ActionGroup (top-level menu) to this ActionMenuBar at the end.
Parameters:
group - The ActionGroup to add

addGroup

public void addGroup(int index,
                     ActionGroup group)
Inserts an ActionGroup (top-level menu) into this ActionMenuBar at the specified index.
Parameters:
index - The index at which to insert the ActionGroup
group - The ActionGroup to insert

removeGroup

public void removeGroup(ActionGroup group)
Removes the specified ActionGroup (top-level menu) from the ActionMenuBar.
Parameters:
group - The ActionGroup to remove