com.javadocking.dockable
Interface Dockable

All Known Subinterfaces:
CompositeDockable
All Known Implementing Classes:
ActionDockable, ButtonDockable, DefaultCompositeDockable, DefaultDockable, StateActionDockable

public interface Dockable

A dockable is an object that can be moved around and docked in a Dock. It contains a graphical component as content. This content should be set once and never be changed.

Information on using dockables is in How to Use Dockables in The Sanaware Developer Guide. Information on adding, moving, and removing dockables is in How to Add, Move, and Remove Dockables.

The purpose of the docks and dockables is to organize and move the graphical content components of the application. Docks are in a fixed position. They can receive dockables. The dockables are moved with their content from dock to dock.

All the dockables in the application should have a different ID. Implementations of this class should overwrite Object.equals(java.lang.Object). Dockables are equal if their ID is equal.

Author:
Heidi Rakels.

Method Summary
 void addDockingListener(DockingListener listener)
          Adds a listener for docking events of this dockable.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a java.beans.PropertyChangeListener.
 void fireDockingChanged(DockableEvent dockableEvent)
          Notifies all listeners that have registered interest for notification on this event type.
 void fireDockingWillChange(DockableEvent dockableEvent)
          Notifies all listeners that have registered interest for notification on this event type.
 javax.swing.Action[][] getActions()
           Gets a matrix with the actions for the dockable.
 java.awt.Component getContent()
          Gets the content of the dockable.
 java.lang.String getDescription()
          Gets the description of the dockable.
 LeafDock getDock()
          Gets the dock in which the dockable is docked.
 int getDockingModes()
           Gets the modes how this dockable can be docked.
 javax.swing.Icon getIcon()
          Gets the icon of the dockable.
 java.lang.String getID()
          Gets the ID of the dockable.
 int getLastDockingMode()
          Gets the mode how the dockable is docked in its current dock or how it was docked the last time it was in a dock.
 int getPossibleStates()
          Gets the possible states of the dockable.
 int getState()
          Gets the state of the dockable.
 java.lang.String getTitle()
          Gets the title of the dockable.
 java.lang.Object getVisualizer()
          Gets the object that currently shows the content of the dockable.
 boolean isWithHeader()
          Returns whether the dockable will have a header when it is docked alone.
 void removeDockingListener(DockingListener listener)
          Removes a listener for docking events of this dockable.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a java.beans.PropertyChangeListener.
 void setDock(LeafDock dock)
          Sets the dock in which the dockable is docked.
 void setLastDockingMode(int dockingMode)
          Sets the mode how the dockable is docked in its current dock or how it was docked the last time it was in a dock.
 void setState(int state, java.lang.Object visualizer)
          Tries to set the new state of the dockable.
 

Method Detail

getID

java.lang.String getID()
Gets the ID of the dockable.
WARNING: All the dockables used in an application should have a different ID.

Returns:
The ID of the dockable.

setDock

void setDock(LeafDock dock)
Sets the dock in which the dockable is docked.

Parameters:
dock - The dock in which the dockable is docked. This can be null, if the dockable is not docked.

getDock

LeafDock getDock()
Gets the dock in which the dockable is docked.

Returns:
The dock in which the dockable is docked. This can be null, if the dockable is not docked.

getContent

java.awt.Component getContent()
Gets the content of the dockable. This is a graphical component. The dockable is a wrapper around this content component. The dockable is used to move this content from dock to dock.

Returns:
The content of the dockable.

getTitle

java.lang.String getTitle()
Gets the title of the dockable.

Returns:
The title of the dockable.

getDescription

java.lang.String getDescription()
Gets the description of the dockable.

Returns:
The description of the dockable.

getIcon

javax.swing.Icon getIcon()
Gets the icon of the dockable.

Returns:
The icon of the dockable.

getDockingModes

int getDockingModes()

Gets the modes how this dockable can be docked. The integer should be a combination of constants defined by DockingMode.

Combinations of the different modes are made by using the bitwise or-operator.

Returns:
The possible docking modes of the dockable. This integer should be combination of constants defined by DockingMode.

setLastDockingMode

void setLastDockingMode(int dockingMode)
Sets the mode how the dockable is docked in its current dock or how it was docked the last time it was in a dock.

Parameters:
dockingMode - The mode how the dockable is docked in its current dock or how it was docked the last time it was in a dock. This integer should be a constant defined by DockingMode.

getLastDockingMode

int getLastDockingMode()
Gets the mode how the dockable is docked in its current dock or how it was docked the last time it was in a dock.

Returns:
The mode how the dockable is docked in its current dock or how it was docked the last time it was in a dock. This integer should be a constant defined by DockingMode.

isWithHeader

boolean isWithHeader()
Returns whether the dockable will have a header when it is docked alone. With the header the dockable can be dragged. The header can contain also the title, the icon, etc.

Returns:
True if the dockable will have a header when it is docked alone, false otherwise.

getState

int getState()
Gets the state of the dockable.

Returns:
The current state of the dockable. This should be a constant defined by DockableState.

setState

void setState(int state,
              java.lang.Object visualizer)
Tries to set the new state of the dockable. No checking is done, if the state is allowed by getPossibleStates().

Parameters:
state - The new state of the dockable. This should be a constant defined by DockableState.
visualizer - The object that currently shows the content of the dockable. Can be null, i.e. when the state of the dockable is DockableState.CLOSED.

getPossibleStates

int getPossibleStates()
Gets the possible states of the dockable. This can be a combination of constants defined by DockableState. A combination is made by the bitwise or-operation on the integer constants.

Returns:
The possible states of the dockable.

getVisualizer

java.lang.Object getVisualizer()
Gets the object that currently shows the content of the dockable. Can be null, i.e. when the state of the dockable is DockableState.CLOSED.

Returns:
The object that currently shows the content of the dockable.

getActions

javax.swing.Action[][] getActions()

Gets a matrix with the actions for the dockable.

These actions can be displayed in a tool bar in the header of the dockable. They can also be displayed in a popup menu, that appears when right clicking on the header of a dockable.

The actions of the different rows are divided in the tool bar or in the popup menu.

In some headers i.e. in tabs, there is not enough space to display all the actions. In that case only the first row of actions is displayed.

Returns:
The actions that are associated with the dockable. Can be null.

addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a java.beans.PropertyChangeListener. The listener is registered for the dock property.

Parameters:
listener - The property change listener to be added.

removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a java.beans.PropertyChangeListener. This removes a listener.

Parameters:
listener - The property change listener to be removed

addDockingListener

void addDockingListener(DockingListener listener)
Adds a listener for docking events of this dockable.

Parameters:
listener - A docking listener that will be notified, when this dockable is added, moved, or removed.

removeDockingListener

void removeDockingListener(DockingListener listener)
Removes a listener for docking events of this dockable.

Parameters:
listener - A docking listener to remove.

fireDockingWillChange

void fireDockingWillChange(DockableEvent dockableEvent)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
dockableEvent - Gives more information about the origin dock, the destination dock, and the object whose docking state changed.

fireDockingChanged

void fireDockingChanged(DockableEvent dockableEvent)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
dockableEvent - Gives more information about the origin dock, the destination dock, and the object whose docking state changed.