|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.AbstractCustomNodePainter y.view.ShapeNodePainter
public class ShapeNodePainter
This class represents a painter implementation for GenericNodeRealizer
. It provides several geometric
shapes like rectangle, rounded rectangle, ellipse, parallelogram, hexagon, triangle, octagon, diamond and trapezoid.
Method setGroupDepthFillColorEnabled(boolean)
allows to define whether the fill color of the shapes shall be
adapted to reflect the local group depth of the painted node within the graph hierarchy or not.
Field Summary | |
---|---|
static byte |
DIAMOND
Shape type constant. |
static byte |
ELLIPSE
Shape type constant. |
static byte |
HEXAGON
Shape type constant. |
static byte |
OCTAGON
Shape type constant. |
static byte |
PARALLELOGRAM
Shape type constant. |
static byte |
RECT
Shape type constant. |
static byte |
RECT_3D
Shape type constant. |
static byte |
ROUND_RECT
Shape type constant. |
static byte |
TRAPEZOID
Shape type constant. |
static byte |
TRAPEZOID_2
Shape type constant. |
static byte |
TRIANGLE
Shape type constant. |
Constructor Summary | |
---|---|
ShapeNodePainter()
Creates a new instance of ShapeNodePainter. |
|
ShapeNodePainter(byte type)
Creates a new instance of ShapeNodePainter with the given shape type. |
Method Summary | |
---|---|
boolean |
contains(NodeRealizer context,
double x,
double y)
Used as a callback for the GenericNodeRealizer.contains(double, double) method. |
protected Color |
getFillColor(NodeRealizer context,
boolean selected)
Determines the fill color for the specified realizer. |
protected Shape |
getShape(NodeRealizer context)
Yields the shape that would be painted for the given context by this instance. |
byte |
getShapeType()
Returns the shape type of this painter By default RECT is used. |
boolean |
isGroupDepthFillColorEnabled()
Whether or not the fill color of the painted node should be adapted to reflect the local group depth of this node within the graph hierarchy. |
protected void |
paintFilledShape(NodeRealizer context,
Graphics2D graphics,
Shape shape)
Responsible for painting the filled shape using a specific color or paint. |
protected void |
paintNode(NodeRealizer context,
Graphics2D graphics,
boolean sloppy)
Callback method to be overwritten by subclasses called by AbstractCustomNodePainter.paint(NodeRealizer, Graphics2D) . |
protected void |
paintShapeBorder(NodeRealizer context,
Graphics2D graphics,
Shape shape)
Responsible for painting the border or outline of the shape. |
void |
setGroupDepthFillColorEnabled(boolean enabled)
Whether or not the fill color of the painted node should be adapted to reflect the local group depth of this node within the graph hierarchy. |
void |
setShapeType(byte type)
Sets the shape type that is being used when painting the node. |
Methods inherited from class y.view.AbstractCustomNodePainter |
---|
backupGraphics, createSelectionColor, getFillColor2, getFillPaint, getLineColor, getLinePaint, getLineStroke, initializeFill, initializeLine, paint, paintHotSpots, paintPorts, paintSloppy, paintText, restoreGraphics |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte RECT
public static final byte ROUND_RECT
public static final byte ELLIPSE
public static final byte PARALLELOGRAM
public static final byte HEXAGON
public static final byte TRIANGLE
public static final byte RECT_3D
public static final byte OCTAGON
public static final byte DIAMOND
public static final byte TRAPEZOID
public static final byte TRAPEZOID_2
Constructor Detail |
---|
public ShapeNodePainter()
RECT
.
public ShapeNodePainter(byte type)
DIAMOND
, ELLIPSE
, HEXAGON
, OCTAGON
, PARALLELOGRAM
, RECT
, RECT_3D
, ROUND_RECT
, TRAPEZOID
, TRAPEZOID_2
, TRIANGLE
.
type
- defines the type of shape the painter shall use to paint the node.Method Detail |
---|
protected void paintNode(NodeRealizer context, Graphics2D graphics, boolean sloppy)
AbstractCustomNodePainter
AbstractCustomNodePainter.paint(NodeRealizer, Graphics2D)
.
This method is responsible for drawing the actual node only - neither
the hotspots, nor the labels, should be painted by this method.
paintNode
in class AbstractCustomNodePainter
context
- the context nodegraphics
- the graphics context to usesloppy
- whether to draw the node sloppilyAbstractCustomNodePainter.initializeLine(NodeRealizer, Graphics2D)
,
AbstractCustomNodePainter.initializeFill(NodeRealizer, Graphics2D)
protected void paintFilledShape(NodeRealizer context, Graphics2D graphics, Shape shape)
context
- the node realizer that this painter is associated with.graphics
- the graphics context.shape
- the shape that shall be painted.protected Color getFillColor(NodeRealizer context, boolean selected)
groupDepthFillColorEnabled
is true
, the color
depends on the hierarchical group depth of the node represented by the
specified realizer. The deeper said node lies in the hierarchy, the darker
the color returned.
getFillColor
in class AbstractCustomNodePainter
context
- the context nodeselected
- whether the node is currently selected
null
if the shape interior should not be painted.HierarchyManager.getLocalGroupDepth(y.base.Node)
protected void paintShapeBorder(NodeRealizer context, Graphics2D graphics, Shape shape)
context
- the node realizer that this painter is associated with.graphics
- the graphics context.shape
- the shape that shall be painted.public void setShapeType(byte type)
DIAMOND
, ELLIPSE
, HEXAGON
, OCTAGON
, PARALLELOGRAM
, RECT
, RECT_3D
, ROUND_RECT
, TRAPEZOID
, TRAPEZOID_2
, TRIANGLE
. By default RECT
is used.
type
- the shape type that should be used for painting.public byte getShapeType()
RECT
is used.
public void setGroupDepthFillColorEnabled(boolean enabled)
enabled
- whether the group depth shall be reflected by the groups fill color. Default is true.public boolean isGroupDepthFillColorEnabled()
setGroupDepthFillColorEnabled(boolean)
protected Shape getShape(NodeRealizer context)
context
- the realizer from which the coordinates will be obtained.
public boolean contains(NodeRealizer context, double x, double y)
GenericNodeRealizer.ContainsTest
GenericNodeRealizer.contains(double, double)
method.
contains
in interface GenericNodeRealizer.ContainsTest
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |