com.vlsolutions.swing.docking

Class DockViewTitleBar

Implemented Interfaces:
DockableDragSource

public class DockViewTitleBar
extends JPanel
implements DockableDragSource

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

Here is an example of a title bar :

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

DockViewTitleBarUI

Field Summary

static String
PROPERTY_AUTOHIDE
Property name designating the autohide button selection
static String
PROPERTY_CLOSED
Property name designating the close button selection
static String
PROPERTY_DRAGGED
Property name designating a drag gesture beginning
static String
PROPERTY_FLOAT
Property name designating the float button selection
static String
PROPERTY_MAXIMIZED
Property name designating the maximized button selection

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)
JButton
getCloseButton()
DockingDesktop
getDesktop()
Returns the desktop associated to this title bar, if one has been registered with #installDocking(DockingDesktop), or null.
Dockable
getDockable()
Container
getDockableContainer()
Returns the container of the dockable's component
JButton
getFloatButton()
returns the button used for floating (detach) the view.
JButton
getHideOrDockButton()
returns the button used for hiding or docking the view.
JButton
getMaximizeOrRestoreButton()
returns the button used for maximizing or restoring the view.
JLabel
getTitleLabel()
Returns the label used to display the dockkey name.
String
getUIClassID()
protected void
initAutoHidePopUp(JPopupMenu popup)
protected void
initDockedPopUp(JPopupMenu popup)
protected void
initFloatingPopUp(JPopupMenu popup)
Init the popup displayed as the title bar contextual menu
protected void
initMaximizedPopUp(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(Point p)
String
toString()
Returns a readeable String representing this title bar
void
uninstallDocking(DockingDesktop desktop)

Field Details

PROPERTY_AUTOHIDE

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

PROPERTY_CLOSED

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

PROPERTY_DRAGGED

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

PROPERTY_FLOAT

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

PROPERTY_MAXIMIZED

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

Constructor Details

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 Details

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)

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

getCloseButton

public JButton getCloseButton()

getDesktop

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

getDockable

public Dockable getDockable()
Specified by:
getDockable in interface DockableDragSource

getDockableContainer

public Container getDockableContainer()
Returns the container of the dockable's component
Specified by:
getDockableContainer in interface DockableDragSource

getFloatButton

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

getHideOrDockButton

public 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 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


getTitleLabel

public 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

getUIClassID

public String getUIClassID()
Since:
2.0

initAutoHidePopUp

protected void initAutoHidePopUp(JPopupMenu popup)

initDockedPopUp

protected void initDockedPopUp(JPopupMenu popup)

initFloatingPopUp

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

initMaximizedPopUp

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

installDocking

public void installDocking(DockingDesktop desktop)

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.


layoutTitleBar

protected void layoutTitleBar()
called to build the title bar

removeNotify

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

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

startDragComponent

public boolean startDragComponent(Point p)
Specified by:
startDragComponent in interface DockableDragSource

toString

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

uninstallDocking

public void uninstallDocking(DockingDesktop desktop)

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