D
- the kind of object representing a Dockable
public abstract class SplitDockTree<D>
extends java.lang.Object
SplitDockStation
. Can be used
to exchange the tree of a SplitDockStation
. Every node or leaf is
represented through a SplitDockTree.Key
. Client code may use these keys to read
data, or create new branches of the tree.SplitDockStation
has a unique identifier. This SplitDockTree
class allows to set this identifier either through SplitDockTree.Key.setNodeId(long)
or
through the non-complex methods (the methods that create only one new key).Modifier and Type | Class and Description |
---|---|
class |
SplitDockTree.Key
A key that represents either a node or a leaf.
|
Constructor and Description |
---|
SplitDockTree() |
Modifier and Type | Method and Description |
---|---|
D[] |
array(D dockable)
Creates an array around
dockable . |
abstract D[] |
array(int size)
Creates a new array of size
size for objects of type D . |
SplitDockTree.Key |
getBottom(SplitDockTree.Key key)
Gets the bottom element of the node
key . |
double |
getDivider(SplitDockTree.Key key)
Gets the divider of the node
key . |
D[] |
getDockables()
Gets a list of all
Dockable s that are known to this tree. |
D[] |
getDockables(SplitDockTree.Key key)
Gets the elements that are represented by the leaf
key . |
SplitDockTree.Key |
getLeft(SplitDockTree.Key key)
Gets the left element of the node
key . |
PlaceholderMap |
getPlaceholderMap(SplitDockTree.Key key)
Gets the placeholder information of the child
DockStation of key . |
Path[] |
getPlaceholders(SplitDockTree.Key key)
Gets the placeholders which are associated with
key |
SplitDockTree.Key |
getRight(SplitDockTree.Key key)
Gets the right element of the node
key . |
SplitDockTree.Key |
getRoot()
Gets the root of the tree.
|
D |
getSelected(SplitDockTree.Key key)
Gets the element that is selected in this leaf.
|
SplitDockTree.Key |
getTop(SplitDockTree.Key key)
Gets the top element of the node
key . |
SplitDockTree.Key |
horizontal(D left,
D right)
Adds two elements horizontally.
|
SplitDockTree.Key |
horizontal(D left,
D right,
double divider)
Adds two elements horizontally.
|
SplitDockTree.Key |
horizontal(SplitDockTree.Key left,
SplitDockTree.Key right)
Adds two elements horizontally.
|
SplitDockTree.Key |
horizontal(SplitDockTree.Key left,
SplitDockTree.Key right,
double divider)
Adds two elements horizontally.
|
SplitDockTree.Key |
horizontal(SplitDockTree.Key left,
SplitDockTree.Key right,
double divider,
long nodeId)
Adds two elements horizontally.
|
SplitDockTree.Key |
horizontal(SplitDockTree.Key left,
SplitDockTree.Key right,
double divider,
Path[] placeholders,
PlaceholderMap placeholderMap,
long nodeId)
Adds two elements horizontally.
|
boolean |
isDockable(SplitDockTree.Key key)
Tells whether
key represents a leaf or not. |
boolean |
isHorizontal(SplitDockTree.Key key)
Tells whether the node
key represents a horizontal
or a vertical node. |
boolean |
isNode(SplitDockTree.Key key)
Tells whether
key represents a node or not. |
boolean |
isPlaceholder(SplitDockTree.Key key)
Tells whether
key contains placeholders |
SplitDockTree.Key |
put(D... dockables)
Creates a key for the set
dockables . |
SplitDockTree.Key |
put(D[] dockables,
D selected)
Creates a key for the set
dockables . |
SplitDockTree.Key |
put(D[] dockables,
D selected,
long nodeId)
Creates a key for the set
dockables . |
SplitDockTree.Key |
put(D[] dockables,
D selected,
Path[] placeholders,
PlaceholderMap placeholderMap,
long nodeId)
Creates a key for the set of
dockables or the set of
placeholders . |
SplitDockTree.Key |
put(D dockable,
long nodeId)
Creates a key for the leaf
dockable . |
SplitDockTree.Key |
put(Path[] placeholders,
PlaceholderMap placeholderMap)
Creates a key for a placeholder leaf.
|
SplitDockTree.Key |
put(Path[] placeholders,
PlaceholderMap placeholderMap,
long nodeId)
Creates a key for a placeholder leaf.
|
SplitDockTree.Key |
root(D dockable)
Sets
dockable as root, and returns a key to the root. |
SplitDockTree<D> |
root(SplitDockTree.Key key)
Sets
key as the root of the tree. |
java.lang.String |
toString() |
SplitDockTree.Key |
unroot()
Removes the root of this tree.
|
SplitDockTree.Key |
vertical(D top,
D bottom)
Adds two elements vertically.
|
SplitDockTree.Key |
vertical(D top,
D bottom,
double divider)
Adds two elements vertically.
|
SplitDockTree.Key |
vertical(SplitDockTree.Key top,
SplitDockTree.Key bottom)
Adds two elements vertically.
|
SplitDockTree.Key |
vertical(SplitDockTree.Key top,
SplitDockTree.Key bottom,
double divider)
Adds two elements vertically.
|
SplitDockTree.Key |
vertical(SplitDockTree.Key top,
SplitDockTree.Key bottom,
double divider,
long nodeId)
Adds two elements vertically.
|
SplitDockTree.Key |
vertical(SplitDockTree.Key top,
SplitDockTree.Key bottom,
double divider,
Path[] placeholders,
PlaceholderMap placeholderMap,
long nodeId)
Adds two elements vertically.
|
public abstract D[] array(int size)
size
for objects of type D
.size
- the size of the arraypublic D[] array(D dockable)
dockable
.dockable
- the element that should be put into an arraypublic SplitDockTree.Key root(D dockable)
dockable
as root, and returns a key to the root.dockable
- the new rootpublic SplitDockTree.Key unroot()
public SplitDockTree<D> root(SplitDockTree.Key key)
key
as the root of the tree. The root must not have
a parent.key
- the key which will be the root, null
is not allowed.this
public SplitDockTree.Key put(D dockable, long nodeId)
dockable
.dockable
- the element for which a key is requestednodeId
- the unique identifier for this node, can be -1public SplitDockTree.Key put(D... dockables)
dockables
.dockables
- the elements for which a key is requestedpublic SplitDockTree.Key put(D[] dockables, D selected)
dockables
.dockables
- the elements for which a key is requestedselected
- the element that should be selected, can be null
public SplitDockTree.Key put(D[] dockables, D selected, long nodeId)
dockables
.dockables
- the elements for which a key is requestedselected
- the element that should be selected, can be null
nodeId
- a unique identifier for this node, may be -1public SplitDockTree.Key put(Path[] placeholders, PlaceholderMap placeholderMap)
placeholders
- the placeholders to storeplaceholderMap
- placeholder information of a child DockStation
public SplitDockTree.Key put(Path[] placeholders, PlaceholderMap placeholderMap, long nodeId)
placeholders
- the placeholders to storeplaceholderMap
- placeholder information of a child DockStation
nodeId
- the unique identifier of the new node, can be -1public SplitDockTree.Key put(D[] dockables, D selected, Path[] placeholders, PlaceholderMap placeholderMap, long nodeId)
dockables
or the set of
placeholders
.dockables
- the elements for which a key is requestedselected
- the element that should be selected, can be null
placeholders
- the placeholders for which a key is requestedplaceholderMap
- placeholder information of a child DockStation
nodeId
- a unique identifier for this node, may be -1public SplitDockTree.Key horizontal(D left, D right)
left
- the left elementright
- the right elementpublic SplitDockTree.Key horizontal(D left, D right, double divider)
left
- the left elementright
- the right elementdivider
- how much space the first element gets in respect
to the second element. Must be between 0 and 1.public SplitDockTree.Key horizontal(SplitDockTree.Key left, SplitDockTree.Key right)
left
- the left elementright
- the right elementpublic SplitDockTree.Key horizontal(SplitDockTree.Key left, SplitDockTree.Key right, double divider)
left
- the left elementright
- the right elementdivider
- how much space the first element gets in respect
to the second element. Must be between 0 and 1.public SplitDockTree.Key horizontal(SplitDockTree.Key left, SplitDockTree.Key right, double divider, long nodeId)
left
- the left elementright
- the right elementdivider
- how much space the first element gets in respect
to the second element. Must be between 0 and 1.nodeId
- a unique identifier for this node, may be -1public SplitDockTree.Key horizontal(SplitDockTree.Key left, SplitDockTree.Key right, double divider, Path[] placeholders, PlaceholderMap placeholderMap, long nodeId)
left
- the left elementright
- the right elementdivider
- how much space the first element gets in respect
to the second element. Must be between 0 and 1.placeholders
- placeholders that are associated with this nodesplaceholderMap
- placeholder information of a child DockStation
nodeId
- a unique identifier for this node, may be -1public SplitDockTree.Key vertical(D top, D bottom)
top
- the top elementbottom
- the bottom elementpublic SplitDockTree.Key vertical(D top, D bottom, double divider)
top
- the top elementbottom
- the bottom elementdivider
- how much space the first element gets in respect
to the second element. Must be between 0 and 1.public SplitDockTree.Key vertical(SplitDockTree.Key top, SplitDockTree.Key bottom)
top
- the top elementbottom
- the bottom elementpublic SplitDockTree.Key vertical(SplitDockTree.Key top, SplitDockTree.Key bottom, double divider)
top
- the top elementbottom
- the bottom elementdivider
- how much space the first element gets in respect
to the second element. Must be between 0 and 1.public SplitDockTree.Key vertical(SplitDockTree.Key top, SplitDockTree.Key bottom, double divider, long nodeId)
top
- the top elementbottom
- the bottom elementdivider
- how much space the first element gets in respect
to the second element. Must be between 0 and 1.nodeId
- a unique identifier for this node, may be -1public SplitDockTree.Key vertical(SplitDockTree.Key top, SplitDockTree.Key bottom, double divider, Path[] placeholders, PlaceholderMap placeholderMap, long nodeId)
top
- the top elementbottom
- the bottom elementdivider
- how much space the first element gets in respect
to the second element. Must be between 0 and 1.placeholders
- placeholders that are associated with this nodeplaceholderMap
- placeholder information of a child DockStation
nodeId
- a unique identifier for this node, may be -1public SplitDockTree.Key getRoot()
null
public boolean isDockable(SplitDockTree.Key key)
key
represents a leaf or not.key
- the key to testtrue
if key
is a leafpublic boolean isNode(SplitDockTree.Key key)
key
represents a node or not.key
- the key to testtrue
if key
is a nodepublic boolean isPlaceholder(SplitDockTree.Key key)
key
contains placeholderskey
- some node or leaftrue
if there are placeholderspublic Path[] getPlaceholders(SplitDockTree.Key key)
key
key
- some node or leafnull
public PlaceholderMap getPlaceholderMap(SplitDockTree.Key key)
DockStation
of key
.key
- some node or leafnull
public D[] getDockables()
Dockable
s that are known to this tree.public D[] getDockables(SplitDockTree.Key key)
key
.key
- the leafnull
public D getSelected(SplitDockTree.Key key)
key
- the leafnull
public boolean isHorizontal(SplitDockTree.Key key)
key
represents a horizontal
or a vertical node.key
- the nodetrue
if the elements are laid out horizontally,
false
if the are verticallypublic SplitDockTree.Key getLeft(SplitDockTree.Key key)
key
.key
- the nodepublic SplitDockTree.Key getRight(SplitDockTree.Key key)
key
.key
- the nodepublic SplitDockTree.Key getTop(SplitDockTree.Key key)
key
.key
- the nodepublic SplitDockTree.Key getBottom(SplitDockTree.Key key)
key
.key
- the nodepublic double getDivider(SplitDockTree.Key key)
key
.key
- the nodepublic java.lang.String toString()
toString
in class java.lang.Object