|
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.ShinyPlateNodePainter
public class ShinyPlateNodePainter
Draws a simple floating shiny plate with a slight gradient, a thin border and an optional simple drop shadow.
Field Summary | |
---|---|
static java.lang.String |
SHADOW_PAINTING_STYLE_ID
Style property key to selectively turn shadow painting on or off. |
Constructor Summary | |
---|---|
ShinyPlateNodePainter()
Creates a new instance of this Painter. |
Method Summary | |
---|---|
boolean |
contains(NodeRealizer context,
double x,
double y)
Determines if the point (x,y) lies within the given visual
representation of a node. |
protected java.awt.Paint |
getEffectFillPaint(NodeRealizer context,
java.awt.Graphics2D graphics)
Determines the paint for the shiny plate effect. |
double |
getRadius()
Returns the radius of the rounded corners of the rounded rectangle shape. |
protected double |
getRadius(NodeRealizer context)
Callback to allow subclass to customize the corner radius depending on context. |
java.awt.Color |
getShadowColor()
Gets the color of the shadow. |
protected java.awt.Color |
getShadowColor(NodeRealizer context)
Callback invoked from paintShadow(NodeRealizer, java.awt.Graphics2D)
to allow subclasses to customize shadow painting depending on context. |
protected boolean |
initializeEffectFillPaint(NodeRealizer context,
java.awt.Graphics2D graphics)
Initializes the graphics context for painting the shiny plate effect. |
boolean |
isDrawShadow()
Returns whether the painter will draw a drop shadow effect. |
protected boolean |
isDrawShadow(NodeRealizer context)
Callback invoked from paintShadow(NodeRealizer, java.awt.Graphics2D)
to allow subclasses to customize shadow painting depending on context. |
protected void |
paintBackground(NodeRealizer context,
java.awt.Graphics2D graphics)
Paints the node's background. |
protected void |
paintBorder(NodeRealizer context,
java.awt.Graphics2D graphics)
Draws the border of the node. |
protected void |
paintEffect(NodeRealizer context,
java.awt.Graphics2D graphics)
Paints the shiny plate effect. |
protected void |
paintNode(NodeRealizer context,
java.awt.Graphics2D graphics,
boolean sloppy)
Paints the node. |
protected void |
paintShadow(NodeRealizer context,
java.awt.Graphics2D graphics)
Paints the shadow of the node. |
void |
setDrawShadow(boolean drawShadow)
Sets whether the painter will draw a drop shadow effect. |
void |
setRadius(double radius)
Sets the radius of the rounded corners of the rounded rectangle shape. |
void |
setShadowColor(java.awt.Color shadowColor)
Sets the color of the shadow. |
Methods inherited from class y.view.AbstractCustomNodePainter |
---|
backupGraphics, createSelectionColor, getFillColor, 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 java.lang.String SHADOW_PAINTING_STYLE_ID
Boolean.TRUE
will turn on shadow painting.
An associated value of Boolean.FALSE
will turn off shadow painting.
YRenderingHints.isShadowPaintingEnabled(java.awt.Graphics2D)
,
Constant Field ValuesConstructor Detail |
---|
public ShinyPlateNodePainter()
Method Detail |
---|
protected void paintNode(NodeRealizer context, java.awt.Graphics2D graphics, boolean sloppy)
sloppy==false
), this method calls paintShadow
,
paintBackground
, paintBorder
, and paintEffect
.
paintNode
in class AbstractCustomNodePainter
context
- the context nodegraphics
- the graphics context to usesloppy
- whether to draw the node sloppilypaintShadow(NodeRealizer, java.awt.Graphics2D)
,
paintBackground(NodeRealizer, java.awt.Graphics2D)
,
paintBorder(NodeRealizer, java.awt.Graphics2D)
,
paintEffect(NodeRealizer, java.awt.Graphics2D)
protected void paintShadow(NodeRealizer context, java.awt.Graphics2D graphics)
shadow drawing
is enabled.
context
- the context nodegraphics
- the graphics context to useisDrawShadow()
,
setDrawShadow(boolean)
protected void paintBackground(NodeRealizer context, java.awt.Graphics2D graphics)
AbstractCustomNodePainter.getFillColor(NodeRealizer, boolean)
.
context
- the context nodegraphics
- the graphics context to useprotected void paintBorder(NodeRealizer context, java.awt.Graphics2D graphics)
AbstractCustomNodePainter.getLineColor(NodeRealizer, boolean)
and
AbstractCustomNodePainter.getLineStroke(NodeRealizer, boolean)
to draw the node border.
context
- the context nodegraphics
- the graphics context to useprotected void paintEffect(NodeRealizer context, java.awt.Graphics2D graphics)
initializeEffectFillPaint
.
context
- the context nodegraphics
- the graphics context to useinitializeEffectFillPaint(NodeRealizer, java.awt.Graphics2D)
protected boolean initializeEffectFillPaint(NodeRealizer context, java.awt.Graphics2D graphics)
false
, the shiny plate effect should
not be applied.
Calls getEffectFillPaint
.
context
- the context nodegraphics
- the graphics context to use
true
if the shiny plate effect should be painted,
false
otherwise.getEffectFillPaint(NodeRealizer, java.awt.Graphics2D)
protected java.awt.Paint getEffectFillPaint(NodeRealizer context, java.awt.Graphics2D graphics)
context
- the context nodegraphics
- the graphics context to use
protected boolean isDrawShadow(NodeRealizer context)
paintShadow(NodeRealizer, java.awt.Graphics2D)
to allow subclasses to customize shadow painting depending on context.
The default implementation calls isDrawShadow()
.
context
- the context node
true
if the painter should draw a shadow;
false
otherwise.public boolean isDrawShadow()
true
.
public void setDrawShadow(boolean drawShadow)
true
.
drawShadow
- Whether to draw a drop shadow.protected double getRadius(NodeRealizer context)
getRadius()
.
context
- the context node
public double getRadius()
public void setRadius(double radius)
radius
- the radius to use for the rounded rectangle corners.protected java.awt.Color getShadowColor(NodeRealizer context)
paintShadow(NodeRealizer, java.awt.Graphics2D)
to allow subclasses to customize shadow painting depending on context.
The default implementation calls getShadowColor()
.
context
- the node context
public java.awt.Color getShadowColor()
public void setShadowColor(java.awt.Color shadowColor)
shadowColor
- the color of the shadow.public boolean contains(NodeRealizer context, double x, double y)
(x,y)
lies within the given visual
representation of a node.
contains
in interface GenericNodeRealizer.ContainsTest
context
- the visual representation of a node.x
- the x-coordinate of the point.y
- the y-coordinate of the point.
true
if the point lies within the node;
false
otherwise.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |