Search this API

y.view.hierarchy
Class GroupNodeRealizer

java.lang.Object
  extended by y.view.NodeRealizer
      extended by y.view.ShapeNodeRealizer
          extended by y.view.hierarchy.GroupNodeRealizer
All Implemented Interfaces:
NodeLayout, AutoBoundsFeature, GroupFeature, SizeConstraintProvider

public class GroupNodeRealizer
extends ShapeNodeRealizer
implements AutoBoundsFeature, GroupFeature, SizeConstraintProvider

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 if automatic bounds calculation is enabled and the realizer is not closed and false otherwise.
 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 y.view.ShapeNodeRealizer
createSelectionColor, getDropShadowColor, getDropShadowOffsetX, getDropShadowOffsetY, getShapeType, hotSpotHit, isDropShadowVisible, isRaisedBorderEnabled, moveBy, paint3DBorder, paintFilledShape, paintHotSpots, paintShadow, paintShapeBorder, setCenter, setDropShadowColor, setDropShadowOffsetX, setDropShadowOffsetY, setLocation, setRaisedBorderEnabled, setShapeType, shapeTypeToStringMap
 
Methods inherited from class y.view.NodeRealizer
addLabel, addPort, boundsChanged, calcUnionRect, calcUnionRectImpl, calcUnionRectLabels, calcUnionRectPorts, createCopy, createNodeLabel, getAutoBoundsFeature, getFillColor, getFillColor2, getHotSpotColor, getLabel, getLabel, getLabelText, getLayer, getLineColor, getLineType, getMouseInputEditorProvider, getNode, getPort, getPortCandidates, getSizeConstraintProvider, getSloppySelectionColor, invalidatePortPositions, isInBox, isSelected, isTransparent, isVisible, labelCount, paint, paintLayer, paintLayerSloppy, paintPorts, paintText, portCount, removeLabel, removeLabel, removePort, removePort, repaint, setCenterX, setCenterY, setEdgesDirty, setFillColor, setFillColor2, setFrame, setFrame, setHeight, setHotSpotColor, setLabel, setLabelText, setLayer, setLayer, setLineColor, setLineType, setSelected, setSloppySelectionColor, setTransparent, setVisible, setWidth, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultClosedGroupIcon

public static final javax.swing.Icon defaultClosedGroupIcon
The default icon used by the state label, if the group realizer is closed.


defaultOpenGroupIcon

public static final javax.swing.Icon defaultOpenGroupIcon
The default icon used by the state label, if the group realizer is open.

Constructor Detail

GroupNodeRealizer

public GroupNodeRealizer()

GroupNodeRealizer

public GroupNodeRealizer(NodeRealizer arg)
Method Detail

createCopy

public NodeRealizer createCopy(NodeRealizer arg)
Description copied from class: ShapeNodeRealizer
Creates a copy of this realizer type that will be initialized with the values found in the given realizer.

Overrides:
createCopy in class ShapeNodeRealizer
Parameters:
arg - the prototype realizer whose attributes will be copied.

getAutoBoundsInsets

public YInsets getAutoBoundsInsets()
Returns the auto bounds insets. These insets are calculated depending on the position of the realizer's default label.

Specified by:
getAutoBoundsInsets in interface AutoBoundsFeature
Returns:
the auto bounds insets.
See Also:
setAutoBoundsInsets(y.geom.YInsets)

setAutoBoundsInsets

public void setAutoBoundsInsets(java.awt.Insets insets)
Deprecated. Use setAutoBoundsInsets(y.geom.YInsets) instead.

Sets auto bounds insets. The specified insets will be added to the minimal auto bounds.

Parameters:
insets - the insets to add to the minimal auto bounds.

setAutoBoundsInsets

public void setAutoBoundsInsets(YInsets insets)
Sets auto bounds insets. The specified insets will be added to the minimal auto bounds. Invoking this method is equivalent to:
setBorderInsets(insets);

Specified by:
setAutoBoundsInsets in interface AutoBoundsFeature
Parameters:
insets - the insets to add to the minimal auto bounds.
See Also:
setBorderInsets(y.geom.YInsets), getAutoBoundsInsets()

isAutoBoundsEnabled

public boolean isAutoBoundsEnabled()
Returns 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()

setAutoBoundsEnabled

public void setAutoBoundsEnabled(boolean auto)
Enabled or disables the automatic bounds calculation feature of this realizer. The feature should be enabled when the realizer represents a open group and disabled when the realizer represents a closed folder.

If this feature is enabled and the realizer represents a group node in a graph hierarchy, then bounds of this realizer will be mainly determined by the bounds of the children of the underlying group node.

When turning this feature on, the bounds and the border of this node will change. The new bounds will be the union of the currently set bounds and the minimal bounds dictated by the children of the underlying group node. The new border will be set to represent the part of the new bounds that surmounts the previously set bounds.

Specified by:
setAutoBoundsEnabled in interface AutoBoundsFeature

getMinimalAutoBounds

public java.awt.geom.Rectangle2D getMinimalAutoBounds()
Description copied from interface: AutoBoundsFeature
Returns the minimal auto bounds of this object.

Specified by:
getMinimalAutoBounds in interface AutoBoundsFeature

updateAutoSizeBounds

public void updateAutoSizeBounds()
Forces recalculation of the realizer's bounds. Calls recalculateBounds().


setMinimalInsets

public void setMinimalInsets(java.awt.Insets insets)
Deprecated. Use setMinimalInsets(y.geom.YInsets) instead.

Sets the insets that define the minimal distance between the border of the group node and its graph content.

Parameters:
insets - the insets to use.
See Also:
setMinimalInsets(y.geom.YInsets)

setMinimalInsets

public void setMinimalInsets(YInsets insets)
Sets the insets that define the minimal distance between the border of the group node and its graph content.

By default the insets are set to 15 for each side.

Specified by:
setMinimalInsets in interface GroupFeature
Parameters:
insets - the insets to use.
See Also:
getMinimalInsets()

getMinimalInsets

public YInsets getMinimalInsets()
Returns the minimal insets defined for this realizer.

Specified by:
getMinimalInsets in interface GroupFeature
Returns:
the minimal insets defined for this realizer.
See Also:
setMinimalInsets(YInsets)

setBorderInsets

public void setBorderInsets(java.awt.Insets insets)
Deprecated. Use setBorderInsets(y.geom.YInsets) instead.

Sets the size of the empty border that will be added to the minimal bounds of this realizer.

Parameters:
insets - the insets to add to the minimal bounds.

setBorderInsets

public void setBorderInsets(YInsets insets)
Sets the size of the empty border that will be added to the minimal bounds of this realizer.

Specified by:
setBorderInsets in interface GroupFeature
Parameters:
insets - the insets to add to the minimal bounds.
See Also:
getBorderInsets()

getBorderInsets

public YInsets getBorderInsets()
Returns the size of the empty border that will be added to the minimal bounds of this realizer.

Specified by:
getBorderInsets in interface GroupFeature
Returns:
the size of the empty border that will be added to the minimal bounds of this realizer.
See Also:
setBorderInsets(y.geom.YInsets)

getClosedGroupIcon

public javax.swing.Icon getClosedGroupIcon()
Returns the state icon that is displayed when the group is closed.

Returns:
the state icon that is displayed when the group is closed.
See Also:
setClosedGroupIcon(javax.swing.Icon), getStateLabel(), isGroupClosed()

setClosedGroupIcon

public void setClosedGroupIcon(javax.swing.Icon icon)
Sets the icon to be used for the state label when the group is closed.

Parameters:
icon - the state icon that is displayed when the group is closed.
See Also:
getClosedGroupIcon(), getStateLabel(), isGroupClosed()

getOpenGroupIcon

public javax.swing.Icon getOpenGroupIcon()
Returns the state icon that is displayed when the group is open.

Returns:
the state icon that is displayed when the group is open.
See Also:
setOpenGroupIcon(javax.swing.Icon), getStateLabel(), isGroupClosed()

setOpenGroupIcon

public void setOpenGroupIcon(javax.swing.Icon icon)
Sets the icon to be used for the state label when the group is open.

Parameters:
icon - the state icon that is displayed when the group is open.
See Also:
getOpenGroupIcon(), getStateLabel(), isGroupClosed()

getClosedWidth

public double getClosedWidth()
Returns the width for the realizer's closed state.

Returns:
the width for the realizer's closed state.
See Also:
setClosedWidth(double)

setClosedWidth

public void setClosedWidth(double closedWidth)
Sets the width for of this realizer in its 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.

Parameters:
closedWidth - the width for the closed state of the realizer.
See Also:
isGroupClosed(), setGroupClosed(boolean)

getClosedHeight

public double getClosedHeight()
Returns the height for the realizer's closed state.

Returns:
the height for the realizer's closed state.
See Also:
setClosedHeight(double)

setClosedHeight

public void setClosedHeight(double closedHeight)
Sets the height for of this realizer in its 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.

Parameters:
closedHeight - the height for the closed state of the realizer.
See Also:
isGroupClosed(), setGroupClosed(boolean)

setGroupClosed

public void setGroupClosed(boolean closed)
Opens or closes the group node realizer. An open node realizer is typically used to represent a group node within a graph hierarchy. A closed node realizer is usually serves as a representation of a folder node within a graph hierarchy.

Specified by:
setGroupClosed in interface GroupFeature
Parameters:
closed - true for closing, false for opening a group node
See Also:
HierarchyManager.isGroupNode(Node), HierarchyManager.isFolderNode(Node)

isGroupClosed

public boolean isGroupClosed()
Returns true if this group node realizer is closed and false otherwise.

Specified by:
isGroupClosed in interface GroupFeature
Returns:
true if this group node realizer is closed and false otherwise.

setInnerGraphDisplayEnabled

public void setInnerGraphDisplayEnabled(boolean enabled)
Sets whether or not the inner graph of a folder node should be displayed. The node represented by this realizer must be a folder node in the graph hierarchy and the realizer must be in closed mode.

By default, this feature is disabled.

Parameters:
enabled - if true the inner graph of a folder node is displayed.
See Also:
isInnerGraphDisplayEnabled(), HierarchyManager.isFolderNode(Node), isGroupClosed()

isInnerGraphDisplayEnabled

public boolean isInnerGraphDisplayEnabled()
Returns whether or not the inner graph of a folder node should be displayed.

By default, this feature is disabled.

Returns:
true if the inner graph of a folder node is displayed; false otherwise.
See Also:
setInnerGraphDisplayEnabled(boolean), HierarchyManager.isFolderNode(Node), isGroupClosed()

isAutoResize

public boolean isAutoResize()
Returns whether or not automatic bounds calculation is enabled.

Note: Use method setAutoBoundsEnabled(boolean) to enable or disable automatic bounds calculation.


paintSloppy

public void paintSloppy(java.awt.Graphics2D gfx)
Description copied from class: NodeRealizer
Paints the realizer in a cheap, uniform and sloppy way on g. By default this call draws a rectangle with this realizer's bounds and colors. No label will be painted.

Overrides:
paintSloppy in class NodeRealizer

paintNode

protected void paintNode(java.awt.Graphics2D gfx)
Paints the node. The way this realizer is painted strongly depends upon its open/closed state. For closed groups (aka folders) the inner graph is painted if the property is set.

Overrides:
paintNode in class ShapeNodeRealizer
See Also:
isGroupClosed(), paintShapeNode(java.awt.Graphics2D), paintInnerGraph(java.awt.Graphics2D)

paintGroupState

protected void paintGroupState(java.awt.Graphics2D gfx,
                               boolean sloppy)
Paints an icon representing this realizer's group state. Called from paintNode(java.awt.Graphics2D) and paintSloppy(java.awt.Graphics2D). The default implementation calls the state label's paint method.

Parameters:
gfx - the graphics context to use.
sloppy - whether or not to paint in sloppy mode.

paintShapeNode

protected void paintShapeNode(java.awt.Graphics2D gfx)
Calls ShapeNodeRealizer.paintNode(java.awt.Graphics2D).

Parameters:
gfx - the graphics context to paint upon.

setGroupDepthFillColorEnabled

public 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.

By default this feature is enabled.

Parameters:
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.
See Also:
isGroupDepthFillColorEnabled(), HierarchyManager.getLocalGroupDepth(y.base.Node)

isGroupDepthFillColorEnabled

public 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.

By default this feature is enabled.

