com.vlsolutions.swing.docking
Class DockViewTitleBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.vlsolutions.swing.docking.DockViewTitleBar
All Implemented Interfaces:
DockableDragSource, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class DockViewTitleBar
extends javax.swing.JPanel
implements DockableDragSource

A title bar, associated to a DockView (container of a single user component).

Here is an example of a title bar : .

DockViewTitleBar is able to display the following properties of a DockKey :

This title bar supports buttons used for docking features :

function Version 1.1Version 2.0
maximize
restore
hide
dock
close
float (detach)n/a
attachn/a

The buttons managed have no effect on the state of the dockable : they just fire property change events, and it is the responsibility of the DockableContainer to listen to those events and to relay the operation to the docking desktop.

Note : the UI Delegate of the DockViewTitleBar is the DockViewTitleBarUI

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String PROPERTY_AUTOHIDE
          Property name designating the autohide button selection
static java.lang.String PROPERTY_CLOSED
          Property name designating the close button selection
static java.lang.String PROPERTY_DRAGGED
          Property name designating a drag gesture beginning
static java.lang.String PROPERTY_FLOAT
          Property name designating the float button selection
static java.lang.String PROPERTY_MAXIMIZED
          Property name designating the maximized button selection
 
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
DockViewTitleBar()
          Constructs an empty title bar (no dockable yet associated).
DockViewTitleBar(Dockable dockable)
          Constructs a title bar for the specified dockable.
 
Method Summary
 void closePopUp()
          This method is invoked to hide the pop-up that could still be visible (To avoid a visible pop-up for an invisible component)
 void endDragComponent(boolean dropped)
          notifies the source when the drag operation has ended (by a drop or cancelled)
 javax.swing.JButton getCloseButton()
           
 DockingDesktop getDesktop()
          Returns the desktop associated to this title bar, if one has been registered with #installDocking(DockingDesktop), or null.
 Dockable getDockable()
          Returns the Dockable component this source is for
 java.awt.Container getDockableContainer()
          Returns the container of the dockable's component
 javax.swing.JButton getFloatButton()
          returns the button used for floating (detach) the view.
 javax.swing.JButton getHideOrDockButton()
          returns the button used for hiding or docking the view.
 javax.swing.JButton getMaximizeOrRestoreButton()
          returns the button used for maximizing or restoring the view.
 javax.swing.JLabel getTitleLabel()
          Returns the label used to display the dockkey name.
 java.lang.String getUIClassID()
          
protected  void initAutoHidePopUp(javax.swing.JPopupMenu popup)
           
protected  void initDockedPopUp(javax.swing.JPopupMenu popup)
           
protected  void initFloatingPopUp(javax.swing.JPopupMenu popup)
          Init the popup displayed as the title bar contextual menu
protected  void initMaximizedPopUp(javax.swing.JPopupMenu popup)
          Init the popup displayed as the title bar contextual menu
 void installDocking(DockingDesktop desktop)
           
 boolean isActive()
          Returns true if the dockable is the currently active one.
protected  void layoutTitleBar()
          called to build the title bar
 void removeNotify()
          Overriden as a means to unregister internal listeners, do not call directly
 void setActive(boolean active)
          Updates the active property.
 void setDockable(Dockable dockable)
          Changes the dockable this title bar is for
 boolean startDragComponent(java.awt.Point p)
          Notifies this source that a drag operation has begun.
 java.lang.String toString()
          Returns a readeable String representing this title bar
 void uninstallDocking(DockingDesktop desktop)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, paramString, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, 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, 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, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_AUTOHIDE

public static final java.lang.String PROPERTY_AUTOHIDE
Property name designating the autohide button selection

See Also:
Constant Field Values

PROPERTY_CLOSED

public static final java.lang.String PROPERTY_CLOSED
Property name designating the close button selection

See Also:
Constant Field Values

PROPERTY_DRAGGED

public static final java.lang.String PROPERTY_DRAGGED
Property name designating a drag gesture beginning

See Also:
Constant Field Values

PROPERTY_MAXIMIZED

public static final java.lang.String PROPERTY_MAXIMIZED
Property name designating the maximized button selection

See Also:
Constant Field Values

