|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.station.split.SplitNode
bibliothek.gui.dock.station.split.Node
public class Node
A Node represents an element in the tree of a SplitDockStation
.
Every node has two children. The areas of the children are separated by
a "divider", whose position can be changed.
Field Summary |
---|
Fields inherited from class bibliothek.gui.dock.station.split.SplitNode |
---|
height, width, x, y |
Constructor Summary | |
---|---|
Node(SplitDockAccess access)
Constructs a new node. |
|
Node(SplitDockAccess access,
SplitNode left,
SplitNode right)
Constructs a new node. |
|
Node(SplitDockAccess access,
SplitNode left,
SplitNode right,
SplitDockStation.Orientation orientation)
Constructs a new node. |
Method Summary | |
---|---|
void |
evolve(SplitDockTree.Key key)
Creates or replaces children according to the values found in key . |
double |
getDivider()
Gets the location of the divider. |
double |
getDividerAt(int x,
int y)
Calculates the value which the divider must have on condition that the point x/y lies inside the divider bounds . |
Rectangle |
getDividerBounds(double divider,
Rectangle bounds)
Calculates the location and the size of the area which represents the divider. |
Node |
getDividerNode(int x,
int y)
Gets the Node whose divider area contains the point x/y. |
Leaf |
getLeaf(Dockable dockable)
Gets the leaf which represents dockable . |
SplitNode |
getLeft()
Gets the left child of this node. |
Dimension |
getMinimumSize()
Gets the minimal size of this node. |
SplitDockStation.Orientation |
getOrientation()
Gets the orientation of this node. |
PutInfo |
getPut(int x,
int y,
double factorW,
double factorH,
Dockable drop)
Determines where to drop the Dockable drop
if the mouse is at location x/y. |
SplitNode |
getRight()
Gets the right child of this node. |
SplitNode |
read(Map<Integer,Dockable> children,
DataInputStream in)
Reads an earlier written node from the stream in . |
void |
setDivider(double divider)
Sets the location of the divider. |
void |
setLeft(SplitNode left)
Sets the left child of this node. |
void |
setRight(SplitNode right)
Sets the right child of this node. |
SplitDockTree.Key |
submit(SplitDockTree tree)
Writes the contents of this node into tree . |
void |
updateBounds(double x,
double y,
double width,
double height,
double factorW,
double factorH)
Updates the bounds of this node. |
void |
visit(SplitNodeVisitor visitor)
Invokes one of the methods of the visitor for every
child in the subtree with this as root. |
void |
write(Map<Dockable,Integer> children,
DataOutputStream out)
Writes the structure of the subtree with this as root into out . |
Methods inherited from class bibliothek.gui.dock.station.split.SplitNode |
---|
above, create, getAccess, getBounds, getHeight, getParent, getRoot, getSize, getWidth, getX, getY, intersection, readChild, relativeSidePut, setParent, writeChild |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Node(SplitDockAccess access, SplitNode left, SplitNode right, SplitDockStation.Orientation orientation)
access
- the access to the owner-station of this node.left
- the left childright
- the right childorientation
- how the children are alignedpublic Node(SplitDockAccess access, SplitNode left, SplitNode right)
access
- the access to the owner-station of this nodeleft
- the left childright
- the right childpublic Node(SplitDockAccess access)
access
- the access to the owner-station of this nodeMethod Detail |
---|
public void setLeft(SplitNode left)
left
- the left child or null
public SplitNode getLeft()
setLeft(SplitNode)
public void setRight(SplitNode right)
right
- the right childpublic SplitNode getRight()
setRight(SplitNode)
public SplitDockStation.Orientation getOrientation()
SplitDockStation.Orientation.VERTICAL
, one child
will be at the top and the other at the bottom.
public Dimension getMinimumSize()
SplitNode
getMinimumSize
in class SplitNode
public void setDivider(double divider)
divider
.
divider
- the dividerpublic double getDivider()
setDivider(double)
public void updateBounds(double x, double y, double width, double height, double factorW, double factorH)
SplitNode
Component
, then
the bounds of the component have to be updated as well.
updateBounds
in class SplitNode
x
- the relative x-coordinatey
- the relative y-coordinatewidth
- the relative width of the nodeheight
- the relative height of the nodefactorW
- a factor to be multiplied with x
and width
to get the size of the node in pixelfactorH
- a factor to be multiplied with y
and height
to get the size of the node in pixelpublic Rectangle getDividerBounds(double divider, Rectangle bounds)
divider
- The location of the divider, should be between 0 and 1.bounds
- A rectangle in which the result will be stored. It can be null
bounds
or a new Rectangle
if bounds
was null
public double getDividerAt(int x, int y)
x/y
lies inside the divider bounds
.
x
- x-coordinate of the point in pixely
- y-coordinate of the point in pixel
public PutInfo getPut(int x, int y, double factorW, double factorH, Dockable drop)
SplitNode
Dockable
drop
if the mouse is at location x/y.
getPut
in class SplitNode
x
- the x-coordinate of the mousey
- the y-coordinate of the mousefactorW
- a factor to be multiplied with the relative
x
and width
to get the
size in pixel.factorH
- a factor to be multiplied with the relative
y
and height
to get the
size in pixel.drop
- the Dockable
which will be dropped
null
if
the dockable can't be droppedpublic void evolve(SplitDockTree.Key key)
SplitNode
key
.
evolve
in class SplitNode
key
- the key to readpublic SplitDockTree.Key submit(SplitDockTree tree)
SplitNode
tree
.
submit
in class SplitNode
tree
- the tree to write into
public Leaf getLeaf(Dockable dockable)
SplitNode
dockable
.
getLeaf
in class SplitNode
dockable
- the Dockable whose leaf is searched
null
if no leaf was foundpublic Node getDividerNode(int x, int y)
SplitNode
getDividerNode
in class SplitNode
x
- the x-coordinatey
- the y-coordinate
null
is returnedpublic void visit(SplitNodeVisitor visitor)
SplitNode
visitor
for every
child in the subtree with this as root.
visit
in class SplitNode
visitor
- the visitorpublic void write(Map<Dockable,Integer> children, DataOutputStream out) throws IOException
SplitNode
out
.
write
in class SplitNode
children
- a map that contains for every Dockable
an id. This id will be written into out
to represent
the Dockable
.out
- the stream to fill
IOException
- if the stream throws an exceptionpublic SplitNode read(Map<Integer,Dockable> children, DataInputStream in) throws IOException
SplitNode
in
.
read
in class SplitNode
children
- a map of substitutions for ids that are found in the stream.in
- the source
IOException
- if the stream throws an exceptionSplitNode.write(Map, DataOutputStream)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |