|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.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 Icon |
defaultClosedGroupIcon
The default icon used by the state label, if the group realizer is closed. |
static 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, HEXAGON, OCTAGON, PARALLELOGRAM, RECT, RECT_3D, ROUND_RECT, shape, TRAPEZOID, TRAPEZOID_2, TRIANGLE |
| 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 Rectangle2D |
calcMinimumBounds()
Calculates the minimum bounds of this realizer. |
protected Rectangle2D |
calcMinimumGroupBounds()
Calculates the minimal bounding box for the graph elements contained within the associated group node. |
protected Rectangle2D |
calcMinimumInsetBounds()
Calculates the minimum inset bounds of the open group node. |
protected Dimension2D |
calculateMinimalLabelSize()
Calculates the union of the first (text) label and the state label. |
void |
calcUnionRect(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,
Point2D result)
Returns true iff the coord (ix,iy)
is identical with (getCenterX(),getCenterY()) and
the coord (ox,oy), lies outside the bounding box
of this realizer. |
boolean |
findIntersection(double ix,
double iy,
double ox,
double oy,
Point2D result)
Special Intersection handling for some types of shape. |
Insets |
getAutoBoundsInsets()
Returns the currently set auto bounds insets. |
Insets |
getBorderInsets()
Returns the size of the empty border that will be added to the minimal bounds of this realizer. |
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. |
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 the realizer that implements this interface can have. |
Rectangle2D |
getMinimalAutoBounds()
Returns the minimal auto bounds of this object. |
Insets |
getMinimalInsets()
Returns the minimal insets defined for this realizer. |
YDimension |
getMinimumSize()
Returns the minimum size the realizer that implements this interface must have. |
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)
Returns true iff the bounding box of this realizer
intersects with the given box. |
boolean |
isAutoBoundsEnabled()
Returns true if autobounds have been disabled and the realizer is not closed. |
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)
Callback method that should be overwritten by subclasses, that are interested in changes of the realizer label bounds. |
protected void |
paintInnerGraph(Graphics2D gfx)
Used to paints the inner graph of a folder node when innerGraphDisplay is enabled. |
protected void |
paintNode(Graphics2D gfx)
Paints the node. |
protected void |
paintShapeNode(Graphics2D gfx)
Invokes the paintNode method of the ShapeNodeRealizer ancestor
of this realizer. |
void |
paintSloppy(Graphics2D gfx)
Paints the realizer in a cheap, uniform and sloppy way on g. |
void |
paintText(Graphics2D gfx)
Paints the labels that belong to this realizer |
void |
read(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 autobounds feature of this realizer. |
void |
setAutoBoundsInsets(Insets insets)
The same as setBorderInsets(Insets). |
void |
setBorderInsets(Insets inset)
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(Icon icon)
Sets the icon to be used for the state label when the group is closed. |
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(Insets insets)
Sets the insets that define the minimal distance between the border of the group node and its graph content. |
void |
setOpenGroupIcon(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 autosize bounds. |
void |
write(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 Icon defaultClosedGroupIcon
public static final Icon defaultOpenGroupIcon
| Constructor Detail |
|---|
public GroupNodeRealizer()
public GroupNodeRealizer(NodeRealizer arg)
| Method Detail |
|---|
public NodeRealizer createCopy(NodeRealizer arg)
ShapeNodeRealizer
createCopy in class ShapeNodeRealizerpublic Insets getAutoBoundsInsets()
AutoBoundsFeature
getAutoBoundsInsets in interface AutoBoundsFeaturepublic void setAutoBoundsInsets(Insets insets)
setBorderInsets(Insets).
setAutoBoundsInsets in interface AutoBoundsFeaturepublic boolean isAutoBoundsEnabled()
isAutoBoundsEnabled in interface AutoBoundsFeatureisGroupClosed()public void setAutoBoundsEnabled(boolean auto)
setAutoBoundsEnabled in interface AutoBoundsFeaturepublic Rectangle2D getMinimalAutoBounds()
AutoBoundsFeature
getMinimalAutoBounds in interface AutoBoundsFeaturepublic void updateAutoSizeBounds()
public void setMinimalInsets(Insets insets)
15 for each side.
setMinimalInsets in interface GroupFeatureinsets - the insetspublic Insets getMinimalInsets()
getMinimalInsets in interface GroupFeaturesetMinimalInsets(Insets)public void setBorderInsets(Insets inset)
setBorderInsets in interface GroupFeatureinset - the insetspublic Insets getBorderInsets()
getBorderInsets in interface GroupFeaturepublic void setClosedGroupIcon(Icon icon)
getStateLabel(),
isGroupClosed()public void setOpenGroupIcon(Icon icon)
getStateLabel(),
isGroupClosed()public void setGroupClosed(boolean closed)
setGroupClosed in interface GroupFeatureclosed - 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 GroupFeaturetrue if this group node realizer is closed and false
otherwise.public void setInnerGraphDisplayEnabled(boolean enabled)
HierarchyManager.isFolderNode(Node),
isGroupClosed()public boolean isInnerGraphDisplayEnabled()
public void paintSloppy(Graphics2D gfx)
NodeRealizerg. By default this call draws a
rectangle with this realizer's bounds and colors.
No label will be painted.
paintSloppy in class NodeRealizerprotected void paintNode(Graphics2D gfx)
inner graph is painted
if the property is set.
paintNode in class ShapeNodeRealizerisGroupClosed(),
paintShapeNode(java.awt.Graphics2D),
paintInnerGraph(java.awt.Graphics2D)protected void paintShapeNode(Graphics2D gfx)
ShapeNodeRealizer ancestor
of this realizer.
public void paintText(Graphics2D gfx)
NodeRealizer
paintText in class NodeRealizerpublic void setGroupDepthFillColorEnabled(boolean enabled)
public boolean isGroupDepthFillColorEnabled()
setGroupDepthFillColorEnabled(boolean)public void setStateLabel(NodeLabel stateLabel)
public NodeLabel getStateLabel()
public Rectangle2D.Double getBoundingBox()
NodeRealizer
getBoundingBox in class NodeRealizerprotected void recalculateBounds()
protected Rectangle2D calcMinimumInsetBounds()
protected Rectangle2D calcMinimumBounds()
protected Rectangle2D calcMinimumGroupBounds()
protected HierarchyManager getHierarchyManager()
protected boolean isBoundsDirty()
protected void setBoundsDirty()
protected void paintInnerGraph(Graphics2D gfx)
public double getY()
NodeRealizer
getY in interface NodeLayoutgetY in class NodeRealizerpublic double getCenterX()
NodeRealizer
getCenterX in class NodeRealizer
public boolean contains(double x,
double y)
ShapeNodeRealizer
contains in class ShapeNodeRealizertrue if the position (x,y) is part of the node
false otherwise.public double getHeight()
NodeRealizer
getHeight in interface NodeLayoutgetHeight in class NodeRealizerpublic double getX()
NodeRealizer
getX in interface NodeLayoutgetX in class NodeRealizer
public boolean findIntersection(double ix,
double iy,
double ox,
double oy,
Point2D result)
ShapeNodeRealizer
findIntersection in class ShapeNodeRealizerpublic double getWidth()
NodeRealizer
getWidth in interface NodeLayoutgetWidth in class NodeRealizerpublic double getCenterY()
NodeRealizer
getCenterY in class NodeRealizerpublic YDimension getMinimumSize()
SizeConstraintProvider
getMinimumSize in interface SizeConstraintProviderpublic YDimension getMaximumSize()
SizeConstraintProvider
getMaximumSize in interface SizeConstraintProviderprotected Dimension2D calculateMinimalLabelSize()
protected void labelBoundsChanged(NodeLabel label)
NodeRealizerNodeLabel (position or size)
have changed.
labelBoundsChanged in class NodeRealizerlabel - the label whoose bounds have changed.
public boolean intersects(double rx,
double ry,
double rw,
double rh)
NodeRealizertrue iff the bounding box of this realizer
intersects with the given box.
intersects in class NodeRealizerpublic void calcUnionRect(Rectangle2D r)
ShapeNodeRealizer
calcUnionRect in class ShapeNodeRealizer
public boolean findBBIntersection(double ix,
double iy,
double ox,
double oy,
Point2D result)
NodeRealizertrue iff the coord (ix,iy)
is identical with (getCenterX(),getCenterY()) and
the coord (ox,oy), lies outside the bounding box
of this realizer. In that case the intersection point of the
line (ix,iy) - (ox,oy) with the bounding box
of this realizer will be stored in the given point.
findBBIntersection in class NodeRealizer
public void write(ObjectOutputStream out)
throws IOException
ShapeNodeRealizer
write in class ShapeNodeRealizerIOException
public void read(ObjectInputStream in)
throws IOException,
ClassNotFoundException
ShapeNodeRealizerShapeNodeRealizer.write(ObjectOutputStream) method.
read in class ShapeNodeRealizerIOException
ClassNotFoundException
public void setSize(double w,
double h)
ShapeNodeRealizer
setSize in interface NodeLayoutsetSize in class ShapeNodeRealizerw - the width of the node.h - the height of the node.public 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-2008, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||