com.vlsolutions.swing.toolbars

Class VLToolBar

public class VLToolBar extends JPanel

A JToolbar suitable for drag and drop purposes.

To use the toolbar feature, you must follow this pattern :


The VLToolBar contains buttons and other components, and is included in a ToolBarPanel of a ToolBarContainer .

Loading and saving toolbar configurations is done with the {@link ToolBarIO} utility class.

Toolbars can now be collapsed (to gain space on screen). this property is disabled by default to keep compatibility with previous releases. For a better usage of collapsing it is better to set a tooltip text on the toolbar (it will be propagated to the gripper, which will be the only one component visible when collapsed).

UNKNOWN: 2006/02/20 Lilian Chamontin : added support for collapsible toolbars 2006/03/16 Lilian Chamontin : added animation effect when collapsing toolbars

Constructor Summary
VLToolBar()
Constructs a toolbar with a null name (this toolbar will not be able to write its structure in a XML encoder, unless you call setName(String) with a non null name before saving).
VLToolBar(String name)
Constructs a toolbar with the given name.
Method Summary
Componentadd(Component comp)
Overriden to track AbstractButton added
Componentadd(AbstractButton button)
Adds a new button to this toolbar
Componentadd(JButton button)
Adds a new button to this toolbar
voidaddSeparator()
Adds a new separator to this toolbar
voidconfigureButton(AbstractButton button)
This method is invoked upon adding a button to the toolbar.
BordergetDraggedBorder()
Returns the border used during drag and drop or the toolbar
voidinstallButtonUI(AbstractButton button)
Install custom UI for this button : a light rollover effet and a custom rounded/shaded border.
voidinstallMouseHandler(AbstractButton button)
Used internally to add a mouse listener to the button.
booleanisCollapsed()
Returns true if this toolbar is currently collapsed
booleanisCollapsible()
booleanisRolloverBorderPainter()
Returns the state of the rolloverBorderPainted property
booleanisRolloverContentAreaFilled()
Returns the value of the rolloverContentAreaFilled property
booleanisUseCustomUI()
Return the value of the useCustomUI property
voidsetCollapsed(boolean collapsed)
Hides the toolbar (just showing the gripper)
voidsetCollapsible(boolean collapsible)
voidsetDraggedBorder(Border border)
Changes the border used during drag and drop of the toolbar.
voidsetOrientation(int orientation)
Updates the orientation of this toolbar.
voidsetRolloverBorderPainted(boolean painted)
Updates the rolloverBorderPainted property.
voidsetRolloverContentAreaFilled(boolean filled)
Updates the rolloverContentAreaFilled property.
voidsetToolTipText(String tooltip)
Updates the tooltip of the toolbar, and propagates it to the toolbar gripper.
voidsetUseCustomUI(boolean useCustomUI)
Updates the useCustomUI property.
StringtoString()

Constructor Detail

VLToolBar

public VLToolBar()
Constructs a toolbar with a null name (this toolbar will not be able to write its structure in a XML encoder, unless you call setName(String) with a non null name before saving). ).

VLToolBar

public VLToolBar(String name)
Constructs a toolbar with the given name.

The name is used when reading/writing XML configuration. It must not be null if you use this feature.

Method Detail

add

public Component add(Component comp)
Overriden to track AbstractButton added

add

public Component add(AbstractButton button)
Adds a new button to this toolbar

add

public Component add(JButton button)
Adds a new button to this toolbar

addSeparator

public void addSeparator()
Adds a new separator to this toolbar

configureButton

public void configureButton(AbstractButton button)
This method is invoked upon adding a button to the toolbar. It can be overriden to provide another look or feel.

Default settings are :

getDraggedBorder

public Border getDraggedBorder()
Returns the border used during drag and drop or the toolbar

installButtonUI

public void installButtonUI(AbstractButton button)
Install custom UI for this button : a light rollover effet and a custom rounded/shaded border.

This method can be overriden to replace the provided "look and feel" which uses the follwing configuration :

installMouseHandler

public void installMouseHandler(AbstractButton button)
Used internally to add a mouse listener to the button.

Can be overriden to implement custom event handling.

isCollapsed

public boolean isCollapsed()
Returns true if this toolbar is currently collapsed

isCollapsible

public boolean isCollapsible()

isRolloverBorderPainter

public boolean isRolloverBorderPainter()
Returns the state of the rolloverBorderPainted property

isRolloverContentAreaFilled

public boolean isRolloverContentAreaFilled()
Returns the value of the rolloverContentAreaFilled property

isUseCustomUI

public boolean isUseCustomUI()
Return the value of the useCustomUI property

setCollapsed

public void setCollapsed(boolean collapsed)
Hides the toolbar (just showing the gripper)

setCollapsible

public void setCollapsible(boolean collapsible)

setDraggedBorder

public void setDraggedBorder(Border border)
Changes the border used during drag and drop of the toolbar.

For a better user experience, please note to install an empty border of the same Insets than this one (otherwise, there will be a size change of the toolbar at the beginning of the drag and after the drop).

setOrientation

public void setOrientation(int orientation)
Updates the orientation of this toolbar.

This method is called directly by the framework on toolbar installation or during drag and drop.

setRolloverBorderPainted

public void setRolloverBorderPainted(boolean painted)
Updates the rolloverBorderPainted property.

If true, when one of the toolbar buttons is rolled-over, its border will be shown.

DefaultValue is true

setRolloverContentAreaFilled

public void setRolloverContentAreaFilled(boolean filled)
Updates the rolloverContentAreaFilled property.

If true, when one of the toolbar buttons is rolled-over, its content will be filled.

Default value is false to accomodate with VLButtonUI which paints itself the button interiors.

setToolTipText

public void setToolTipText(String tooltip)
Updates the tooltip of the toolbar, and propagates it to the toolbar gripper.

setUseCustomUI

public void setUseCustomUI(boolean useCustomUI)
Updates the useCustomUI property.

Default value is true.

When set to true the installButtonUI() method will be called when a button is added to this toolbar.

toString

public String toString()
© Copyright 2004-2005 VLSolutions. All Rights Reserved.
www.vlsolutions.com : Java Components - Smart Client Applications