bibliothek.gui.dock.station.split
Class SplitDockPathProperty

java.lang.Object
  extended by bibliothek.gui.dock.layout.AbstractDockableProperty
      extended by bibliothek.gui.dock.station.split.SplitDockPathProperty
All Implemented Interfaces:
DockableProperty, Iterable<SplitDockPathProperty.Node>

public class SplitDockPathProperty
extends AbstractDockableProperty
implements Iterable<SplitDockPathProperty.Node>

A DockableProperty used by the SplitDockStation to describe the location of a Dockable in the tree of all children of the station.

Author:
Benjamin Sigg

Nested Class Summary
static class SplitDockPathProperty.Location
          The direction which the path takes
static class SplitDockPathProperty.Node
          Describes one turn of the path.
 
Constructor Summary
SplitDockPathProperty()
          Creates a new, empty path
 
Method Summary
 void add(SplitDockPathProperty.Location location, double size)
          Adds a new element to the end of the path.
 DockableProperty copy()
          Gets a copy of this property, the DockableProperty.getSuccessor() must be copied as well.
 String getFactoryID()
          Gets the unique name of the DockablePropertyFactory which can create this type of DockableProperty.
 SplitDockPathProperty.Node getNode(int index)
          Gets the index'th node, where the node 0 is the node nearest to the root.
 void insert(SplitDockPathProperty.Location location, double size, int index)
          Adds a new element to the path.
 Iterator<SplitDockPathProperty.Node> iterator()
           
 void load(DataInputStream in)
          Reads the contents of this DockableProperty from a stream.
 void load(XElement element)
          Reads the contents of this DockableProperty from an xml element.
 int size()
          Gets the number of nodes stores in this property.
 void store(DataOutputStream out)
          Stores the contents of this DockableProperty in a stream.
 void store(XElement element)
          Stores the contents of this property as xml element.
 SplitDockProperty toLocation()
          Calculates which bounds the element accessed through the given path would have.
 String toString()
           
 
Methods inherited from class bibliothek.gui.dock.layout.AbstractDockableProperty
copy, getSuccessor, setSuccessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SplitDockPathProperty

public SplitDockPathProperty()
Creates a new, empty path

Method Detail

copy

public DockableProperty copy()
Description copied from interface: DockableProperty
Gets a copy of this property, the DockableProperty.getSuccessor() must be copied as well.

Specified by:
copy in interface DockableProperty
Returns:
an independent copy of this

iterator

public Iterator<SplitDockPathProperty.Node> iterator()
Specified by:
iterator in interface Iterable<SplitDockPathProperty.Node>

size

public int size()
Gets the number of nodes stores in this property.

Returns:
the number of nodes

getNode

public SplitDockPathProperty.Node getNode(int index)
Gets the index'th node, where the node 0 is the node nearest to the root.

Parameters:
index - the index of the node
Returns:
the node

toLocation

public SplitDockProperty toLocation()
Calculates which bounds the element accessed through the given path would have.

Returns:
the bounds

add

public void add(SplitDockPathProperty.Location location,
                double size)
Adds a new element to the end of the path. Every element describes which turn the path takes in a node.

Parameters:
location - the direction into which the path goes
size - the relative size of the path, a value in the range 0.0 to 1.0

insert

public void insert(SplitDockPathProperty.Location location,
                   double size,
                   int index)
Adds a new element to the path. Every element describes which turn the path takes in a node.

Parameters:
location - the direction into which the path goes
size - the relative size of the path, a value in the range 0.0 to 1.0
index - where to add the new element

getFactoryID

public String getFactoryID()
Description copied from interface: DockableProperty
Gets the unique name of the DockablePropertyFactory which can create this type of DockableProperty.

Specified by:
getFactoryID in interface DockableProperty
Returns:
the id
See Also:
DockablePropertyFactory

store

public void store(DataOutputStream out)
           throws IOException
Description copied from interface: DockableProperty
Stores the contents of this DockableProperty in a stream. The successor (if there is one) must not be saved.

Specified by:
store in interface DockableProperty
Parameters:
out - the stream to write in
Throws:
IOException - if anything unexpected happens

store

public void store(XElement element)
Description copied from interface: DockableProperty
Stores the contents of this property as xml element.

Specified by:
store in interface DockableProperty
Parameters:
element - the element into which to write, the attributes of this element should not be changed

load

public void load(DataInputStream in)
          throws IOException
Description copied from interface: DockableProperty
Reads the contents of this DockableProperty from a stream. The property can assume that a property with the same type has written into the stream.

Specified by:
load in interface DockableProperty
Parameters:
in - the stream to read
Throws:
IOException - if anything unexpected happens

load

public void load(XElement element)
Description copied from interface: DockableProperty
Reads the contents of this DockableProperty from an xml element.

Specified by:
load in interface DockableProperty
Parameters:
element - the element that was written earlier by this property

toString

public String toString()
Overrides:
toString in class Object