|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPopupMenu | +--com.borland.primetime.actions.ActionPopupMenu
The ActionPopupMenu subclass of JPopupMenu defines a popup 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 ActionPopupMenu will handle it. When an ActionPopupMenu 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 ActionPopupMenu 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 |
ActionPopupMenus 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 ActionPopupMenu to pass a particular source object (not the menu or menu items themselves), so the associated Actions can have direct access to a specific Object. This source is determined by the code that instantiates the ActionPopupMenu.
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.
Action
,
ActionGroup
,
StateAction
,
UpdateableAction
, Serialized FormInner classes inherited from class javax.swing.JPopupMenu |
javax.swing.JPopupMenu.AccessibleJPopupMenu,
javax.swing.JPopupMenu.Separator |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field Summary | |
protected ActionGroup |
aGroup
|
protected boolean |
boldDefault
|
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 | |
ActionPopupMenu(java.lang.Object source,
ActionGroup group)
Constructs an ActionPopupMenu with the specified source object and ActionGroup. |
Method Summary | |
javax.swing.Action |
getAction()
Returns the action (ActionGroup) for this ActionPopupMenu. |
ActionGroup |
getGroup()
Returns the ActionGroup for this ActionPopupMenu. |
java.awt.Dimension |
getPreferredSize()
|
java.lang.Object |
getSource()
Returns the object source for this ActionPopupMenu. |
boolean |
isBoldDefaultAction()
|
void |
setBoldDefaultAction(boolean boldDefault)
|
void |
show(java.awt.Component invoker,
int x,
int y)
|
Methods inherited from class javax.swing.JPopupMenu |
add,
add,
add,
addPopupMenuListener,
addSeparator,
createActionChangeListener,
firePopupMenuCanceled,
firePopupMenuWillBecomeInvisible,
firePopupMenuWillBecomeVisible,
getAccessibleContext,
getComponent,
getComponentAtIndex,
getComponentIndex,
getDefaultLightWeightPopupEnabled,
getInvoker,
getLabel,
getMargin,
getSelectionModel,
getSubElements,
getUI,
getUIClassID,
insert,
insert,
isBorderPainted,
isLightWeightPopupEnabled,
isVisible,
menuSelectionChanged,
pack,
paintBorder,
paramString,
processKeyEvent,
processMouseEvent,
remove,
remove,
removePopupMenuListener,
setBorderPainted,
setDefaultLightWeightPopupEnabled,
setInvoker,
setLabel,
setLightWeightPopupEnabled,
setLocation,
setPopupSize,
setPopupSize,
setSelected,
setSelectionModel,
setUI,
setVisible,
updateUI |
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,
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,
processKeyEvent,
processMouseMotionEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removeNotify,
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,
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,
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,
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,
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 |
protected java.lang.Object source
protected ActionGroup aGroup
protected boolean boldDefault
Constructor Detail |
public ActionPopupMenu(java.lang.Object source, ActionGroup group)
source
- The source objectgroup
- The action groupMethod Detail |
public java.awt.Dimension getPreferredSize()
public java.lang.Object getSource()
public javax.swing.Action getAction()
public ActionGroup getGroup()
public void setBoldDefaultAction(boolean boldDefault)
public boolean isBoldDefaultAction()
public void show(java.awt.Component invoker, int x, int y)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |