|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.NodeRealizer y.view.ShapeNodeRealizer y.view.hierarchy.GroupNodeRealizer
public class GroupNodeRealizer
A node realizer that is crafted to represent group and folder nodes within a graph hierarchy.
A GroupNodeRealizer has two main states: it can be either open or closed (isGroupClosed()
).
When being closed, the realizer usually represents a folder node (HierarchyManager.isFolderNode(Node)
).
When being open, the realizer usually represents a group node (HierarchyManager.isGroupNode(Node)
).
The size and location of an open realizer will be determined by the bounds of its child nodes within
the hierarchy (HierarchyManager.getChildren(Node)
).
Nested Class Summary | |
---|---|
static class |
GroupNodeRealizer.StateChangeListener
This static inner class can be used to automatically adjust the groupClosed property of GroupFeature instances. |
Nested classes/interfaces inherited from interface y.view.SizeConstraintProvider |
---|
SizeConstraintProvider.Default |
Field Summary | |
---|---|
static javax.swing.Icon |
defaultClosedGroupIcon
The default icon used by the state label, if the group realizer is closed. |
static javax.swing.Icon |
defaultOpenGroupIcon
The default icon used by the state label, if the group realizer is open. |
Fields inherited from class y.view.ShapeNodeRealizer |
---|
DIAMOND, ELLIPSE, FAT_ARROW, FAT_ARROW_2, HEXAGON, KEY_SLOPPY_RECT_PAINTING, OCTAGON, PARALLELOGRAM, PARALLELOGRAM_2, RECT, RECT_3D, ROUND_RECT, shape, STAR5, STAR6, STAR8, TRAPEZOID, TRAPEZOID_2, TRIANGLE, TRIANGLE_2, VALUE_SLOPPY_RECT_PAINTING_OFF |
Fields inherited from class y.view.NodeRealizer |
---|
height, HOTSPOT_E, HOTSPOT_N, HOTSPOT_NE, HOTSPOT_NONE, HOTSPOT_NW, HOTSPOT_S, HOTSPOT_SE, HOTSPOT_SW, HOTSPOT_W, width, x, y |
Constructor Summary | |
---|---|
GroupNodeRealizer()
|
|
GroupNodeRealizer(NodeRealizer arg)
|
Method Summary | |
---|---|
protected java.awt.geom.Rectangle2D |
calcMinimumBounds()
Calculates the minimum bounds of this realizer. |
protected java.awt.geom.Rectangle2D |
calcMinimumGroupBounds()
Calculates the minimal bounding box for the graph elements contained within the associated group node. |
protected java.awt.geom.Rectangle2D |
calcMinimumInsetBounds()
Calculates the minimum inset bounds of the open group node. |
protected java.awt.geom.Dimension2D |
calculateMinimalLabelSize()
Calculates the union of the first (text) label and the state label. |
void |
calcUnionRect(java.awt.geom.Rectangle2D r)
Enlarges the given rectangle such that it will contain the bounding box of this realizer and the bounding box of the realizer label and its drop shadow. |
boolean |
contains(double x,
double y)
Evaluate hit test on the node realizer. |
NodeRealizer |
createCopy(NodeRealizer arg)
Creates a copy of this realizer type that will be initialized with the values found in the given realizer. |
boolean |
findBBIntersection(double ix,
double iy,
double ox,
double oy,
java.awt.geom.Point2D result)
Calculates the intersection point of a line segment and this realizer's rectangular bounding box. |
boolean |
findIntersection(double ix,
double iy,
double ox,
double oy,
java.awt.geom.Point2D result)
Special Intersection handling for some types of shape. |
YInsets |
getAutoBoundsInsets()
Returns the auto bounds insets. |
YInsets |
getBorderInsets()
Returns the size of the empty border that will be added to the minimal bounds of this realizer. |
java.awt.geom.Rectangle2D.Double |
getBoundingBox()
Return the bounding box of this realizer. |
double |
getCenterX()
Get X-Coordinate of the center of the node. |
double |
getCenterY()
Get Y-Coordinate of the center of the node. |
javax.swing.Icon |
getClosedGroupIcon()
Returns the state icon that is displayed when the group is closed. |
double |
getClosedHeight()
Returns the height for the realizer's closed state. |
double |
getClosedWidth()
Returns the width for the realizer's closed state. |
double |
getHeight()
Returns the height of this realizer. |
protected HierarchyManager |
getHierarchyManager()
Returns the hierarchy manager responsibly for managing the node represented by this realizer. |
YDimension |
getMaximumSize()
Returns the maximum size of the realizer. |
java.awt.geom.Rectangle2D |
getMinimalAutoBounds()
Returns the minimal auto bounds of this object. |
YInsets |
getMinimalInsets()
Returns the minimal insets defined for this realizer. |
YDimension |
getMinimumSize()
Returns the minimum size of the realizer. |
javax.swing.Icon |
getOpenGroupIcon()
Returns the state icon that is displayed when the group is open. |
NodeLabel |
getStateLabel()
Returns the state label of this realizer. |
double |
getWidth()
Returns the width of this realizer. |
double |
getX()
Get X-Coordinate of the upper left corner of the node. |
double |
getY()
Get Y-Coordinate of the upper left corner of the node. |
boolean |
intersects(double rx,
double ry,
double rw,
double rh)
Determines whether or not the bounding box of this realizer intersects the specified rectangle. |
boolean |
isAutoBoundsEnabled()
Returns true |
boolean |
isAutoResize()
Returns whether or not automatic bounds calculation is enabled. |
protected boolean |
isBoundsDirty()
Returns whether or not the bounds of a group node need to be recalculated. |
boolean |
isConsiderNodeLabelSize()
Returns whether label sizes will be taken into account when calculating the minimal node bounds. |
boolean |
isGroupClosed()
Returns true if this group node realizer is closed and false
otherwise. |
boolean |
isGroupDepthFillColorEnabled()
Whether or not the fill color of this node gets adapted to reflect the local group depth of this node within the graph hierarchy. |
boolean |
isInnerGraphDisplayEnabled()
Returns whether or not the inner graph of a folder node should be displayed. |
protected void |
labelBoundsChanged(NodeLabel label)
Calls setBoundsDirty() . |
protected void |
paintGroupState(java.awt.Graphics2D gfx,
boolean sloppy)
Paints an icon representing this realizer's group state. |
protected void |
paintInnerGraph(java.awt.Graphics2D gfx)
Used to paint the inner graph of a folder node when innerGraphDisplay is enabled. |
protected void |
paintNode(java.awt.Graphics2D gfx)
Paints the node. |
protected void |
paintShapeNode(java.awt.Graphics2D gfx)
Calls ShapeNodeRealizer.paintNode(java.awt.Graphics2D) . |
void |
paintSloppy(java.awt.Graphics2D gfx)
Paints the realizer in a cheap, uniform and sloppy way on g . |
void |
read(java.io.ObjectInputStream in)
Reads in the serialized form of this realizer. |
protected void |
recalculateBounds()
Recalculates the bounds of a group node. |
void |
setAutoBoundsEnabled(boolean auto)
Enabled or disables the automatic bounds calculation feature of this realizer. |
void |
setAutoBoundsInsets(java.awt.Insets insets)
Deprecated. Use setAutoBoundsInsets(y.geom.YInsets) instead. |
void |
setAutoBoundsInsets(YInsets insets)
Sets auto bounds insets. |
void |
setBorderInsets(java.awt.Insets insets)
Deprecated. Use setBorderInsets(y.geom.YInsets) instead. |
void |
setBorderInsets(YInsets insets)
Sets the size of the empty border that will be added to the minimal bounds of this realizer. |
protected void |
setBoundsDirty()
Invalidates the bounds of this realizer. |
void |
setClosedGroupIcon(javax.swing.Icon icon)
Sets the icon to be used for the state label when the group is closed. |
void |
setClosedHeight(double closedHeight)
Sets the height for of this realizer in its closed
state. |
void |
setClosedWidth(double closedWidth)
Sets the width for of this realizer in its closed
state. |
void |
setConsiderNodeLabelSize(boolean considerNodeLabelSize)
Whether label sizes shall be taken into account when calculating the minimal node bounds. |
void |
setGroupClosed(boolean closed)
Opens or closes the group node realizer. |
void |
setGroupDepthFillColorEnabled(boolean enabled)
Whether or not the fill color of this node should be adapted to reflect the local group depth of this node within the graph hierarchy. |
void |
setInnerGraphDisplayEnabled(boolean enabled)
Sets whether or not the inner graph of a folder node should be displayed. |
void |
setMinimalInsets(java.awt.Insets insets)
Deprecated. Use setMinimalInsets(y.geom.YInsets) instead. |
void |
setMinimalInsets(YInsets insets)
Sets the insets that define the minimal distance between the border of the group node and its graph content. |
void |
setOpenGroupIcon(javax.swing.Icon icon)
Sets the icon to be used for the state label when the group is open. |
void |
setSize(double w,
double h)
Sets the size of the realizer. |
void |
setStateLabel(NodeLabel stateLabel)
Sets the state label of this realizer. |
void |
updateAutoSizeBounds()
Forces recalculation of the realizer's bounds. |
void |
write(java.io.ObjectOutputStream out)
Writes this realizer in a serialized form to the given stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final javax.swing.Icon defaultClosedGroupIcon
public static final javax.swing.Icon defaultOpenGroupIcon
Constructor Detail |
---|
public GroupNodeRealizer()
public GroupNodeRealizer(NodeRealizer arg)
Method Detail |
---|
public NodeRealizer createCopy(NodeRealizer arg)
ShapeNodeRealizer
createCopy
in class ShapeNodeRealizer
arg
- the prototype realizer whose attributes will be copied.public YInsets getAutoBoundsInsets()
getAutoBoundsInsets
in interface AutoBoundsFeature
setAutoBoundsInsets(y.geom.YInsets)
public void setAutoBoundsInsets(java.awt.Insets insets)
setAutoBoundsInsets(y.geom.YInsets)
instead.
insets
- the insets to add to the minimal auto bounds.public void setAutoBoundsInsets(YInsets insets)
setBorderInsets(insets);
setAutoBoundsInsets
in interface AutoBoundsFeature
insets
- the insets to add to the minimal auto bounds.setBorderInsets(y.geom.YInsets)
,
getAutoBoundsInsets()
public boolean isAutoBoundsEnabled()
true if automatic bounds calculation is enabled and the
realizer is not closed and false
otherwise.
- Specified by:
isAutoBoundsEnabled
in interface AutoBoundsFeature
- See Also:
isGroupClosed()
public void setAutoBoundsEnabled(boolean auto)
setAutoBoundsEnabled
in interface AutoBoundsFeature
public java.awt.geom.Rectangle2D getMinimalAutoBounds()
AutoBoundsFeature
getMinimalAutoBounds
in interface AutoBoundsFeature
public void updateAutoSizeBounds()
recalculateBounds()
.
public void setMinimalInsets(java.awt.Insets insets)
setMinimalInsets(y.geom.YInsets)
instead.
insets
- the insets to use.setMinimalInsets(y.geom.YInsets)
public void setMinimalInsets(YInsets insets)
By default the insets are set to 15
for each side.
setMinimalInsets
in interface GroupFeature
insets
- the insets to use.getMinimalInsets()
public YInsets getMinimalInsets()
getMinimalInsets
in interface GroupFeature
setMinimalInsets(YInsets)
public void setBorderInsets(java.awt.Insets insets)
setBorderInsets(y.geom.YInsets)
instead.
insets
- the insets to add to the minimal bounds.public void setBorderInsets(YInsets insets)
setBorderInsets
in interface GroupFeature
insets
- the insets to add to the minimal bounds.getBorderInsets()
public YInsets getBorderInsets()
getBorderInsets
in interface GroupFeature
setBorderInsets(y.geom.YInsets)
public javax.swing.Icon getClosedGroupIcon()
setClosedGroupIcon(javax.swing.Icon)
,
getStateLabel()
,
isGroupClosed()
public void setClosedGroupIcon(javax.swing.Icon icon)
icon
- the state icon that is displayed when the group is closed.getClosedGroupIcon()
,
getStateLabel()
,
isGroupClosed()
public javax.swing.Icon getOpenGroupIcon()
setOpenGroupIcon(javax.swing.Icon)
,
getStateLabel()
,
isGroupClosed()
public void setOpenGroupIcon(javax.swing.Icon icon)
icon
- the state icon that is displayed when the group is open.getOpenGroupIcon()
,
getStateLabel()
,
isGroupClosed()
public double getClosedWidth()
setClosedWidth(double)
public void setClosedWidth(double closedWidth)
closed
state.
Note: Changing from closed to open state will
set closedWidth
to the width of the realizer right before
changing state.
Changing from open to closed state will possibly update
closedWidth
to respect minimum width constraints of
an associated SizeConstraintProvider
.
closedWidth
- the width for the closed state of the realizer.isGroupClosed()
,
setGroupClosed(boolean)
public double getClosedHeight()
setClosedHeight(double)
public void setClosedHeight(double closedHeight)
closed
state.
Note: Changing from closed to open state will
set closedHeight
to the height of the realizer right before
changing state.
Changing from open to closed state will possibly update
closedHeight
to respect minimum height constraints of
an associated SizeConstraintProvider
.
closedHeight
- the height for the closed state of the realizer.isGroupClosed()
,
setGroupClosed(boolean)
public void setGroupClosed(boolean closed)
setGroupClosed
in interface GroupFeature
closed
- true
for closing, false
for opening a group nodeHierarchyManager.isGroupNode(Node)
,
HierarchyManager.isFolderNode(Node)
public boolean isGroupClosed()
true
if this group node realizer is closed and false
otherwise.
isGroupClosed
in interface GroupFeature
true
if this group node realizer is closed and false
otherwise.public void setInnerGraphDisplayEnabled(boolean enabled)
By default, this feature is disabled.
enabled
- if true
the inner graph of a folder node is
displayed.isInnerGraphDisplayEnabled()
,
HierarchyManager.isFolderNode(Node)
,
isGroupClosed()
public boolean isInnerGraphDisplayEnabled()
By default, this feature is disabled.
true
if the inner graph of a folder node is displayed;
false
otherwise.setInnerGraphDisplayEnabled(boolean)
,
HierarchyManager.isFolderNode(Node)
,
isGroupClosed()
public boolean isAutoResize()
Note: Use method setAutoBoundsEnabled(boolean)
to
enable or disable automatic bounds calculation.
public void paintSloppy(java.awt.Graphics2D gfx)
NodeRealizer
g
. By default this call draws a
rectangle with this realizer's bounds and colors.
No label will be painted.
paintSloppy
in class NodeRealizer
protected void paintNode(java.awt.Graphics2D gfx)
inner graph is painted
if the property
is set.
paintNode
in class ShapeNodeRealizer
isGroupClosed()
,
paintShapeNode(java.awt.Graphics2D)
,
paintInnerGraph(java.awt.Graphics2D)
protected void paintGroupState(java.awt.Graphics2D gfx, boolean sloppy)
paintNode(java.awt.Graphics2D)
and
paintSloppy(java.awt.Graphics2D)
.
The default implementation calls the state label's
paint
method.
gfx
- the graphics context to use.sloppy
- whether or not to paint in sloppy mode.protected void paintShapeNode(java.awt.Graphics2D gfx)
ShapeNodeRealizer.paintNode(java.awt.Graphics2D)
.
gfx
- the graphics context to paint upon.public void setGroupDepthFillColorEnabled(boolean enabled)
By default this feature is enabled.
enabled
- if true
, the greater the local group depth
of a group node, the darker its fill color; if false
, the
local group depth does not influence the node's fill color.isGroupDepthFillColorEnabled()
,
HierarchyManager.getLocalGroupDepth(y.base.Node)
public boolean isGroupDepthFillColorEnabled()
By default this feature is enabled.
true
if the local group depth influences the fill
color of the node; false
otherwise.setGroupDepthFillColorEnabled(boolean)
,
HierarchyManager.getLocalGroupDepth(y.base.Node)
public void setStateLabel(NodeLabel stateLabel)
stateLabel
- the label used to display the group state.public NodeLabel getStateLabel()
public java.awt.geom.Rectangle2D.Double getBoundingBox()
NodeRealizer
getBoundingBox
in class NodeRealizer
protected void recalculateBounds()
protected java.awt.geom.Rectangle2D calcMinimumInsetBounds()
protected java.awt.geom.Rectangle2D calcMinimumBounds()
protected java.awt.geom.Rectangle2D calcMinimumGroupBounds()
protected HierarchyManager getHierarchyManager()
HierarchyManager
instance for the graph hierarchy
of the realizer's associated group node.protected boolean isBoundsDirty()
true
if the realizer's bounds need to be recalculated;
false
otherwise.protected void setBoundsDirty()
protected void paintInnerGraph(java.awt.Graphics2D gfx)
gfx
- the graphics context to paint upon.public double getY()
NodeRealizer
getY
in interface NodeLayout
getY
in class NodeRealizer
NodeRealizer.getCenterY()
public double getCenterX()
NodeRealizer
getCenterX
in class NodeRealizer
NodeRealizer.getX()
public boolean contains(double x, double y)
ShapeNodeRealizer
contains
in class ShapeNodeRealizer
x
- the x-coordinate of the point to check.y
- the y-coordinate of the point to check.
true
if the position (x,y) is part of the node
false
otherwise.public double getHeight()
NodeRealizer
getHeight
in interface NodeLayout
getHeight
in class NodeRealizer
public double getX()
NodeRealizer
getX
in interface NodeLayout
getX
in class NodeRealizer
NodeRealizer.getCenterX()
public boolean findIntersection(double ix, double iy, double ox, double oy, java.awt.geom.Point2D result)
ShapeNodeRealizer
findIntersection
in class ShapeNodeRealizer
ix
- the x-coordinate of a point inside the realizer's visual
bounds.iy
- the y-coordinate of a point inside the realizer's visual
bounds.ox
- the x-coordinate of a point outside the realizer's visual
bounds.oy
- the y-coordinate of a point outside the realizer's visual
bounds.result
- output parameter for the absolute world coordinates of the
calculated intersection point.
true
if (ix,iy)
lies inside and
(ox,oy)
lies outside this realizer's visual bounds;
false
otherwise.NodeRealizer.contains(double, double)
public double getWidth()
NodeRealizer
getWidth
in interface NodeLayout
getWidth
in class NodeRealizer
public double getCenterY()
NodeRealizer
getCenterY
in class NodeRealizer
NodeRealizer.getY()
public YDimension getMinimumSize()
getMinimumSize
in interface SizeConstraintProvider
public YDimension getMaximumSize()
getMaximumSize
in interface SizeConstraintProvider
protected java.awt.geom.Dimension2D calculateMinimalLabelSize()
protected void labelBoundsChanged(NodeLabel label)
setBoundsDirty()
.
labelBoundsChanged
in class NodeRealizer
label
- the label whose bounds have changed.public boolean intersects(double rx, double ry, double rw, double rh)
NodeRealizer
intersects
in class NodeRealizer
rx
- the smallest x-coordinate of the rectangle to check.ry
- the smallest y-coordinate of the rectangle to check.rw
- the width of the rectangle to check.rh
- the height of the rectangle to check.
true
if the bounding box of this realizer
intersects the specified rectangle; false
otherwise.public void calcUnionRect(java.awt.geom.Rectangle2D r)
ShapeNodeRealizer
calcUnionRect
in class ShapeNodeRealizer
public boolean findBBIntersection(double ix, double iy, double ox, double oy, java.awt.geom.Point2D result)
NodeRealizer
true
if and only if the coordinates
(ix,iy)
are identical to
(NodeRealizer.getCenterX()
,NodeRealizer.getCenterY()
)
and the
coordinates (ox,oy)
lie outside this realizer's
rectangular bounding box. In this case, the absolute coordinates of the
intersection point of line segment (ix,iy) - (ox,oy)
and this realizer's rectangular bounding box are stored in the given
Point2D
instance.
findBBIntersection
in class NodeRealizer
ix
- the x-coordinate of a point inside the realizer's
rectangular bounding box. Must equal NodeRealizer.getCenterX()
.iy
- the y-coordinate of a point inside the realizer's
rectangular bounding box. Must equal NodeRealizer.getCenterY()
.ox
- the x-coordinate of a point outside the realizer's
rectangular bounding box.oy
- the y-coordinate of a point outside the realizer's
rectangular bounding box.result
- output parameter for the absolute world coordinates of the
calculated intersection point.
true
if (ix,iy)
is the center of this
realizer's rectangular bounding box and (ox,oy)
lies outside
this realizer's rectangular bounding box; false
otherwise.NodeRealizer.findIntersection(double, double, double, double, java.awt.geom.Point2D)
public void write(java.io.ObjectOutputStream out) throws java.io.IOException
ShapeNodeRealizer
write
in class ShapeNodeRealizer
java.io.IOException
public void read(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
ShapeNodeRealizer
ShapeNodeRealizer.write(ObjectOutputStream)
method.
read
in class ShapeNodeRealizer
java.io.IOException
java.lang.ClassNotFoundException
public void setSize(double w, double h)
ShapeNodeRealizer
setSize
in interface NodeLayout
setSize
in class ShapeNodeRealizer
w
- the new width of the nodeh
- the new height of the nodepublic boolean isConsiderNodeLabelSize()
calculateMinimalLabelSize()
determines which labels are taken into account.
By default this is the first text label and the state label.
By default this option is set to false.
public void setConsiderNodeLabelSize(boolean considerNodeLabelSize)
calculateMinimalLabelSize()
determines which labels are taken into account.
By default this is the first text label and the state label.
By default this option is set to false.
considerNodeLabelSize
- whether node label sizes shall be considered when recalculating the group node's
bounds. By default this is set to false.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |