bibliothek.extension.gui.dock.station.split
Class DockFrontendSizeManager

java.lang.Object
  extended by bibliothek.extension.gui.dock.station.split.DockFrontendSizeManager
All Implemented Interfaces:
SizeManager

public class DockFrontendSizeManager
extends Object
implements SizeManager

Observes a DockFrontend in order to find out which Dockables are available, and when a drag & drop operation starts.
Clients should call setFrontend(DockFrontend) in order to connect this manager with a DockFrontend. They should call the method setFrontend(DockFrontend) again with a null argument to disconnect this manager.

Author:
Parag Shah, Benjamin Sigg

Constructor Summary
DockFrontendSizeManager()
           
 
Method Summary
 double getSize(Dockable dockable)
          Returns the old size of dockable as a percentage of the size of the parent component.
protected  boolean needToTrackChange(Dockable dockable)
          Tells whether there is any need to track the size of dockable.
 void setFrontend(DockFrontend frontend)
          Sets the frontend for which this manager works.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockFrontendSizeManager

public DockFrontendSizeManager()
Method Detail

getSize

public double getSize(Dockable dockable)
Returns the old size of dockable as a percentage of the size of the parent component. This size will be used for the dockable before dropping it onto a SplitDockStation.

Specified by:
getSize in interface SizeManager
Parameters:
dockable - the element for which the size is requested
Returns:
The size that should be used for dropping dockable, -1 if not specified

setFrontend

public void setFrontend(DockFrontend frontend)
Sets the frontend for which this manager works. This method will clear any stored information.

Parameters:
frontend - the new frontend, can be null

needToTrackChange

protected boolean needToTrackChange(Dockable dockable)
Tells whether there is any need to track the size of dockable.
The default behavior of this method is to check whether dockable has a SplitDockStation as parent, and to ensure that this station has more than just one child (otherwise the child has size 1.0, which does not really help later).

Parameters:
dockable - the element to check
Returns:
true if the size of dockable is to be stored, false otherwise