com.vlsolutions.swing.docking

Class DockableStoreButton

Implemented Interfaces:
DockableDragSource, DockDropReceiver

public class DockableStoreButton
extends JButton
implements DockDropReceiver, DockableDragSource

A Button that can be used to store a dockable (for example to allow moving a dockable between two workspaces).

The button is able to display the Icon, text and toolip of a dockable key, and can be used as a drag source (to initiate a drop into a desktop).

Constructor Summary

DockableStoreButton()
DockableStoreButton(String emptyText)

Method Summary

void
endDragComponent(boolean dropped)
notifies the source when the drag operation has ended (by a drop or cancelled)
Dockable
getDockable()
Return the dockable currently stored (may be null)
Container
getDockableContainer()
returns the DockableContainer responsible for displaying the associated dockable
Icon
getEmptyIcon()
Returns the Icon used with this button when no dockable is selected
String
getEmptyText()
Returns the text used for this button when no dockable is stored
String
getEmptyTooltip()
Returns the text used as tooltip for this button when no dockable is stored
String
getFullText()
Returns the text used for this button when a dockable is stored
String
getFullTooltip()
Returns the text used for as tooltip this button when a dockable is stored
void
processDockableDrag(DockDragEvent event)
when a dockable is dragged above this button, the button stores it as its new target dockable.
void
processDockableDrop(DockDropEvent event)
Rejects the drop as this action isn't possible on this component
void
setDockable(Dockable dockable)
void
setEmptyIcon(Icon emptyIcon)
Updates the icon used for this button when no dockable is stored
void
setEmptyText(String emptyText)
updates the text used for this button when no dockable is stored
void
setEmptyTooltip(String emptyTooltip)
Updates the text used as tooltip for this button when no dockable is stored
void
setFullText(String fullText)
Returns the text used for this button when a dockable is stored
void
setFullTooltip(String fullTooltip)
Updates the text used as tooltip for this button when no dockable is stored.
boolean
startDragComponent(Point p)
Notifies this source that a drag operation has begun.
void
updateButtonText()
Override this method if you want to change the display (text and icon) of this button and the default settings don't suit your needs.

Constructor Details

DockableStoreButton

public DockableStoreButton()

DockableStoreButton

public DockableStoreButton(String emptyText)

Method Details

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

getDockable

public Dockable getDockable()
Return the dockable currently stored (may be null)
Specified by:
getDockable in interface DockableDragSource

getDockableContainer

public Container getDockableContainer()
returns the DockableContainer responsible for displaying the associated dockable
Specified by:
getDockableContainer in interface DockableDragSource

getEmptyIcon

public Icon getEmptyIcon()
Returns the Icon used with this button when no dockable is selected

getEmptyText

public String getEmptyText()
Returns the text used for this button when no dockable is stored

getEmptyTooltip

public String getEmptyTooltip()
Returns the text used as tooltip for this button when no dockable is stored

getFullText

public String getFullText()
Returns the text used for this button when a dockable is stored

getFullTooltip

public String getFullTooltip()
Returns the text used for as tooltip this button when a dockable is stored

processDockableDrag

public void processDockableDrag(DockDragEvent event)
when a dockable is dragged above this button, the button stores it as its new target dockable.
Specified by:
processDockableDrag in interface DockDropReceiver
See Also:
getDockable()

processDockableDrop

public void processDockableDrop(DockDropEvent event)
Rejects the drop as this action isn't possible on this component
Specified by:
processDockableDrop in interface DockDropReceiver

setDockable

public void setDockable(Dockable dockable)

setEmptyIcon

public void setEmptyIcon(Icon emptyIcon)
Updates the icon used for this button when no dockable is stored

setEmptyText

public void setEmptyText(String emptyText)
updates the text used for this button when no dockable is stored

setEmptyTooltip

public void setEmptyTooltip(String emptyTooltip)
Updates the text used as tooltip for this button when no dockable is stored

setFullText

public void setFullText(String fullText)
Returns the text used for this button when a dockable is stored

setFullTooltip

public void setFullTooltip(String fullTooltip)
Updates the text used as tooltip for this button when no dockable is stored. The special value '&1' will be replaced by the name of this dockable.

For example "&1 stored" could be replaced by "MyDockable stored"


startDragComponent

public boolean startDragComponent(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.

updateButtonText

public void updateButtonText()
Override this method if you want to change the display (text and icon) of this button and the default settings don't suit your needs.

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