bibliothek.gui.dock.facile.station.split
Class DelegatingSplitLayoutManager

java.lang.Object
  extended by bibliothek.gui.dock.facile.station.split.DelegatingSplitLayoutManager
All Implemented Interfaces:
SplitLayoutManager
Direct Known Subclasses:
LockedResizeLayoutManager

public class DelegatingSplitLayoutManager
extends Object
implements SplitLayoutManager

A SplitLayoutManager which delegates all its work to another manager. This class is intended to be subclassed in order to override some methods.

Author:
Benjamin Sigg

Constructor Summary
DelegatingSplitLayoutManager(SplitLayoutManager delegate)
          Creates a new manager
 
Method Summary
 void calculateDivider(SplitDockStation station, PutInfo putInfo, Leaf origin, StationDropItem item)
          Calculates the value a divider should have if the Dockable of putInfo is added alongside of origin.
 void install(SplitDockStation station)
          Called by a SplitDockStation when this manager will be used by the station.
 PutInfo prepareDrop(SplitDockStation station, StationDropItem dockable)
          Call forwarded from DockStation.prepareDrop.
 PutInfo prepareMove(SplitDockStation station, StationDropItem dockable)
          Call forwarded from DockStation.prepareDrop if the operation is a move operation (if the dockable is already a child of this station).
 void uninstall(SplitDockStation station)
          Called by a SplitDockStation which used this manager and no longer does.
 void updateBounds(Root root, double x, double y, double factorW, double factorH)
          Called when the bounds of all DockableDisplayer of a station have to be updated.
 double validateDivider(SplitDockStation station, double divider, Node node)
          Tests whether the specified divider-value is legal or not.
 PutInfo validatePutInfo(SplitDockStation station, PutInfo info)
          Checks whether info is valid or not.
 Dockable willMakeFullscreen(SplitDockStation station, Dockable dockable)
          Called before the station changes its fullscreen-Dockable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingSplitLayoutManager

public DelegatingSplitLayoutManager(SplitLayoutManager delegate)
Creates a new manager

Parameters:
delegate - the manager whose methods will be called unless a subclass has overridden them.
Method Detail

calculateDivider

public void calculateDivider(SplitDockStation station,
                             PutInfo putInfo,
                             Leaf origin,
                             StationDropItem item)
Description copied from interface: SplitLayoutManager
Calculates the value a divider should have if the Dockable of putInfo is added alongside of origin. The result has to be stored directly in putInfo.

Specified by:
calculateDivider in interface SplitLayoutManager
Parameters:
station - the station for which the calculation has to be done
putInfo - the new child of the station
origin - a leaf of this station or null
item - detailed information about the drag and drop operation that is going on

install

public void install(SplitDockStation station)
Description copied from interface: SplitLayoutManager
Called by a SplitDockStation when this manager will be used by the station.

Specified by:
install in interface SplitLayoutManager
Parameters:
station - the invoking station

prepareDrop

public PutInfo prepareDrop(SplitDockStation station,
                           StationDropItem dockable)
Description copied from interface: SplitLayoutManager
Call forwarded from DockStation.prepareDrop. This method calculates where to drop a new Dockable.
This SplitLayoutManager may or may not set the CombinerTarget and CombinerSource of the created PutInfo. If there is no combiner information but the mouse is over the center or the title of a selected Leaf, then the SplitDockStation will create the missing information automatically. If there is already information set, then the station will silently assume that this manager did set the information and that the information is correct.

Specified by:
prepareDrop in interface SplitLayoutManager
Parameters:
station - the calling station
dockable - the element that might be dropped
Returns:
where to drop dockable or null if the element should not be dropped

prepareMove

public PutInfo prepareMove(SplitDockStation station,
                           StationDropItem dockable)
Description copied from interface: SplitLayoutManager
Call forwarded from DockStation.prepareDrop if the operation is a move operation (if the dockable is already a child of this station). This method calculates where to move a Dockable of station.

Specified by:
prepareMove in interface SplitLayoutManager
Parameters:
station - the calling station
dockable - the element that might be dropped
Returns:
where to drop dockable or null if the element should not be dropped
See Also:
SplitLayoutManager.prepareDrop(SplitDockStation, StationDropItem)

uninstall

public void uninstall(SplitDockStation station)
Description copied from interface: SplitLayoutManager
Called by a SplitDockStation which used this manager and no longer does.

Specified by:
uninstall in interface SplitLayoutManager
Parameters:
station - the invoking station

updateBounds

public void updateBounds(Root root,
                         double x,
                         double y,
                         double factorW,
                         double factorH)
Description copied from interface: SplitLayoutManager
Called when the bounds of all DockableDisplayer of a station have to be updated. Subclasses normally can just call Root.updateBounds(double, double, double, double, double, double, boolean) with width and height set to 1.0.

Specified by:
updateBounds in interface SplitLayoutManager
Parameters:
root - the root of a tree of Dockables
x - the left bound
y - the top bound
factorW - a factor with which all x-coordinates have to be multiplied in order to get coordinates in pixels. 0 if the basic station has no size.
factorH - a factor with which all y-coordinates have to be multiplied in order to get coordinates in pixels. 0 if the basic station has no size.

validateDivider

public double validateDivider(SplitDockStation station,
                              double divider,
                              Node node)
Description copied from interface: SplitLayoutManager
Tests whether the specified divider-value is legal or not.

Specified by:
validateDivider in interface SplitLayoutManager
Parameters:
station - the station for which the divider is calculated
divider - the value of a divider on a Node
node - the Node for which the test is performed
Returns:
a legal value as near as possible to divider

validatePutInfo

public PutInfo validatePutInfo(SplitDockStation station,
                               PutInfo info)
Description copied from interface: SplitLayoutManager
Checks whether info is valid or not.

Specified by:
validatePutInfo in interface SplitLayoutManager
Parameters:
station - the station for which info will be used
info - the preferred drop location
Returns:
a valid PutInfo, info or null.

willMakeFullscreen

public Dockable willMakeFullscreen(SplitDockStation station,
                                   Dockable dockable)
Description copied from interface: SplitLayoutManager
Called before the station changes its fullscreen-Dockable.

Specified by:
willMakeFullscreen in interface SplitLayoutManager
Parameters:
station - the invoking station
dockable - the element which the station wants to make fullscreen, can be null
Returns:
the element which the station will made fullscreen, must either be a child of station or null.