public class Leaf extends SpanSplitNode
SplitDockStation
.
A leaf also represents a single Dockable
which is shown
on the owner-station.Constructor and Description |
---|
Leaf(SplitDockAccess access)
Creates a new leaf.
|
Leaf(SplitDockAccess access,
long id)
Creates a new leaf.
|
Modifier and Type | Method and Description |
---|---|
boolean |
aside(AsideRequest request)
Inserts a new placeholder at this node.
|
boolean |
aside(SplitDockPathProperty property,
int index,
AsideRequest request)
Inserts a new placeholder at location
property . |
protected PutInfo |
createSidePut(java.awt.Rectangle bounds,
int x,
int y,
Dockable drop,
boolean centered)
Assuming the mouse at
x/y is within bounds , this method calculates which one
of the non-combining PutInfo.Put s describe the situation best. |
void |
evolve(SplitDockTree.Key key,
boolean checkValidity,
java.util.Map<Leaf,Dockable> linksToSet)
Creates or replaces children according to the values found in
key . |
SplitNode |
getChild(int location)
Gets the child at
location . |
int |
getChildLocation(SplitNode child)
Gets the location of a child.
|
DockableDisplayer |
getDisplayer()
Gets the displayer of this leaf.
|
Node |
getDividerNode(int x,
int y)
Gets the Node whose divider area contains the point x/y.
|
Dockable |
getDockable()
Gets the
Dockable which is shown on the displayer
of this leaf. |
StationChildHandle |
getDockableHandle()
Gets the handle which is responsible for the current
Dockable . |
Leaf |
getLeaf(Dockable dockable)
Gets the leaf which represents
dockable . |
int |
getMaxChildrenCount()
Gets the maximal number of children this node can have.
|
java.awt.Dimension |
getMinimumSize()
Gets the minimal size of this node.
|
java.awt.Dimension |
getPreferredSize()
Gets the preferred size 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 |
getVisible()
Gets the root of a subtree such that the root is visible and such that the
is the uppermost visible node.
|
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 . |
boolean |
insert(SplitDockPlaceholderProperty property,
Dockable dockable)
Recursively searches for a node or leaf that uses the placeholder specified by
property and inserts the dockable there. |
protected boolean |
isCenterPut(java.awt.Rectangle bounds,
int x,
int y)
Tells whether the position of the mouse
x/y would result in a drag and drop operation where
PutInfo.Put.CENTER is appropriate. |
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. |
boolean |
isOfUse()
Tells whether this node still has any use or can safely be removed from the tree
|
protected boolean |
isTitlePut(java.awt.Rectangle bounds,
int x,
int y)
Tells whether the position of the mouse
x/y would result in a drag and drop operation where
PutInfo.Put.TITLE is appropriate. |
boolean |
isVisible()
Tells whether this node (or one of this children) contains element that
are visible to the user.
|
void |
onSpanResize()
Called if a
Span of this node changed its size |
void |
placehold(boolean keepCurrent)
Disconnects this leaf from its
Dockable . |
protected java.awt.Rectangle |
removeTitle(java.awt.Rectangle bounds)
|
void |
resetDisplayerBounds()
|
void |
setBounds(double x,
double y,
double width,
double height,
double factorW,
double factorH,
boolean updateComponentBounds)
Updates the bounds of this node.
|
void |
setChild(SplitNode child,
int location)
Adds a child to this node at a given location.
|
void |
setDockable(Dockable dockable,
DockHierarchyLock.Token token)
Sets the element of this leaf.
|
void |
setDockable(Dockable dockable,
DockHierarchyLock.Token token,
boolean updatePlaceholders,
boolean storePlaceholderMap)
Sets the element of this leaf.
|
void |
setHandle(StationChildHandle handle)
Sets the element of this leaf.
|
<N> N |
submit(SplitTreeFactory<N> factory)
Writes the contents of this node into a new tree create by
factory . |
void |
toString(int tabs,
java.lang.StringBuilder out)
Writes some contents of this node into
out . |
void |
updateBounds(double x,
double y,
double width,
double height,
double factorW,
double factorH,
boolean components)
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. |
createSpans, getSpans
getCurrentBounds
above, addPlaceholder, create, create, createLeaf, createNode, createPlaceholder, delete, ensureIdUnique, ensureIdUniqueAsync, getAccess, getBounds, getHeight, getId, getParent, getPlaceholderMap, getPlaceholderNode, getPlaceholders, getRoot, getSize, getStation, getTotalChildrenCount, getWidth, getX, getY, hasPlaceholder, hasPlaceholders, intersection, movePlaceholderMap, relativeSidePut, removePlaceholder, removePlaceholders, replace, setParent, setPlaceholderMap, setPlaceholders, split, split, toString, treeChanged
public Leaf(SplitDockAccess access)
access
- the access to the private functions of the owning SplitDockStation
public Leaf(SplitDockAccess access, long id)
access
- the access to the private functions of the owning SplitDockStation
id
- the unique id of this leafpublic void setHandle(StationChildHandle handle)
handle
- the elementpublic java.awt.Dimension getMinimumSize()
SplitNode
getMinimumSize
in class SplitNode
public java.awt.Dimension getPreferredSize()
SplitNode
getPreferredSize
in class SplitNode
public int getChildLocation(SplitNode child)
SplitNode
getChildLocation
in class SplitNode
child
- a child of this nodechild
or -1 if the child is unknownpublic void setChild(SplitNode child, int location)
SplitNode
public int getMaxChildrenCount()
SplitNode
getMaxChildrenCount
in class SplitNode
public SplitNode getChild(int location)
SplitNode
location
.public void setDockable(Dockable dockable, DockHierarchyLock.Token token)
dockable
is registered in the DockStation
dockable
- the new element or null
to remove the
old Dockable
token
- if null
, then a token will be acquired by this method
and this method will fire events, otherwise this methods is executed silently. Clients should
use null
.public void setDockable(Dockable dockable, DockHierarchyLock.Token token, boolean updatePlaceholders, boolean storePlaceholderMap)
dockable
is registered in the DockStation
dockable
- the new element or null
to remove the
old Dockable
token
- if null
, then a token will be acquired by this method
and this method will fire events, otherwise this methods is executed silentlyupdatePlaceholders
- if true
, the placeholder list of this leaf is
automatically updatedstorePlaceholderMap
- if true
, the current PlaceholderMap
is
replaced by the map provided by the current Dockable
which is a DockStation
public Dockable getDockable()
Dockable
which is shown on the displayer
of this leaf.public DockableDisplayer getDisplayer()
public StationChildHandle getDockableHandle()
Dockable
.null
public boolean isVisible()
SplitNode
public SplitNode getVisible()
SplitNode
getVisible
in class SplitNode
null
, this
or any
child of this nodepublic boolean isOfUse()
SplitNode
public void placehold(boolean keepCurrent)
Dockable
. This leaf either deletes
itself or replaces itself with a Placeholder
.keepCurrent
- if true
, the placeholder of the current
Dockable
is added to the set of the placeholders, otherwise the placeholder
is removed.public void updateBounds(double x, double y, double width, double height, double factorW, double factorH, boolean components)
SplitNode
Component
, then
the bounds of the component have to be updated as well.updateBounds
on
the children of this node.updateBounds
in class VisibleSplitNode
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 pixelcomponents
- whether to update the bounds of Component
s
that are in the tree. If set to false
, then all updates stay within
the tree and the graphical user interface is not changed. That can be useful
if more than one round of updates is necessary. If in doubt, set this parameter
to true
.SplitNode.setBounds(double, double, double, double, double, double, boolean)
public void setBounds(double x, double y, double width, double height, double factorW, double factorH, boolean updateComponentBounds)
SplitNode
Component
, then
the bounds of the component have to be updated as well. This method is not recursive, it does not
call getBounds
on the children of this node.setBounds
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 pixelupdateComponentBounds
- whether to update the bounds of Component
s
that are in the tree. If set to false
, then all updates stay within
the tree and the graphical user interface is not changed. That can be useful
if more than one round of updates is necessary. If in doubt, set this parameter
to true
.SplitNode.updateBounds(double, double, double, double, double, double, boolean)
public void onSpanResize()
SpanSplitNode
Span
of this node changed its sizeonSpanResize
in class SpanSplitNode
public void resetDisplayerBounds()
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 droppednull
if
the dockable can't be droppedprotected java.awt.Rectangle removeTitle(java.awt.Rectangle bounds)
DockableDisplayer
for its current DockTitle
and removes the size
of the title from bounds
. Depending on the position of the title bounds
is moved, shrunk only horizontally or vertically.bounds
- some boundaries, usually describing the boundaries of this Leaf
but
any Rectangle
can be modified by this methodbounds
where the size of the title (if there is any) has been removedprotected boolean isCenterPut(java.awt.Rectangle bounds, int x, int y)
x/y
would result in a drag and drop operation where
PutInfo.Put.CENTER
is appropriate.protected boolean isTitlePut(java.awt.Rectangle bounds, int x, int y)
x/y
would result in a drag and drop operation where
PutInfo.Put.TITLE
is appropriate.protected PutInfo createSidePut(java.awt.Rectangle bounds, int x, int y, Dockable drop, boolean centered)
x/y
is within bounds
, this method calculates which one
of the non-combining PutInfo.Put
s describe the situation best. The method creates and validates a new
PutInfo
.bounds
- the boundaries of the Dockable
, the Leaf
or any other representation of the
Dockable
.x
- the x-coordinate of the mousey
- the y-coordinate of the mousedrop
- the item that is about to be droppedcentered
- whether the mouse position alone would usually require one of the combining PutInfo.Put
snull
if the suggested operation is not validpublic boolean isInOverrideZone(int x, int y, double factorW, double factorH)
SplitNode
SplitDockStation
or not.isInOverrideZone
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.true
if the station should not allow child-stations
to make a drop when the mouse is at x/ypublic void evolve(SplitDockTree.Key key, boolean checkValidity, java.util.Map<Leaf,Dockable> linksToSet)
SplitNode
key
. Note that this method does not remove any Dockable
s
from the station. They must be removed explicitly using setDockable(Dockable, bibliothek.gui.dock.DockHierarchyLock.Token)
public boolean insert(SplitDockPlaceholderProperty property, Dockable dockable)
SplitNode
property
and inserts the dockable
there. Also removes
the placeholder from this node.public boolean aside(AsideRequest request)
SplitNode
public boolean aside(SplitDockPathProperty property, int index, AsideRequest request)
SplitNode
property
.public boolean insert(SplitDockPathProperty property, int depth, Dockable dockable)
SplitNode
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
.public <N> N submit(SplitTreeFactory<N> factory)
SplitNode
factory
.public Leaf getLeaf(Dockable dockable)
SplitNode
dockable
.public Node getDividerNode(int x, int y)
SplitNode
getDividerNode
in class SplitNode
x
- the x-coordinatey
- the y-coordinatenull
is returnedpublic void visit(SplitNodeVisitor visitor)
SplitNode
visitor
for every
child in the subtree with this as root.public void toString(int tabs, java.lang.StringBuilder out)
SplitNode
out
.