se.entitymanager.presentation.swing
Class SwingMenuBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JMenuBar
                  extended by se.entitymanager.presentation.swing.SwingMenuBar
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.TreeSelectionListener, javax.swing.MenuElement

public class SwingMenuBar
extends javax.swing.JMenuBar
implements java.awt.event.FocusListener, javax.swing.event.TreeSelectionListener

Menu bar for presentation with Swing framework.

The class initializes a JMenuBar . FocusListener is implemented for recognizing the currently selected entity in one of the trees displayed. Shares Actions with SwingToolBarand SwingPopupMenu.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JMenuBar
javax.swing.JMenuBar.AccessibleJMenuBar
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  CopyAction copyAction
           
private  CopyToAction copyToAction
           
private  CutAction cutAction
           
private  CutToAction cutToAction
           
private  DeleteAction deleteAction
           
private  EntityInterface entity
          The entity to be edited.
private  LogicFacade logicFacade
          The logic facade to access entities.
private static java.lang.String MENUBAR_CLOSE_ICON_NAME
          Path to icon for application tool bar function 'close'.
private static java.lang.String MENUBAR_COPY_ICON_NAME
          Path to icon for application tool bar function 'copy'.
private static java.lang.String MENUBAR_COPYTO_ICON_NAME
          Path to icon for application tool bar function 'copy to'.
private static java.lang.String MENUBAR_CUT_ICON_NAME
          Path to icon for application tool bar function 'cut'.
private static java.lang.String MENUBAR_CUTTO_ICON_NAME
          Path to icon for application tool bar function 'cut to'.
private static java.lang.String MENUBAR_DELETE_ICON_NAME
          Path to icon for application tool bar function 'delete'.
private static java.lang.String MENUBAR_HELP_ICON_NAME
          Path to icon for application tool bar function 'help'.
private static java.lang.String MENUBAR_INFORMATION_ICON_NAME
          Path to icon for application tool bar function 'information'.
private static java.lang.String MENUBAR_OPEN_ICON_NAME
          Path to icon for application tool bar function 'open'.
private static java.lang.String MENUBAR_PASTE_ICON_NAME
          Path to icon for application tool bar function 'paste'.
private static java.lang.String MENUBAR_PROPERTIES_ICON_NAME
          Path to icon for application tool bar function 'properties'.
private static java.lang.String MENUBAR_RENAME_ICON_NAME
          Path to icon for application tool bar function 'rename'.
private  OpenAction openAction
          The Actions
private  PasteAction pasteAction
           
private  SwingPresentationFacade presentationFacade
          The presentation facade to which this object belongs,
private  RenameAction renameAction
           
private  ShowPropertiesAction showPropertiesAction
           
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
protected SwingMenuBar(SwingPresentationFacade presentationFacade)
          Constructs a menu bar for a presentationFacade.
 
Method Summary
private  void createGUI()
          Creates the GUI elements of the menu bar.
 void focusGained(java.awt.event.FocusEvent e)
          Enables file specific menu items if an entity in one of the trees of SwingDualTreePanel is selected
 void focusLost(java.awt.event.FocusEvent e)
           
 void valueChanged(javax.swing.event.TreeSelectionEvent e)
          Implementation of TreeSelectionListener.valueChanged(TreeSelectionEvent).
 
Methods inherited from class javax.swing.JMenuBar
add, addNotify, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getHelpMenu, getMargin, getMenu, getMenuCount, getSelectionModel, getSubElements, getUI, getUIClassID, isBorderPainted, isSelected, menuSelectionChanged, paintBorder, paramString, processKeyBinding, processKeyEvent, processMouseEvent, removeNotify, setBorderPainted, setHelpMenu, setMargin, setSelected, setSelectionModel, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

presentationFacade

private SwingPresentationFacade presentationFacade
The presentation facade to which this object belongs,


logicFacade

private LogicFacade logicFacade
The logic facade to access entities.


entity

