se.entitymanager.presentation.swing
Class SwingToolBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JToolBar
                  extended by se.entitymanager.presentation.swing.SwingToolBar
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.SwingConstants

public class SwingToolBar
extends javax.swing.JToolBar
implements java.awt.event.FocusListener, javax.swing.event.TreeSelectionListener

Tool bar for presentation with Swing framework.

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

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JToolBar
javax.swing.JToolBar.AccessibleJToolBar, javax.swing.JToolBar.Separator
 
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  OpenAction openAction
          The Actions
private  PasteAction pasteAction
           
private  SwingPresentationFacade presentationFacade
          The presentation facade to which this object belongs,
private  RenameAction renameAction
           
private  ShowPropertiesAction showPropertiesAction
           
private static java.lang.String TOOLBAR_CLOSE_ICON_NAME
          Path to icon for application tool bar function 'close'.
private static java.lang.String TOOLBAR_COPY_ICON_NAME
          Path to icon for application tool bar function 'copy'.
private static java.lang.String TOOLBAR_COPYTO_ICON_NAME
          Path to icon for application tool bar function 'copy to'.
private static java.lang.String TOOLBAR_CUT_ICON_NAME
          Path to icon for application tool bar function 'cut'.
private static java.lang.String TOOLBAR_CUTTO_ICON_NAME
          Path to icon for application tool bar function 'cut to'.
private static java.lang.String TOOLBAR_DELETE_ICON_NAME
          Path to icon for application tool bar function 'delete'.
private static java.lang.String TOOLBAR_HELP_ICON_NAME
          Path to icon for application tool bar function 'help'.
private static java.lang.String TOOLBAR_OPEN_ICON_NAME
          Path to icon for application tool bar function 'open'.
private static java.lang.String TOOLBAR_PASTE_ICON_NAME
          Path to icon for application tool bar function 'paste'.
private static java.lang.String TOOLBAR_PROPERTIES_ICON_NAME
          Path to icon for application tool bar function 'properties'.
private static java.lang.String TOOLBAR_RENAME_ICON_NAME
          Path to icon for application tool bar function 'rename'.
 
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
protected SwingToolBar(SwingPresentationFacade presentationFacade)
          Constructs a tool bar for a presentationFacade.
 
Method Summary
private  void createGUI()
          Creates the GUI elements of the tool bar.
 void focusGained(java.awt.event.FocusEvent e)
          Enables file specific tool bar 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.JToolBar
add, addImpl, addSeparator, addSeparator, createActionChangeListener, createActionComponent, getAccessibleContext, getComponentAtIndex, getComponentIndex, getMargin, getOrientation, getUI, getUIClassID, isBorderPainted, isFloatable, isRollover, paintBorder, paramString, setBorderPainted, setFloatable, setLayout, setMargin, setOrientation, setRollover, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, 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, 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

TOOLBAR_OPEN_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_PROPERTIES_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_CUT_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_COPY_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_PASTE_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_COPYTO_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_CUTTO_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_RENAME_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_DELETE_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_HELP_ICON_NAME

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

See Also:
Constant Field Values

TOOLBAR_CLOSE_ICON_NAME

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

See Also:
Constant Field Values
Constructor Detail

SwingToolBar

protected SwingToolBar(SwingPresentationFacade presentationFacade)
Constructs a tool bar for a presentationFacade.

Parameters:
presentationFacade - the presentation facade to use
Method Detail

createGUI

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

Initializes the buttons and actions.


focusGained

public void focusGained(java.awt.event.FocusEvent e)
Enables file specific tool bar 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