org.objectweb.jac.aspects.gui.swing
Class Menu

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.AbstractButton
                          |
                          +--javax.swing.JMenuItem
                                |
                                +--javax.swing.JMenu
                                      |
                                      +--org.objectweb.jac.aspects.gui.swing.Menu
All Implemented Interfaces:
Accessible, ActionListener, EventListener, ImageObserver, ItemSelectable, MenuContainer, MenuElement, MenuView, Serializable, SwingConstants, View, ViewIdentity

public class Menu
extends JMenu
implements MenuView, ActionListener

See Also:
Serialized Form

Field Summary
 
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
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Menu()
           
Menu(ViewFactory factory, DisplayContext context)
           
 
Method Summary
 void actionPerformed(ActionEvent event)
           
 void addAction(String label, String icon, Callback callback)
          Adds an action to this menu.
 void addSubMenu(String label, String icon, MenuView submenu)
          Adds a sub-menu in this menu.
 void close(boolean validate)
          Close this view.
 boolean equalsView(String type, Object[] parameters)
           
 boolean equalsView(ViewIdentity view)
          Tells if a view is the same as another one, ie it has the same type and parameters.
 DisplayContext getContext()
           
 String getDescription()
          Get the value of description.
 ViewFactory getFactory()
          Gets the factory.
 MethodItem getMessage()
          Get the value of message.
 Object[] getParameters()
          The parameters that were used to compile the view.
 View getParentView()
          Get the value of parentView.
 String getPosition()
          Get the value of position.
 View getRootView()
          Gets the ancestor view whose parent is null
 String getStyle()
          Gets the user-defined style for this view.
 String getType()
          Gets the view type.
 Border getViewBorder()
          Get the value of viewBorder.
 boolean isClosed()
          Tells if this view has been closed by the GUI or the user.
 boolean isDescendantOf(View ancestor)
          Tells wether this view has a given view in its ancestors
 void setContext(DisplayContext context)
          Sets the display context for this view.
 void setDescription(String v)
          Set the value of description.
 void setFactory(ViewFactory factory)
          Sets the factory for this view (WEB, SWING or other supported factory).
 void setFocus(FieldItem field, Object option)
          Focus a field of an object's view.
 void setLabel(String label)
          Sets the label (the identifier) of the view.
 void setMessage(MethodItem v)
          Set the value of message.
 void setParameters(Object[] parameters)
          Sets the parameters that were used to construct the view.
 void setParentView(View v)
          Set the value of parentView.
 void setPosition(String v)
          Set the value of position.
 void setSize(Length width, Length height)
          Sets the preferred size for this view.
 void setStyle(String style)
          Sets the view style.
 void setType(String type)
          Set the view type.
 void setViewBorder(Border v)
          Set the value of viewBorder.
 String toString()
           
 
Methods inherited from class javax.swing.JMenu
add, add, add, add, add, addMenuListener, addSeparator, applyComponentOrientation, configurePropertiesFromAction, createActionChangeListener, createActionComponent, createWinListener, doClick, fireMenuCanceled, fireMenuDeselected, fireMenuSelected, getAccessibleContext, getComponent, getDelay, getItem, getItemCount, getMenuComponent, getMenuComponentCount, getMenuComponents, getMenuListeners, getPopupMenu, getPopupMenuOrigin, getSubElements, getUIClassID, insert, insert, insert, insertSeparator, isMenuComponent, isPopupMenuVisible, isSelected, isTearOff, isTopLevelMenu, menuSelectionChanged, paramString, processKeyEvent, remove, remove, remove, removeAll, removeMenuListener, setAccelerator, setComponentOrientation, setDelay, setMenuLocation, setModel, setPopupMenuVisible, setSelected, updateUI
 
Methods inherited from class javax.swing.JMenuItem
addMenuDragMouseListener, addMenuKeyListener, createActionPropertyChangeListener, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getMenuDragMouseListeners, getMenuKeyListeners, 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, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, addContainerListener, addImpl, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.objectweb.jac.aspects.gui.MenuView
addSeparator
 
Methods inherited from interface org.objectweb.jac.aspects.gui.View
getLabel
 
Methods inherited from interface javax.swing.MenuElement
processKeyEvent, processMouseEvent
 

Constructor Detail

Menu

public Menu(ViewFactory factory,
            DisplayContext context)

Menu

public Menu()
Method Detail

getViewBorder

public Border getViewBorder()
Get the value of viewBorder.

Specified by:
getViewBorder in interface View
Returns:
value of viewBorder.

setViewBorder

public void setViewBorder(Border v)
Set the value of viewBorder.

Specified by:
setViewBorder in interface View
Parameters:
v - Value to assign to viewBorder.

setStyle

public void setStyle(String style)
Description copied from interface: View
Sets the view style. The style can be exploited in different maners depending on the GUI supports (e.g. with CSS for the WEB). Styles are user-defined.

Specified by:
setStyle in interface View

getStyle

public String getStyle()
Description copied from interface: View
Gets the user-defined style for this view.

Specified by:
getStyle in interface View
Returns:
the style, null if undefined

addSubMenu

public void addSubMenu(String label,
                       String icon,
                       MenuView submenu)
Description copied from interface: MenuView
Adds a sub-menu in this menu.

Specified by:
addSubMenu in interface MenuView
Parameters:
label - the sub-menu's label
icon - the sub-menu's icon
submenu - the submenu

addAction

public void addAction(String label,
                      String icon,
                      Callback callback)
Description copied from interface: MenuView
Adds an action to this menu.

Specified by:
addAction in interface MenuView
Parameters:
label - the sub-menu's label
icon - the sub-menu's icon
callback - the actual action

getPosition

public String getPosition()
Get the value of position.

Specified by:
getPosition in interface MenuView
Returns:
value of position.
See Also:
Menu

setPosition

public void setPosition(String v)
Set the value of position.

Specified by:
setPosition in interface MenuView
Parameters:
v - Value to assign to position.
See Also:
Menu

getDescription

public String getDescription()
Get the value of description.

Specified by:
getDescription in interface View
Returns:
value of description.

setDescription

public void setDescription(String v)
Set the value of description.

Specified by:
setDescription in interface View
Parameters:
v - Value to assign to description.
See Also:
View.setMessage(MethodItem)

getParentView

public View getParentView()
Get the value of parentView.

Specified by:
getParentView in interface View
Returns:
value of parentView.
See Also:
CompositeView

setParentView

public void setParentView(View v)
Set the value of parentView.

Specified by:
setParentView in interface View
Parameters:
v - Value to assign to parentView.
See Also:
CompositeView

getRootView

public View getRootView()
Description copied from interface: View
Gets the ancestor view whose parent is null

Specified by:
getRootView in interface View

isDescendantOf

public boolean isDescendantOf(View ancestor)
Description copied from interface: View
Tells wether this view has a given view in its ancestors

Specified by:
isDescendantOf in interface View
Parameters:
ancestor - the ancestor

getMessage

public MethodItem getMessage()
Get the value of message.

Specified by:
getMessage in interface View
Returns:
value of message.

setMessage

public void setMessage(MethodItem v)
Set the value of message.

Specified by:
setMessage in interface View
Parameters:
v - Value to assign to message.
See Also:
View.setDescription(String)

setContext

public void setContext(DisplayContext context)
Description copied from interface: View
Sets the display context for this view.

The display context contains the factory that is used for this view.

Specified by:
setContext in interface View

getContext

public DisplayContext getContext()
Specified by:
getContext in interface View
Returns:
the DisplayContext of the view

setFactory

public void setFactory(ViewFactory factory)
Description copied from interface: View
Sets the factory for this view (WEB, SWING or other supported factory).

Specified by:
setFactory in interface View

getFactory

public ViewFactory getFactory()
Description copied from interface: View
Gets the factory.

Specified by:
getFactory in interface View

setLabel

public void setLabel(String label)
Description copied from interface: View
Sets the label (the identifier) of the view.

Specified by:
setLabel in interface View
Overrides:
setLabel in class AbstractButton
Parameters:
label - a string that identifies the view

setSize

public void setSize(Length width,
                    Length height)
Description copied from interface: View
Sets the preferred size for this view.

Specified by:
setSize in interface View
Parameters:
width - the preferred width. If null, the preferred width is not changed.
height - the preferred height. If null, the preferred height is not changed.

setType

public void setType(String type)
Description copied from interface: ViewIdentity
Set the view type.

Specified by:
setType in interface ViewIdentity

getType

public String getType()
Description copied from interface: ViewIdentity
Gets the view type.

Specified by:
getType in interface ViewIdentity
Returns:
view type string as declared in web.acc or swing.acc depending on the GUI target

equalsView

public boolean equalsView(ViewIdentity view)
Description copied from interface: ViewIdentity
Tells if a view is the same as another one, ie it has the same type and parameters.

Specified by:
equalsView in interface ViewIdentity

equalsView

public boolean equalsView(String type,
                          Object[] parameters)
Specified by:
equalsView in interface ViewIdentity

setParameters

public void setParameters(Object[] parameters)
Description copied from interface: ViewIdentity
Sets the parameters that were used to construct the view.

Specified by:
setParameters in interface ViewIdentity

getParameters

public Object[] getParameters()
Description copied from interface: ViewIdentity
The parameters that were used to compile the view.

Specified by:
getParameters in interface ViewIdentity

close

public void close(boolean validate)
Description copied from interface: View
Close this view. This should be upcalled when the view is closed in order to free resources or close other dependant views.

Specified by:
close in interface View
Parameters:
validate - wether to validate any value contained in editors.

isClosed

public boolean isClosed()
Description copied from interface: View
Tells if this view has been closed by the GUI or the user.

Specified by:
isClosed in interface View

setFocus

public void setFocus(FieldItem field,
                     Object option)
Description copied from interface: View
Focus a field of an object's view.

Specified by:
setFocus in interface View
Parameters:
field - the field to focus
option - an extra option

actionPerformed

public void actionPerformed(ActionEvent event)
Specified by:
actionPerformed in interface ActionListener

toString

public String toString()
Overrides:
toString in class Component