private EntityInterface entity
The entity to be edited.


openAction

private OpenAction openAction
The Actions


showPropertiesAction

private ShowPropertiesAction showPropertiesAction

cutAction

private CutAction cutAction

copyAction

private CopyAction copyAction

pasteAction

private PasteAction pasteAction

cutToAction

private CutToAction cutToAction

copyToAction

private CopyToAction copyToAction

renameAction

private RenameAction renameAction

deleteAction

private DeleteAction deleteAction

MENUBAR_OPEN_ICON_NAME

private static final java.lang.String MENUBAR_OPEN_ICON_NAME
Path to icon for application tool bar function 'open'.

See Also:
Constant Field Values

MENUBAR_PROPERTIES_ICON_NAME

private static final java.lang.String MENUBAR_PROPERTIES_ICON_NAME
Path to icon for application tool bar function 'properties'.

See Also:
Constant Field Values

MENUBAR_CUT_ICON_NAME

private static final java.lang.String MENUBAR_CUT_ICON_NAME
Path to icon for application tool bar function 'cut'.

See Also:
Constant Field Values

MENUBAR_COPY_ICON_NAME

private static final java.lang.String MENUBAR_COPY_ICON_NAME
Path to icon for application tool bar function 'copy'.

See Also:
Constant Field Values

MENUBAR_PASTE_ICON_NAME

private static final java.lang.String MENUBAR_PASTE_ICON_NAME
Path to icon for application tool bar function 'paste'.

See Also:
Constant Field Values

MENUBAR_COPYTO_ICON_NAME

private static final java.lang.String MENUBAR_COPYTO_ICON_NAME
Path to icon for application tool bar function 'copy to'.

See Also:
Constant Field Values

MENUBAR_CUTTO_ICON_NAME

private static final java.lang.String MENUBAR_CUTTO_ICON_NAME
Path to icon for application tool bar function 'cut to'.

See Also:
Constant Field Values

MENUBAR_RENAME_ICON_NAME

private static final java.lang.String MENUBAR_RENAME_ICON_NAME
Path to icon for application tool bar function 'rename'.

See Also:
Constant Field Values

MENUBAR_DELETE_ICON_NAME

private static final java.lang.String MENUBAR_DELETE_ICON_NAME
Path to icon for application tool bar function 'delete'.

See Also:
Constant Field Values

MENUBAR_INFORMATION_ICON_NAME

private static final java.lang.String MENUBAR_INFORMATION_ICON_NAME
Path to icon for application tool bar function 'information'.

See Also:
Constant Field Values

MENUBAR_HELP_ICON_NAME

private static final java.lang.String MENUBAR_HELP_ICON_NAME
Path to icon for application tool bar function 'help'.

See Also:
Constant Field Values

MENUBAR_CLOSE_ICON_NAME

private static final java.lang.String MENUBAR_CLOSE_ICON_NAME
Path to icon for application tool bar function 'close'.

See Also:
Constant Field Values
Constructor Detail

SwingMenuBar

protected SwingMenuBar(SwingPresentationFacade presentationFacade)
Constructs a menu bar for a presentationFacade.

Parameters:
presentationFacade - the presentation facade to use
Method Detail

createGUI

private void createGUI()
Creates the GUI elements of the menu bar.

Initializes the menues, menu items and the actions.


focusGained

public void focusGained(java.awt.event.FocusEvent e)
Enables file specific menu items if an entity in one of the trees of SwingDualTreePanel is selected

Specified by:
focusGained in interface java.awt.event.FocusListener
See Also:
FocusListener.focusGained(java.awt.event.FocusEvent)

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener
See Also:
FocusListener.focusLost(java.awt.event.FocusEvent)

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent e)
Implementation of TreeSelectionListener.valueChanged(TreeSelectionEvent).

This method is called, when selection of a tree changes. It makes CutToAction and CopyToAction available when nodes in both trees are selected.

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener
Parameters:
tse - the selection event