uic.widgets
Class UICToolBar

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JToolBar
                  extended byuic.widgets.UICToolBar
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable, 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 inherited from class javax.swing.JToolBar
JToolBar.AccessibleJToolBar, JToolBar.Separator
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes 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
           
 
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.
 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 restoreToolBar()
          Called when closing a 'floating' toolbar to open it again in its last known location.
 void setLayout(LayoutManager mgr)
          Overloaded method; see Component
 void setOrientation(int orientation)
          Overloaded method; see JToolBar
 void setPreferredSize(boolean horizontal, int offset)
           
 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.
 
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, 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, 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, processKeyEvent, 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, setEnabled, 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, addContainerListener, applyComponentOrientation, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, imageUpdate, 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, 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

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


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)
Overloaded method; see JToolBar


add

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


add

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


add

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


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)

getPreferredSize

public Dimension getPreferredSize()

setPreferredSize

public void setPreferredSize(boolean horizontal,
                             int offset)


Copyright © 2002,2003 Thomas Zander Available under the Free Apache licence