Returns:
true if the local group depth influences the fill color of the node; false otherwise.
See Also:
setGroupDepthFillColorEnabled(boolean), HierarchyManager.getLocalGroupDepth(y.base.Node)

setStateLabel

public void setStateLabel(NodeLabel stateLabel)
Sets the state label of this realizer. A state label is typically used to display a button that allows to change the state (group or folder) of the node within the graph hierarchy.

Parameters:
stateLabel - the label used to display the group state.

getStateLabel

public NodeLabel getStateLabel()
Returns the state label of this realizer.

Returns:
the state label of this realizer.

getBoundingBox

public java.awt.geom.Rectangle2D.Double getBoundingBox()
Description copied from class: NodeRealizer
Return the bounding box of this realizer. The bounding box does not necessarily contain the bounding box of the realizer label.

Overrides:
getBoundingBox in class NodeRealizer

recalculateBounds

protected void recalculateBounds()
Recalculates the bounds of a group node.


calcMinimumInsetBounds

protected java.awt.geom.Rectangle2D calcMinimumInsetBounds()
Calculates the minimum inset bounds of the open group node. The minimum inset bounds are composed of the minimum group bounds plus additional insets.


calcMinimumBounds

protected java.awt.geom.Rectangle2D calcMinimumBounds()
Calculates the minimum bounds of this realizer.


calcMinimumGroupBounds

protected java.awt.geom.Rectangle2D calcMinimumGroupBounds()
Calculates the minimal bounding box for the graph elements contained within the associated group node.

Returns:
the smallest rectangle containing all child elements of the associated group node.

getHierarchyManager

protected HierarchyManager getHierarchyManager()
Returns the hierarchy manager responsibly for managing the node represented by this realizer.

Returns:
the HierarchyManager instance for the graph hierarchy of the realizer's associated group node.

isBoundsDirty

protected boolean isBoundsDirty()
Returns whether or not the bounds of a group node need to be recalculated.

Returns:
true if the realizer's bounds need to be recalculated; false otherwise.

setBoundsDirty

protected void setBoundsDirty()
Invalidates the bounds of this realizer.


paintInnerGraph

protected void paintInnerGraph(java.awt.Graphics2D gfx)
Used to paint the inner graph of a folder node when innerGraphDisplay is enabled.

Parameters:
gfx - the graphics context to paint upon.

getY

public double getY()
Description copied from class: NodeRealizer
Get Y-Coordinate of the upper left corner of the node.

Specified by:
getY in interface NodeLayout
Overrides:
getY in class NodeRealizer
Returns:
the y-coordinate of the node
See Also:
NodeRealizer.getCenterY()

getCenterX

public double getCenterX()
Description copied from class: NodeRealizer
Get X-Coordinate of the center of the node.

Overrides:
getCenterX in class NodeRealizer
See Also:
NodeRealizer.getX()

contains

public boolean contains(double x,
                        double y)
Description copied from class: ShapeNodeRealizer
Evaluate hit test on the node realizer. When a node is transparent, only its boundary is evaluated for the hit test.

Overrides:
contains in class ShapeNodeRealizer
Parameters:
x - the x-coordinate of the point to check.
y - the y-coordinate of the point to check.
Returns:
true if the position (x,y) is part of the node false otherwise.

getHeight

public double getHeight()
Description copied from class: NodeRealizer
Returns the height of this realizer.

Specified by:
getHeight in interface NodeLayout
Overrides:
getHeight in class NodeRealizer
Returns:
the height of the node

getX

public double getX()
Description copied from class: NodeRealizer
Get X-Coordinate of the upper left corner of the node.

Specified by:
getX in interface NodeLayout
Overrides:
getX in class NodeRealizer
Returns:
the x-coordinate of the node
See Also:
NodeRealizer.getCenterX()

findIntersection

public boolean findIntersection(double ix,
                                double iy,
                                double ox,
                                double oy,
                                java.awt.geom.Point2D result)
Description copied from class: ShapeNodeRealizer
Special Intersection handling for some types of shape. When shape is an ellipse or an rectangle, the intersection point is calculated, not iteratively determined.

