|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.station.split.SplitNode
public abstract class SplitNode
The internal representation of a SplitDockStation
is a tree. The subclasses of SplitNode build this tree.
Field Summary | |
---|---|
private SplitDockAccess |
access
Internal access to the owner-station |
protected double |
height
Bounds of this node on the station |
private SplitNode |
parent
Parent node of this node |
protected double |
width
Bounds of this node on the station |
protected double |
x
Bounds of this node on the station |
protected double |
y
Bounds of this node on the station |
Constructor Summary | |
---|---|
protected |
SplitNode(SplitDockAccess access)
Creates a new SplitNode. |
Method Summary | |
---|---|
static boolean |
above(double x1,
double y1,
double x2,
double y2,
double x,
double y)
Calculates whether the point x/y lies above
the line going through x1/y1 and x2/y2 . |
protected SplitNode |
create(SplitDockTree.Key key)
Creates a new node using the contents of key . |
abstract void |
evolve(SplitDockTree.Key key)
Creates or replaces children according to the values found in key . |
protected SplitDockAccess |
getAccess()
Gets access to the owner-station |
java.awt.Rectangle |
getBounds()
Gets the size and location of this node in pixel where the point 0/0 is equal to the point 0/0 on the owner-station. |
abstract Node |
getDividerNode(int x,
int y)
Gets the Node whose divider area contains the point x/y. |
double |
getHeight()
Gets the relative height of this node in relation to the owner-station. |
abstract Leaf |
getLeaf(Dockable dockable)
Gets the leaf which represents dockable . |
abstract java.awt.Dimension |
getMinimumSize()
Gets the minimal size of this node. |
SplitNode |
getParent()
Gets the parent of this node. |
abstract 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. |
protected Root |
getRoot()
Gets the root of the tree in which this node is |
java.awt.Dimension |
getSize()
Gets the size of this node in pixel. |
double |
getWidth()
Gets the relative width of this node in relation to the owner-station. |
double |
getX()
Gets the relative x-coordinate of this node on the owner-station. |
double |
getY()
Gets the relative y-coordinate of this node on the owner-station. |
double |
intersection(SplitDockProperty property)
Calculates how much of the rectangle given by the property lies inside this node and how much of this node lies in the rectangle. |
abstract SplitNode |
read(java.util.Map<java.lang.Integer,Dockable> children,
java.io.DataInputStream in)
Reads an earlier written node from the stream in . |
protected SplitNode |
readChild(java.util.Map<java.lang.Integer,Dockable> children,
java.io.DataInputStream in)
Reads a single node which was earlier written. |
PutInfo.Put |
relativeSidePut(double kx,
double ky)
Calculates on which side of the node the point kx/ky lies. |
void |
setParent(SplitNode parent)
Sets the parent of this node. |
abstract 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. |
abstract void |
visit(SplitNodeVisitor visitor)
Invokes one of the methods of the visitor for every
child in the subtree with this as root. |
abstract void |
write(java.util.Map<Dockable,java.lang.Integer> children,
java.io.DataOutputStream out)
Writes the structure of the subtree with this as root into out . |
protected void |
writeChild(SplitNode element,
java.util.Map<Dockable,java.lang.Integer> children,
java.io.DataOutputStream out)
Writes the contents of a single child into out . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private SplitDockAccess access
private SplitNode parent
protected double x
protected double y
protected double width
protected double height
Constructor Detail |
---|
protected SplitNode(SplitDockAccess access)
access
- the access to the owner of this node. Must not be null
Method Detail |
---|
public double getX()
public double getY()
public double getWidth()
public double getHeight()
public void setParent(SplitNode parent)
parent
- the new parent, can be null
public SplitNode getParent()
null
protected SplitDockAccess getAccess()
public abstract java.awt.Dimension getMinimumSize()
public void updateBounds(double x, double y, double width, double height, double factorW, double factorH)
Component
, then
the bounds of the component have to be updated as well.
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 java.awt.Rectangle getBounds()
public java.awt.Dimension getSize()
protected Root getRoot()
public abstract PutInfo getPut(int x, int y, double factorW, double factorH, Dockable drop)
Dockable
drop
if the mouse is at location x/y.
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 abstract Leaf getLeaf(Dockable dockable)
dockable
.
dockable
- the Dockable whose leaf is searched
null
if no leaf was foundpublic abstract Node getDividerNode(int x, int y)
x
- the x-coordinatey
- the y-coordinate
null
is returnedpublic abstract void visit(SplitNodeVisitor visitor)
visitor
for every
child in the subtree with this as root.
visitor
- the visitorpublic abstract void write(java.util.Map<Dockable,java.lang.Integer> children, java.io.DataOutputStream out) throws java.io.IOException
out
.
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
java.io.IOException
- if the stream throws an exceptionprotected void writeChild(SplitNode element, java.util.Map<Dockable,java.lang.Integer> children, java.io.DataOutputStream out) throws java.io.IOException
out
.
element
- the element to storechildren
- the unique ids of all Dockables
which
may occur.out
- the stream to fill
java.io.IOException
- if the stream throws an exceptionreadChild(Map, DataInputStream)
public abstract SplitNode read(java.util.Map<java.lang.Integer,Dockable> children, java.io.DataInputStream in) throws java.io.IOException
in
.
children
- a map of substitutions for ids that are found in the stream.in
- the source
java.io.IOException
- if the stream throws an exceptionwrite(Map, DataOutputStream)
protected SplitNode readChild(java.util.Map<java.lang.Integer,Dockable> children, java.io.DataInputStream in) throws java.io.IOException
children
- a map of substitutions for ids that are found in the stream.in
- the source
java.io.IOException
- if the stream throws an exceptionwriteChild(SplitNode, Map, DataOutputStream)
public abstract void evolve(SplitDockTree.Key key)
key
.
key
- the key to readpublic abstract SplitDockTree.Key submit(SplitDockTree tree)
tree
.
tree
- the tree to write into
protected SplitNode create(SplitDockTree.Key key)
key
.
key
- the key to read
public double intersection(SplitDockProperty property)
property
- the property that gives a rectangle
public PutInfo.Put relativeSidePut(double kx, double ky)
kx/ky
lies.
kx
- the relative x-coordinate of the pointky
- the relative y-coordinate of the point
public static boolean above(double x1, double y1, double x2, double y2, double x, double y)
x/y
lies above
the line going through x1/y1
and x2/y2
.
x1
- the x-coordinate of the first point on the liney1
- the y-coordinate of the first point on the linex2
- the x-coordinate of the second point on the liney2
- the y-coordinate of the second point on the linex
- the x-coordinate of the point which may be above the liney
- the y-coordinate of the point which may be above the line
true
if the point lies above the line, false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |