public class ShapeNodeRenderer extends java.lang.Object implements NodeRenderer
Modifier and Type | Class and Description |
---|---|
static class |
ShapeNodeRenderer.NodeShape
Geometric render shape
|
Constructor and Description |
---|
ShapeNodeRenderer() |
Modifier and Type | Method and Description |
---|---|
void |
drawNode(java.awt.Graphics g,
java.lang.Object node,
java.awt.Point loc)
Render the node with the current shape
|
protected void |
drawNodeShape(java.awt.Graphics g,
ShapeNodeRenderer.NodeShape nodeShape,
java.awt.Color nodeColor,
java.awt.Rectangle bounds,
boolean hilite)
Draw the node shape into the graphics context.
|
java.awt.Color |
getColor()
Gets the color for the Renderer, if any
|
java.awt.Rectangle |
getNodeBounds(java.lang.Object node,
java.awt.Point loc)
Returns the bounding box for the node using this renderer.
|
protected java.awt.Color |
getNodeColor(java.lang.Object node)
Get the color used for the node.
|
protected ShapeNodeRenderer.NodeShape |
getNodeShape(java.lang.Object node)
Get the shape for a particular node.
|
ShapeNodeRenderer.NodeShape |
getShape()
Get the current shape
|
void |
highlightNode(java.awt.Graphics g,
java.lang.Object node,
java.awt.Point loc)
Draws the node into the Graphics Context in a highlighted fashion.
|
boolean |
pickNode(java.lang.Object node,
java.awt.Point nodeLoc,
java.awt.Point pickPoint)
Checks whether the specified pick point is within the drawn area for the
node.
|
void |
setColor(java.awt.Color nodeColor)
Sets the color for the NodeRenderer.
|
void |
setShape(ShapeNodeRenderer.NodeShape nodeShape)
Set the shape used to display the nodes
|
public void drawNode(java.awt.Graphics g, java.lang.Object node, java.awt.Point loc)
drawNode
in interface NodeRenderer
g
- the Graphics context to display the nodenode
- the node to displayloc
- The node locationprotected void drawNodeShape(java.awt.Graphics g, ShapeNodeRenderer.NodeShape nodeShape, java.awt.Color nodeColor, java.awt.Rectangle bounds, boolean hilite)
g
- the graphics context to draw intonodeShape
- the shape to drawnodeColor
- the color of the nodebounds
- the rectangular area to draw withinhilite
- whether to draw the node with a highlighted borderpublic java.awt.Color getColor()
getColor
in interface NodeRenderer
public java.awt.Rectangle getNodeBounds(java.lang.Object node, java.awt.Point loc)
getNodeBounds
in interface NodeRenderer
node
- The nodeloc
- The node locationprotected java.awt.Color getNodeColor(java.lang.Object node)
node
- the node to query for the colorprotected ShapeNodeRenderer.NodeShape getNodeShape(java.lang.Object node)
getShape()
, but may be overridden by subclases to
implement shapes which vary according to the node.node
- the nodepublic ShapeNodeRenderer.NodeShape getShape()
public void highlightNode(java.awt.Graphics g, java.lang.Object node, java.awt.Point loc)
highlightNode
in interface NodeRenderer
g
- the Graphics context to display the nodenode
- the node to displayloc
- The node locationpublic boolean pickNode(java.lang.Object node, java.awt.Point nodeLoc, java.awt.Point pickPoint)
pickNode
in interface NodeRenderer
node
- the node to check for pickingnodeLoc
- The node locationpickPoint
- the coordinate of the point to checkpublic void setColor(java.awt.Color nodeColor)
setColor
in interface NodeRenderer
nodeColor
- The color for the NodeRendererpublic void setShape(ShapeNodeRenderer.NodeShape nodeShape)
nodeShape
- the shape to set