Overrides:
findIntersection in class ShapeNodeRealizer
Parameters:
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.
Returns:
true if (ix,iy) lies inside and (ox,oy) lies outside this realizer's visual bounds; false otherwise.
See Also:
NodeRealizer.contains(double, double)

getWidth

public double getWidth()
Description copied from class: NodeRealizer
Returns the width of this realizer.

Specified by:
getWidth in interface NodeLayout
Overrides:
getWidth in class NodeRealizer
Returns:
the width of the node

getCenterY

public double getCenterY()
Description copied from class: NodeRealizer
Get Y-Coordinate of the center of the node.

Overrides:
getCenterY in class NodeRealizer
See Also:
NodeRealizer.getY()

getMinimumSize

public YDimension getMinimumSize()
Returns the minimum size of the realizer.

Specified by:
getMinimumSize in interface SizeConstraintProvider
Returns:
the minimum size of the realizer.

getMaximumSize

public YDimension getMaximumSize()
Returns the maximum size of the realizer.

Specified by:
getMaximumSize in interface SizeConstraintProvider
Returns:
the maximum size of the realizer.

calculateMinimalLabelSize

protected java.awt.geom.Dimension2D calculateMinimalLabelSize()
Calculates the union of the first (text) label and the state label. This method can simply be overwritten if more labels shall be taken into account.

Returns:
the maximum label dimension the first text label and the state label do need.

labelBoundsChanged

protected void labelBoundsChanged(NodeLabel label)
Calls setBoundsDirty().

Overrides:
labelBoundsChanged in class NodeRealizer
Parameters:
label - the label whose bounds have changed.

intersects

public boolean intersects(double rx,
                          double ry,
                          double rw,
                          double rh)
Description copied from class: NodeRealizer
Determines whether or not the bounding box of this realizer intersects the specified rectangle.

Overrides:
intersects in class NodeRealizer
Parameters:
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.
Returns:
true if the bounding box of this realizer intersects the specified rectangle; false otherwise.

calcUnionRect

public void calcUnionRect(java.awt.geom.Rectangle2D r)
Description copied from class: ShapeNodeRealizer
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.

Overrides:
calcUnionRect in class ShapeNodeRealizer

findBBIntersection

public boolean findBBIntersection(double ix,
                                  double iy,
                                  double ox,
                                  double oy,
                                  java.awt.geom.Point2D result)
Description copied from class: NodeRealizer
Calculates the intersection point of a line segment and this realizer's rectangular bounding box. This method returns 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.

Overrides:
findBBIntersection in class NodeRealizer
Parameters:
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.
Returns:
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.
See Also:
NodeRealizer.findIntersection(double, double, double, double, java.awt.geom.Point2D)

write

public void write(java.io.ObjectOutputStream out)
           throws java.io.IOException
Description copied from class: ShapeNodeRealizer
Writes this realizer in a serialized form to the given stream.

Overrides:
write in class ShapeNodeRealizer
Throws:
java.io.IOException

read

public void read(java.io.ObjectInputStream in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException
Description copied from class: ShapeNodeRealizer
Reads in the serialized form of this realizer. The realizer must have been written out before by it's ShapeNodeRealizer.write(ObjectOutputStream) method.

Overrides:
read in class ShapeNodeRealizer
Throws:
java.io.IOException
java.lang.ClassNotFoundException

setSize

public void setSize(double w,
                    double h)
Description copied from class: ShapeNodeRealizer
Sets the size of the realizer. Note that this method resizes the node in a way that the center location of this realizer won't change. The upper left corner of this realizer *will* change though.

Specified by:
setSize in interface NodeLayout
Overrides:
setSize in class ShapeNodeRealizer
Parameters:
w - the new width of the node
h - the new height of the node

isConsiderNodeLabelSize

public boolean isConsiderNodeLabelSize()
Returns whether label sizes will be taken into account when calculating the minimal node bounds. Method 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.

Returns:
whether node label sizes shall be considered when recalculating the group node's bounds. By default this is set to false.

setConsiderNodeLabelSize

public void setConsiderNodeLabelSize(boolean considerNodeLabelSize)
Whether label sizes shall be taken into account when calculating the minimal node bounds. Method 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.

Parameters:
considerNodeLabelSize - whether node label sizes shall be considered when recalculating the group node's bounds. By default this is set to false.

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.