bibliothek.gui.dock.layout
Class DefaultLocationEstimationMap

java.lang.Object
  extended by bibliothek.gui.dock.layout.DefaultLocationEstimationMap
All Implemented Interfaces:
LocationEstimationMap

public class DefaultLocationEstimationMap
extends Object
implements LocationEstimationMap

This default implementation of a LocationEstimationMap works directly with the tree built by DockLayoutCompositions. It is to be used as follows:

Author:
Benjamin Sigg

Constructor Summary
DefaultLocationEstimationMap(DockLayoutComposition root)
          Creates a new map
 
Method Summary
 void finish()
          Closes up this node.
 DockLayoutInfo getChild(int childIndex)
          Gets the DockLayoutInfo that is associated with key childIndex.
 int getChildCount()
          Gets the number of children of this map
 DockLayoutComposition getRoot()
          Gets the element which is represented by this map.
 DockLayoutInfo getSubChild(int childIndex, int subChildIndex)
          Gets the subChildIndex'th child of childIndex.
 int getSubChildCount(int childIndex)
          Gets the number of children the item childIndex has.
 void setLocation(int childIndex, DockableProperty location)
          Informs this map that the jump from this station to childIndex can be described by location.
 void setLocation(int childIndex, int subChildIndex, DockableProperty location)
          Informs this map that the path to child childIndex, subChildIndex contains location.
 DefaultLocationEstimationMap subMap(int childIndex)
          Returns a newly created map that centers around the child with index childIndex.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLocationEstimationMap

public DefaultLocationEstimationMap(DockLayoutComposition root)
Creates a new map

Parameters:
root - the representation of this station
Method Detail

subMap

public DefaultLocationEstimationMap subMap(int childIndex)
Returns a newly created map that centers around the child with index childIndex.

Parameters:
childIndex - the index of the child
Returns:
the new map

getRoot

public DockLayoutComposition getRoot()
Gets the element which is represented by this map.

Returns:
the element

finish

public void finish()
Closes up this node. If the location of a leaf changed, its previous location is set as successor. Otherwise if the location of a child changed, set the new location and use the old location as successor. Otherwise invalidate the leaf as its location will never be completed.


getChildCount

public int getChildCount()
Description copied from interface: LocationEstimationMap
Gets the number of children of this map

Specified by:
getChildCount in interface LocationEstimationMap
Returns:
the total number of keys

getChild

public DockLayoutInfo getChild(int childIndex)
Description copied from interface: LocationEstimationMap
Gets the DockLayoutInfo that is associated with key childIndex.

Specified by:
getChild in interface LocationEstimationMap
Parameters:
childIndex - some key between 0 and LocationEstimationMap.getChildCount()
Returns:
the info, not null

getSubChildCount

public int getSubChildCount(int childIndex)
Description copied from interface: LocationEstimationMap
Gets the number of children the item childIndex has.

Specified by:
getSubChildCount in interface LocationEstimationMap
Parameters:
childIndex - the key of some element
Returns:
the number of children of childIndex

getSubChild

public DockLayoutInfo getSubChild(int childIndex,
                                  int subChildIndex)
Description copied from interface: LocationEstimationMap
Gets the subChildIndex'th child of childIndex.

Specified by:
getSubChild in interface LocationEstimationMap
Parameters:
childIndex - the key to some child
subChildIndex - the index of some child of childIndex
Returns:
the info, not null

setLocation

public void setLocation(int childIndex,
                        DockableProperty location)
Description copied from interface: LocationEstimationMap
Informs this map that the jump from this station to childIndex can be described by location.

Specified by:
setLocation in interface LocationEstimationMap
Parameters:
childIndex - the key of some child
location - the location of childIndex, null will be ignored

setLocation

public void setLocation(int childIndex,
                        int subChildIndex,
                        DockableProperty location)
Description copied from interface: LocationEstimationMap
Informs this map that the path to child childIndex, subChildIndex contains location. The part location describes the jump from this station to the child childIndex.

Specified by:
setLocation in interface LocationEstimationMap
Parameters:
childIndex - the key of some child
subChildIndex - the index of some grand-child
location - the location, null will be ignored