|
||||||||||
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 | |
---|---|
protected double |
height
Bounds of this node on the station |
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 Leaf |
create(Dockable dockable)
Creates a leaf for dockable . |
|
protected SplitNode |
create(SplitDockTree.Key key,
boolean checkValidity)
Creates a new node using the contents of key . |
|
abstract void |
evolve(SplitDockTree.Key key,
boolean checkValidity)
Creates or replaces children according to the values found in key . |
|
protected SplitDockAccess |
getAccess()
Gets access to the owner-station |
|
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 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 |
|
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. |
|
abstract boolean |
insert(SplitDockPathProperty property,
int depth,
Dockable dockable)
If there are elements left in property , then the next node
is to be read and the insert -method of the matching child
to be called.If there are no children, then dockable has to be inserted
as new child.Otherwise this element is to be replaced by a node containing this and the a leaf with dockable .Subclasses may wary this scheme in order to optimize or to find a better place for the dockable . |
|
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 boolean |
isInOverrideZone(int x,
int y,
double factorW,
double factorH)
Tells whether the coordinates x/y lie inside the override-zone of the SplitDockStation or not. |
|
PutInfo.Put |
relativeSidePut(double kx,
double ky)
Calculates on which side of the node the point kx/ky lies. |
|
abstract void |
replace(SplitNode old,
SplitNode child)
Replaces a child of this node by child . |
|
void |
setParent(SplitNode parent)
Sets the parent of this node. |
|
abstract
|
submit(SplitTreeFactory<N> factory)
Writes the contents of this node into a new tree create by factory . |
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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 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 Rectangle getBounds()
public 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 boolean isInOverrideZone(int x, int y, double factorW, double factorH)
SplitDockStation
or not.
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.
true
if the station should not allow child-stations
to make a drop when the mouse is at x/ypublic 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 replace(SplitNode old, SplitNode child)
child
.
old
- the old childchild
- the replacement for old
public abstract void visit(SplitNodeVisitor visitor)
visitor
for every
child in the subtree with this as root.
visitor
- the visitorpublic abstract void evolve(SplitDockTree.Key key, boolean checkValidity)
key
.
key
- the key to readcheckValidity
- whether to ensure that all new Dockable
s are
acceptable or not.public abstract boolean insert(SplitDockPathProperty property, int depth, Dockable dockable)
property
, then the next node
is to be read and the insert
-method of the matching child
to be called.dockable
has to be inserted
as new child.this
and the a leaf with dockable
.dockable
.
property
- a list of nodesdepth
- the index of the node that corresponds to thisdockable
- the element to insert
true
if the element was inserted, false
otherwisepublic abstract <N> N submit(SplitTreeFactory<N> factory)
factory
.
N
- the type of element the factory
will createfactory
- the factory transforming the elements of the tree into a
new form.
protected Leaf create(Dockable dockable)
dockable
.
dockable
- the element to put into a leaf
null
if the leaf would not be validprotected SplitNode create(SplitDockTree.Key key, boolean checkValidity)
key
.
key
- the key to readcheckValidity
- whether to ensure that all new Dockable
s
are acceptable or not.
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 |