|
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 |
FAT_ARROW
Shape type constant. |
static byte |
FAT_ARROW_2
Shape type constant. |
static byte |
HEXAGON
Shape type constant. |
static byte |
OCTAGON
Shape type constant. |
static byte |
PARALLELOGRAM
Shape type constant. |
static byte |
PARALLELOGRAM_2
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 |
STAR5
Shape type constant. |
static byte |
STAR6
Shape type constant. |
static byte |
STAR8
Shape type constant. |
static byte |
TRAPEZOID
Shape type constant. |
static byte |
TRAPEZOID_2
Shape type constant. |
static byte |
TRIANGLE
Shape type constant. |
static byte |
TRIANGLE_2
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 java.awt.Color |
getFillColor(NodeRealizer context,
boolean selected)
Determines the fill color for the specified realizer. |
protected java.awt.Shape |
getShape(NodeRealizer context)
Yields the shape that would be painted for the given context by this instance. |
byte |
getShapeType()
Returns the shape type used for visualizing nodes. |
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,
java.awt.Graphics2D graphics,
java.awt.Shape shape)
Responsible for painting the filled shape using a specific color or paint. |
protected void |
paintNode(NodeRealizer context,
java.awt.Graphics2D graphics,
boolean sloppy)
Callback method to be overwritten by subclasses called by AbstractCustomNodePainter.paint(NodeRealizer, Graphics2D) . |
protected void |
paintShapeBorder(NodeRealizer context,
java.awt.Graphics2D graphics,
java.awt.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
setShapeType(byte)
,
Constant Field Valuespublic static final byte ROUND_RECT
setShapeType(byte)
,
Constant Field Valuespublic static final byte ELLIPSE
setShapeType(byte)
,
Constant Field Valuespublic static final byte PARALLELOGRAM
setShapeType(byte)
,
Constant Field Valuespublic static final byte HEXAGON
setShapeType(byte)
,
Constant Field Valuespublic static final byte TRIANGLE
setShapeType(byte)
,
Constant Field Valuespublic static final byte RECT_3D
setShapeType(byte)
,
Constant Field Valuespublic static final byte OCTAGON
setShapeType(byte)
,
Constant Field Valuespublic static final byte DIAMOND
setShapeType(byte)
,
Constant Field Valuespublic static final byte TRAPEZOID
setShapeType(byte)
,
Constant Field Valuespublic static final byte TRAPEZOID_2
setShapeType(byte)
,
Constant Field Valuespublic static final byte TRIANGLE_2
setShapeType(byte)
,
Constant Field Valuespublic static final byte PARALLELOGRAM_2
setShapeType(byte)
,
Constant Field Valuespublic static final byte STAR5
setShapeType(byte)
,
Constant Field Valuespublic static final byte STAR6
setShapeType(byte)
,
Constant Field Valuespublic static final byte STAR8
setShapeType(byte)
,
Constant Field Valuespublic static final byte FAT_ARROW
setShapeType(byte)
,
Constant Field Valuespublic static final byte FAT_ARROW_2
setShapeType(byte)
,
Constant Field ValuesConstructor Detail |
---|
public ShapeNodePainter()
ShapeNodePainter
.
The shape type will be set to RECT
.
public ShapeNodePainter(byte type)
ShapeNodePainter
with the given
shape type. Available types are:
DIAMOND
,
ELLIPSE
,
FAT_ARROW
,
FAT_ARROW_2
,
HEXAGON
,
OCTAGON
,
PARALLELOGRAM
,
PARALLELOGRAM_2
,
RECT
,
RECT_3D
,
ROUND_RECT
,
STAR5
,
STAR6
,
STAR8
,
TRAPEZOID
,
TRAPEZOID_2
,
TRIANGLE
, and
TRIANGLE_2
.
type
- the type of shape used for visualizing nodes.Method Detail |
---|
protected void paintNode(NodeRealizer context, java.awt.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, java.awt.Graphics2D graphics, java.awt.Shape shape)
context
- the node realizer that this painter is associated with.graphics
- the graphics context.shape
- the shape that shall be painted.protected java.awt.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, java.awt.Graphics2D graphics, java.awt.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
,
FAT_ARROW
,
FAT_ARROW_2
,
HEXAGON
,
OCTAGON
,
PARALLELOGRAM
,
PARALLELOGRAM_2
,
RECT
,
RECT_3D
,
ROUND_RECT
,
STAR5
,
STAR6
,
STAR8
,
TRAPEZOID
,
TRAPEZOID_2
,
TRIANGLE
, and
TRIANGLE_2
.
type
- the type of shape used for visualizing nodes.public byte getShapeType()
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 java.awt.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-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |