org.dishevelled.identify
Class IdToolBar

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 org.dishevelled.identify.IdToolBar
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public final class IdToolBar
extends JToolBar

An extension of JToolBar that accepts identifiable actions and provides actions for changing display properties and icon sizes.

Version:
$Revision$ $Date$
Author:
Michael Heuer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JToolBar
JToolBar.AccessibleJToolBar, JToolBar.Separator
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static IconSize DEFAULT_ICON_SIZE
          Default icon size, IconSize.DEFAULT_16X16.
static IconTextDirection DEFAULT_ICON_TEXT_DIRECTION
          Default icon text direction, IconTextDirection.LEFT_TO_RIGHT.
 
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
IdToolBar()
          Create a new tool bar.
IdToolBar(int orientation)
          Create a new tool bar with the specified orientation.
IdToolBar(String name)
          Create a new tool bar with the specified name.
IdToolBar(String name, int orientation)
          Create a new tool bar with the specified name and orientation.
 
Method Summary
 IdButton add(IdentifiableAction identifiableAction)
          Add and return a new identifiable button to this tool bar which dispatches the specified identifiable action.
 ContextMenuButton add(JPopupMenu contextMenu)
          Add and return a new context menu button to this tool bar which raises the specified context menu.
 Action createIconSizeAction(IconSize iconSize)
          Create and return a new icon size action for this tool bar for the specified icon size.
 JCheckBoxMenuItem createIconSizeMenuItem(IconSize iconSize)
          Create and return a new icon size menu item for this tool bar for the specified icon size.
 void displayIcons()
          Display icons only for the buttons in this tool bar.
 void displayIconsAndText()
          Display icons and text for the buttons in this tool bar.
 void displayText()
          Display text only for the buttons in this tool bar.
 List getDefaultIconSizeActions()
          Return an unmodifiable list of the default icon size actions.
 List getDefaultIconSizeMenuItems()
          Return an unmodifiable list of check box menu items for the default icon size actions.
 List getDisplayActions()
          Return an unmodifiable list of display actions.
 List getDisplayMenuItems()
          Return an unmodifiable list of check box menu items for the display actions.
 IconSize getIconSize()
          Return the icon size for all identifiable buttons in this tool bar.
 IconTextDirection getIconTextDirection()
          Return the icon text direction for all identifiable buttons in this tool bar.
 IdButton remove(IdentifiableAction identifiableAction)
          Remove the identifiable button for the specified identifiable action from this tool bar, if such exists.
 void setIconSize(IconSize iconSize)
          Set the icon size for all identifiable buttons in this tool bar to iconSize.
 
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, getBaseline, getBaselineResizeBehavior, 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, isPaintingForPrint, 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

DEFAULT_ICON_SIZE

public static final IconSize DEFAULT_ICON_SIZE
Default icon size, IconSize.DEFAULT_16X16.


DEFAULT_ICON_TEXT_DIRECTION

public static final IconTextDirection DEFAULT_ICON_TEXT_DIRECTION
Default icon text direction, IconTextDirection.LEFT_TO_RIGHT.

Constructor Detail

IdToolBar

public IdToolBar()
Create a new tool bar.


IdToolBar

public IdToolBar(int orientation)
Create a new tool bar with the specified orientation.

Parameters:
orientation - orientation, must be either HORIZONTAL or VERTICAL

IdToolBar

public IdToolBar(String name)
Create a new tool bar with the specified name.

Parameters:
name - name of this tool bar

IdToolBar

public IdToolBar(String name,
                 int orientation)
Create a new tool bar with the specified name and orientation.

Parameters:
name - name of this tool bar
orientation - orientation, must be either HORIZONTAL or VERTICAL
Method Detail

add

public ContextMenuButton add(JPopupMenu contextMenu)
Add and return a new context menu button to this tool bar which raises the specified context menu. The context menu button will not be null.

Parameters:
contextMenu - context menu to add to this tool bar, must not be null
Returns:
a new context menu button which raises the specified context menu

add

public IdButton add(IdentifiableAction identifiableAction)
Add and return a new identifiable button to this tool bar which dispatches the specified identifiable action. The identifiable button will not be null.

Parameters:
identifiableAction - identifiable action to add to this tool bar, must not be null
Returns:
a new identifiable button which dispatches the specified identifiable action

remove

public IdButton remove(IdentifiableAction identifiableAction)
Remove the identifiable button for the specified identifiable action from this tool bar, if such exists.

Parameters:
identifiableAction - identifiable action to remove from this tool bar
Returns:
the identifiable button removed from this tool bar, or null if no such button exists

displayIcons

public void displayIcons()
Display icons only for the buttons in this tool bar.


displayText

public void displayText()
Display text only for the buttons in this tool bar.


displayIconsAndText

public void displayIconsAndText()
Display icons and text for the buttons in this tool bar.


getIconSize

public IconSize getIconSize()
Return the icon size for all identifiable buttons in this tool bar.

Returns:
the icon size for all identifiable buttons in this tool bar

setIconSize

public void setIconSize(IconSize iconSize)
Set the icon size for all identifiable buttons in this tool bar to iconSize.

Parameters:
iconSize - icon size for all identifiable buttons in this tool bar, must not be null

getIconTextDirection

public IconTextDirection getIconTextDirection()
Return the icon text direction for all identifiable buttons in this tool bar.

Returns:
the icon text direction for all identifiable buttons in this tool bar

getDisplayActions

public List getDisplayActions()
Return an unmodifiable list of display actions. The list will not be null.

Returns:
an unmodifiable list of display actions

getDisplayMenuItems

public List getDisplayMenuItems()
Return an unmodifiable list of check box menu items for the display actions. The list will not be null.

Returns:
an unmodifiable list of check box menu items for the display actions

createIconSizeAction

public Action createIconSizeAction(IconSize iconSize)
Create and return a new icon size action for this tool bar for the specified icon size. The new icon size action will not be null.

Parameters:
iconSize - icon size for the new icon size action, must not be null
Returns:
a new icon size action for the specified icon size

createIconSizeMenuItem

public JCheckBoxMenuItem createIconSizeMenuItem(IconSize iconSize)
Create and return a new icon size menu item for this tool bar for the specified icon size. The new icon size menu item will not be null.

Parameters:
iconSize - icon size for the new icon size menu item, must not be null
Returns:
a new icon size menu item for the specified icon size

getDefaultIconSizeActions

public List getDefaultIconSizeActions()
Return an unmodifiable list of the default icon size actions. The list will not be null.

Returns:
an unmodifiable list of the default icon size actions

getDefaultIconSizeMenuItems

public List getDefaultIconSizeMenuItems()
Return an unmodifiable list of check box menu items for the default icon size actions. The list will not be null.

Returns:
an unmodifiable list of check box menu items for the default icon size actions


Copyright (c) 2003-2012 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).