bibliothek.gui.dock.station.split
Class AbstractSplitPlaceholderConverter<P,N,D>

java.lang.Object
  extended by bibliothek.gui.dock.station.split.AbstractSplitPlaceholderConverter<P,N,D>
Type Parameters:
P - the kind of station or perspective using this converter
N - the type of a single node
D - the type representing a Dockable
Direct Known Subclasses:
SplitPerspectivePlaceholderConverter, SplitPlaceholderConverter

public abstract class AbstractSplitPlaceholderConverter<P,N,D>
extends Object

Supporting class for SplitDockStation and SplitDockPerspective, allows to create and read PlaceholderMaps.

Author:
Benjamin Sigg

Constructor Summary
AbstractSplitPlaceholderConverter(P station)
          Creates a new converter
 
Method Summary
protected abstract  SplitDockTree<D> createTree()
          Creates a new SplitDockTree which will be used for dropTree(Object, SplitDockTree).
protected abstract  void dropTree(P station, SplitDockTree<D> tree)
          Updates station such that its layout looks as described by tree.
protected abstract  double getDivider(N node)
          Gets the divider location of the intermediate node node.
protected abstract  D getDockable(N leaf)
          Gets the dockable of the leaf node leaf.
protected abstract  long getId(N node)
          Gets the unique identifier that was assigned to node.
protected abstract  N getLeftChild(N node)
          Gets the left child of the intermediate node node.
protected abstract  SplitDockStation.Orientation getOrientation(N node)
          Gets the orientation of the intermediate node node.
protected abstract  Path getPlaceholderFor(D dockable)
          Gets a placeholder that is to be used for dockable.
protected abstract  PlaceholderMap getPlaceholderMap(N node)
          Gets the PlaceholderMap which is associated with node.
 PlaceholderMap getPlaceholders()
          Converts the station of this converter into a PlaceholderMap.
protected abstract  Path[] getPlaceholders(N node)
          Gets all placeholders that are associated with node.
protected abstract  PlaceholderStrategy getPlaceholderStrategy(P station)
          Gets the PlaceholderStrategy that is used by station to filter its children.
protected abstract  N getRightChild(N node)
          Gets the right child of the intermediate node node.
protected abstract  N getRoot(P station)
          Gets the root node of the tree that describes the layout of station.
protected abstract  N getRootChild(N root)
          Gets the child of the root node root.
 P getStation()
          Gets the station for which this converter is used.
protected abstract  boolean isLeaf(N node)
          Tells whether node is a leaf node.
protected abstract  boolean isNode(N node)
          Tells whether node is an intermediate node.
protected abstract  boolean isPlaceholder(N node)
          Tells whether node is a placeholder node.
protected abstract  boolean isRoot(N node)
          Tells whether node is a root node.
 void setPlaceholders(PlaceholderMap map)
          Reads map and updates the contents of the SplitDockStation that is related to this converter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSplitPlaceholderConverter

public AbstractSplitPlaceholderConverter(P station)
Creates a new converter

Parameters:
station - the station for which the converter will be used
Method Detail

getStation

public P getStation()
Gets the station for which this converter is used.

Returns:
the station

getPlaceholders

public PlaceholderMap getPlaceholders()
Converts the station of this converter into a PlaceholderMap.

Returns:
the map
See Also:
SplitDockStation.getPlaceholders()

setPlaceholders

public void setPlaceholders(PlaceholderMap map)
Reads map and updates the contents of the SplitDockStation that is related to this converter.

Parameters:
map - the map to read
See Also:
SplitDockStation.setPlaceholders(PlaceholderMap)

getRoot

protected abstract N getRoot(P station)
Gets the root node of the tree that describes the layout of station.

Parameters:
station - the station whose root node is searched
Returns:
the root node

getPlaceholderStrategy

protected abstract PlaceholderStrategy getPlaceholderStrategy(P station)
Gets the PlaceholderStrategy that is used by station to filter its children.

Parameters:
station - the station whose PlaceholderStrategy is searched
Returns:
the strategy

isRoot

protected abstract boolean isRoot(N node)
Tells whether node is a root node.

Parameters:
node - the node to check
Returns:
true if node is a root node

isNode

protected abstract boolean isNode(N node)
Tells whether node is an intermediate node.

Parameters:
node - the node to check
Returns:
true if node is an intermediate node

isLeaf

protected abstract boolean isLeaf(N node)
Tells whether node is a leaf node.

Parameters:
node - the node to check
Returns:
true if node is a leaf node

isPlaceholder

protected abstract boolean isPlaceholder(N node)
Tells whether node is a placeholder node.

Parameters:
node - the node to check
Returns:
true if node is a placeholder node

getPlaceholders

protected abstract Path[] getPlaceholders(N node)
Gets all placeholders that are associated with node.

Parameters:
node - the node whose placeholders are searched
Returns:
the placeholders

getPlaceholderMap

protected abstract PlaceholderMap getPlaceholderMap(N node)
Gets the PlaceholderMap which is associated with node.

Parameters:
node - the node whose PlaceholderMap is searched
Returns:
the map or null

getId

protected abstract long getId(N node)
Gets the unique identifier that was assigned to node.

Parameters:
node - some node whose id is searched
Returns:
the unique identifier

getRootChild

protected abstract N getRootChild(N root)
Gets the child of the root node root.

Parameters:
root - a root node
Returns:
the only child of root

getLeftChild

protected abstract N getLeftChild(N node)
Gets the left child of the intermediate node node.

Parameters:
node - an intermediate node
Returns:
the left child of node

getRightChild

protected abstract N getRightChild(N node)
Gets the right child of the intermediate node node.

Parameters:
node - an intermediate node
Returns:
the right child of node

getDivider

protected abstract double getDivider(N node)
Gets the divider location of the intermediate node node.

Parameters:
node - an intermediate node
Returns:
the divider location of node

getOrientation

protected abstract SplitDockStation.Orientation getOrientation(N node)
Gets the orientation of the intermediate node node.

Parameters:
node - an intermediate node
Returns:
the orientation of node

getDockable

protected abstract D getDockable(N leaf)
Gets the dockable of the leaf node leaf.

Parameters:
leaf - a leaf node
Returns:
the dockable of leaf

getPlaceholderFor

protected abstract Path getPlaceholderFor(D dockable)
Gets a placeholder that is to be used for dockable.

Parameters:
dockable - some item whose placeholder is searched
Returns:
the placeholder, can be null

createTree

protected abstract SplitDockTree<D> createTree()
Creates a new SplitDockTree which will be used for dropTree(Object, SplitDockTree).

Returns:
the new tree, not null

dropTree

protected abstract void dropTree(P station,
                                 SplitDockTree<D> tree)
Updates station such that its layout looks as described by tree.

Parameters:
station - the station whose layout gets updated
tree - the new layout