PROPERTY_FLOAT

public static final java.lang.String PROPERTY_FLOAT
Property name designating the float button selection

See Also:
Constant Field Values
Constructor Detail

DockViewTitleBar

public DockViewTitleBar()
Constructs an empty title bar (no dockable yet associated).


DockViewTitleBar

public DockViewTitleBar(Dockable dockable)
Constructs a title bar for the specified dockable.

Warning : a DockViewTitleBar can be used with multiple dockables (this is the case for example in autohide borders, where a single titlebar is shared by all hidden dockables (shown only when one is expanding).

Method Detail

getDesktop

public DockingDesktop getDesktop()
Returns the desktop associated to this title bar, if one has been registered with #installDocking(DockingDesktop), or null.


removeNotify

public void removeNotify()
Overriden as a means to unregister internal listeners, do not call directly

Overrides:
removeNotify in class javax.swing.JComponent

layoutTitleBar

protected void layoutTitleBar()
called to build the title bar


getTitleLabel

public javax.swing.JLabel getTitleLabel()
Returns the label used to display the dockkey name.

Shouldn't be used to update the title : the best way is to update the DockKey (property listener ensure the labels and buttons stay in sync).

Since:
2.0

getCloseButton

public javax.swing.JButton getCloseButton()

getHideOrDockButton

public javax.swing.JButton getHideOrDockButton()
returns the button used for hiding or docking the view.

As hiding and docking are mutually exclusive, the same button is used for both purposes


getMaximizeOrRestoreButton

public javax.swing.JButton getMaximizeOrRestoreButton()
returns the button used for maximizing or restoring the view.

As those operations are mutually exclusive, the same button is used for both purposes


getFloatButton

public javax.swing.JButton getFloatButton()
returns the button used for floating (detach) the view.


closePopUp

public void closePopUp()
This method is invoked to hide the pop-up that could still be visible (To avoid a visible pop-up for an invisible component)


getUIClassID

public java.lang.String getUIClassID()

Overrides:
getUIClassID in class javax.swing.JPanel
Since:
2.0

isActive

public boolean isActive()
Returns true if the dockable is the currently active one.

There is at most one active dockable for a dekstop, and it there is one, it is the one which contains the keybord focused component.


setActive

public void setActive(boolean active)
Updates the active property. A title bar is active when the dockable it is for is ancestor of the keybord focused component.


setDockable

public void setDockable(Dockable dockable)
Changes the dockable this title bar is for


getDockable

public Dockable getDockable()
Returns the Dockable component this source is for

Specified by:
getDockable in interface DockableDragSource

startDragComponent

public boolean startDragComponent(java.awt.Point p)
Notifies this source that a drag operation has begun.

The source may reject the drag according to internal conditions (in that case this method shall return false) or to wrong mouse position .

Specified by:
startDragComponent in interface DockableDragSource
Returns:
true if drag operation is accepted (i.e the zone pointed by p refers to a draggable component), false otherwise.

toString

public java.lang.String toString()
Returns a readeable String representing this title bar

Overrides:
toString in class java.awt.Component

initMaximizedPopUp

protected void initMaximizedPopUp(javax.swing.JPopupMenu popup)
Init the popup displayed as the title bar contextual menu


initAutoHidePopUp

protected void initAutoHidePopUp(javax.swing.JPopupMenu popup)

initDockedPopUp

protected void initDockedPopUp(javax.swing.JPopupMenu popup)

initFloatingPopUp

protected void initFloatingPopUp(javax.swing.JPopupMenu popup)
Init the popup displayed as the title bar contextual menu


getDockableContainer

public java.awt.Container getDockableContainer()
Returns the container of the dockable's component

Specified by:
getDockableContainer in interface DockableDragSource

installDocking

public void installDocking(DockingDesktop desktop)

uninstallDocking

public void uninstallDocking(DockingDesktop desktop)

endDragComponent

public void endDragComponent(boolean dropped)
notifies the source when the drag operation has ended (by a drop or cancelled)

Specified by:
endDragComponent in interface DockableDragSource
Since:
2.1.3


© Copyright 2004-2007 VLSolutions. All Rights Reserved.
www.vlsolutions.com : Java Components - Smart Client Applications