uic.widgets
Class UICToolBar

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 uic.widgets.UICToolBar
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public class UICToolBar
extends JToolBar

Replacement ToolBar that has many usability features and works closely with the UICToolBar. This class is a container for buttons and other widgets which are shown in so called toolbar containers. These are mostly attached to the edgets of a top-level window.

See Also:
Serialized Form

Nested Class Summary
static class UICToolBar.ArrowsIcon
          The icon on the more-items button.
protected static class UICToolBar.ScaleHandle
           
static class UICToolBar.ToolBarLocation
          Data container that displays the corrent location of a UICToolBar.
 
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.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int FLAT
           
static int FLOATING
           
static int HIDDEN
           
protected  int location
           
protected  int oldLocation
           
static int TEXT_BELOW
           
static int TEXT_NEXT_TO
           
static int TEXT_NONE
           
 
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
UICToolBar()
          Create a toolbar with location == TOP and no name.
UICToolBar(int location)
          Create a toolbar without a name.
UICToolBar(int location, String name)
          Create a new UICToolbar.
UICToolBar(int location, String name, Component component)
           
UICToolBar(String name)
          Create a toolbar with location is TOP
 
Method Summary
 Component add(Component child)
          Overloaded method; see Component
 Component add(Component child, int index)
          Overloaded method; see Component
 void add(Component child, Object contraints)
          Overloaded method; see Component
protected  void doFlat(boolean on)
           
 UICToolBar.ToolBarLocation getCurrentLocation()
          Get curent state of toolBar, probably only usefull for persistency purposes.
 int getIconSize()
           
 Dimension getPreferredSize()
           
 WindowRepresenter getWindowRepresenter()
           
 void hideToolBar()
          Hide the toolbar.
 boolean isLoneContainer()
           
 void moreButtonPressedSlot()
          Called when the 'more' button has been pressed.
 void openContextMenuSlot(int x, int y)
          Method shows the popup menu for this toolbar.
 void openToolBarSlot()
          Called when clicking on a 'flat' toolbar to open it again in its last known location.
 void remove(Component c)
           
 void removeAll()
           
 void restoreToolBar()
          Called when closing a 'floating' toolbar to open it again in its last known location.
 void setIconSize(int pixelSize)
           
 void setLayout(LayoutManager mgr)
          Overloaded method; see Component
 void setLocation(int loc, boolean hidden)
          Set the orientation of the toolbar, changing its attachment directly.
 void setOrientation(int orientation)
          Set the orientation of the toolbar, changing its attachment directly.
 void setShowIcons(boolean on)
           
 void setShowText(int textPosition)
           
 void setToolBarContainer(WindowRepresenter toolbarContainer)
          set the WindowContainer that knows which set of ToolbarContainers and which Window this toolbar belongs to.
 void show(int location)
          Open/move toolbar to location.
 boolean showIcons()
           
 int showText()
           
 
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, setMargin, 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, 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, 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, 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

FLAT

public static final int FLAT
See Also:
Constant Field Values

FLOATING

public static final int FLOATING
See Also:
Constant Field Values

HIDDEN

public static final int HIDDEN
See Also:
Constant Field Values

TEXT_NONE

public static final int TEXT_NONE
See Also:
Constant Field Values

TEXT_BELOW

public static final int TEXT_BELOW
See Also:
Constant Field Values

TEXT_NEXT_TO

public static final int TEXT_NEXT_TO
See Also:
Constant Field Values

location

protected int location

oldLocation

protected int oldLocation
Constructor Detail

UICToolBar

public UICToolBar()
Create a toolbar with location == TOP and no name.


UICToolBar

public UICToolBar(int location)
Create a toolbar without a name.


UICToolBar

public UICToolBar(String name)
Create a toolbar with location is TOP


UICToolBar

public UICToolBar(int location,
                  String name)
Create a new UICToolbar. Please check the placeToolBarOnWindow factory method on ToolBarContainer first!

Parameters:
location - the location where the toolbar should appear on the target Window. One of TOP/BOTTOM/LEFT/RIGHT/FLAT/FLOATING
name - the name of the toolbar; is used for tooltips and titles.
See Also:
for an easier alternative.

UICToolBar

public UICToolBar(int location,
                  String name,
                  Component component)
Method Detail

isLoneContainer

public boolean isLoneContainer()

setLayout

public void setLayout(LayoutManager mgr)
Overloaded method; see Component

Overrides:
setLayout in class JToolBar

setToolBarContainer

public void setToolBarContainer(WindowRepresenter toolbarContainer)
set the WindowContainer that knows which set of ToolbarContainers and which Window this toolbar belongs to. Automatically called from the ToolBarContainer


getWindowRepresenter

public WindowRepresenter getWindowRepresenter()
Returns:
the WindowContainer that knows which set of ToolbarContainers and which Window this toolbar belongs to.

getCurrentLocation

public UICToolBar.ToolBarLocation getCurrentLocation()
Get curent state of toolBar, probably only usefull for persistency purposes.


openToolBarSlot

public void openToolBarSlot()
Called when clicking on a 'flat' toolbar to open it again in its last known location.


restoreToolBar

public void restoreToolBar()
Called when closing a 'floating' toolbar to open it again in its last known location.


openContextMenuSlot

public void openContextMenuSlot(int x,
                                int y)
Method shows the popup menu for this toolbar.


setOrientation

public void setOrientation(int orientation)
Set the orientation of the toolbar, changing its attachment directly.

Overrides:
setOrientation in class JToolBar
Parameters:
orientation - Choose one of SwingConstants.LEFT, RIGHT, TOP, BOTTOM or UICToolBar.HIDDEN, UICToolBar.FLOATING.

setLocation

public void setLocation(int loc,
                        boolean hidden)
Set the orientation of the toolbar, changing its attachment directly.

Parameters:
loc - Choose one of SwingConstants.LEFT, RIGHT, TOP, BOTTOM or UICToolBar.HIDDEN, UICToolBar.FLOATING.
hidden - if true will register the orientation to use when the user selects (un-hides) the toolbar; making it hidden now.

add

public Component add(Component child)
Overloaded method; see Component

Overrides:
add in class Container

add

public Component add(Component child,
                     int index)
Overloaded method; see Component

Overrides:
add in class Container

add

public void add(Component child,
                Object contraints)
Overloaded method; see Component

Overrides:
add in class Container

removeAll

public void removeAll()
Overrides:
removeAll in class Container

remove

public void remove(Component c)
Overrides:
remove in class Container

show

public void show(int location)
Open/move toolbar to location.

Parameters:
location - LEFT/RIGHT/TOP/BOTTOM/FLAT are static on this class.

hideToolBar

public void hideToolBar()
Hide the toolbar. Notice that afterwards this toolbar does not have a parent anymore, use show(int location) to move it to another toolbar again.


moreButtonPressedSlot

public void moreButtonPressedSlot()
Called when the 'more' button has been pressed.


doFlat

protected void doFlat(boolean on)

getIconSize

public int getIconSize()

setIconSize

public void setIconSize(int pixelSize)

showIcons

public boolean showIcons()

setShowIcons

public void setShowIcons(boolean on)

showText

public int showText()

setShowText

public void setShowText(int textPosition)

getPreferredSize

public Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent


Copyright © 2002-2004 Thomas Zander Available under the Free Apache licence