|
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
public abstract class AbstractCustomNodePainter
Abstract base class that can be used with customizations of GenericNodeRealizer
instances.
This base class contains useful utility functions and delegates the actual work to one
simple abstract method.
Constructor Summary | |
---|---|
AbstractCustomNodePainter()
Creates a new instance of AbstractCustomNodePainter |
Method Summary | |
---|---|
protected void |
backupGraphics(java.awt.Graphics2D graphics)
This method should store the graphics context so that all state of the context can be reversed in a subsequent call to restoreGraphics(Graphics2D)
This implementation stores and restores the color, the stroke, and the paint
of the graphics context. |
protected java.awt.Color |
createSelectionColor(java.awt.Color original)
Callback function that calculates/modifies a given Color instance for the selected use case. |
protected java.awt.Color |
getFillColor(NodeRealizer context,
boolean selected)
Callback method used by initializeFill(NodeRealizer, Graphics2D)
to determine the first color for the fill. |
protected java.awt.Color |
getFillColor2(NodeRealizer context,
boolean selected)
Callback method used by initializeFill(NodeRealizer, Graphics2D)
to determine the second color for the fill. |
protected java.awt.Paint |
getFillPaint(NodeRealizer context,
boolean selected)
Callback method used by initializeFill(NodeRealizer, Graphics2D)
to determine the paint for the fill. |
protected java.awt.Color |
getLineColor(NodeRealizer context,
boolean selected)
Callback method used by initializeLine(NodeRealizer, Graphics2D)
to determine the color of the lines. |
protected java.awt.Paint |
getLinePaint(NodeRealizer context,
boolean selected)
Callback method used by initializeLine(NodeRealizer, Graphics2D)
to determine the color of the line. |
protected java.awt.Stroke |
getLineStroke(NodeRealizer context,
boolean selected)
Callback method used by initializeLine(NodeRealizer, Graphics2D)
to determine the stroke of the lines. |
protected boolean |
initializeFill(NodeRealizer context,
java.awt.Graphics2D graphics)
This utility function can be called by subclasses to initialize the graphics context for the filling of the node. |
protected boolean |
initializeLine(NodeRealizer context,
java.awt.Graphics2D graphics)
This utility function can be called by subclasses to initialize the graphics context for the drawing of the lines of the node. |
void |
paint(NodeRealizer context,
java.awt.Graphics2D graphics)
Calls the various utility method and callbacks in this class. |
protected void |
paintHotSpots(NodeRealizer context,
java.awt.Graphics2D graphics)
This method is invoked from paint(NodeRealizer, Graphics2D) to draw the hot spots
of the node if necessary. |
protected abstract void |
paintNode(NodeRealizer context,
java.awt.Graphics2D graphics,
boolean sloppy)
Callback method to be overwritten by subclasses called by paint(NodeRealizer, Graphics2D) . |
protected void |
paintPorts(NodeRealizer context,
java.awt.Graphics2D graphics)
This method is invoked from paint(NodeRealizer, Graphics2D) to
draw the ports of the node. |
void |
paintSloppy(NodeRealizer context,
java.awt.Graphics2D graphics)
Delegates to paintNode(NodeRealizer, Graphics2D, boolean) if the node
is visible. |
protected void |
paintText(NodeRealizer context,
java.awt.Graphics2D graphics)
This method is invoked from paint(NodeRealizer, Graphics2D) to draw the labels
of the node. |
protected void |
restoreGraphics(java.awt.Graphics2D graphics)
This method should restore the graphics context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractCustomNodePainter()
Method Detail |
---|
public void paint(NodeRealizer context, java.awt.Graphics2D graphics)
paint
in interface GenericNodeRealizer.Painter
protected void backupGraphics(java.awt.Graphics2D graphics)
restoreGraphics(Graphics2D)
This implementation stores and restores the color, the stroke, and the paint
of the graphics context.
graphics
- the graphics to store the contextprotected void paintHotSpots(NodeRealizer context, java.awt.Graphics2D graphics)
paint(NodeRealizer, Graphics2D)
to draw the hot spots
of the node if necessary. By default it calls the context's paintHotSpots
method if the context is selected.
context
- the node realizer for which hot spots may be drawngraphics
- the graphics to draw onprotected void paintText(NodeRealizer context, java.awt.Graphics2D graphics)
paint(NodeRealizer, Graphics2D)
to draw the labels
of the node. By default it calls the context's paintText
method if the context has at least one label.
context
- the node realizer for which the labels should be drawngraphics
- the graphics to draw onprotected void paintPorts(NodeRealizer context, java.awt.Graphics2D graphics)
paint(NodeRealizer, Graphics2D)
to
draw the ports of the node. By default it calls the context's
paintPorts
method.
context
- the node realizer for which node ports should be drawn.graphics
- the graphics to draw on.protected void restoreGraphics(java.awt.Graphics2D graphics)
backupGraphics(Graphics2D)
This implementation stores and restores the color, the stroke, and the paint
of the graphics context.
graphics
- the graphics to restore the contextprotected boolean initializeLine(NodeRealizer context, java.awt.Graphics2D graphics)
false
no lines should be drawn.
context
- the context nodegraphics
- the graphics to configure
protected boolean initializeFill(NodeRealizer context, java.awt.Graphics2D graphics)
false
the node should not be filled.
context
- the context nodegraphics
- the graphics to configure
protected java.awt.Color getLineColor(NodeRealizer context, boolean selected)
initializeLine(NodeRealizer, Graphics2D)
to determine the color of the lines.
context
- the context nodeselected
- whether the node is currently selected
null
protected java.awt.Stroke getLineStroke(NodeRealizer context, boolean selected)
initializeLine(NodeRealizer, Graphics2D)
to determine the stroke of the lines.
context
- the context nodeselected
- whether the node is currently selected
protected java.awt.Paint getLinePaint(NodeRealizer context, boolean selected)
initializeLine(NodeRealizer, Graphics2D)
to determine the color of the line.
This methods simply delegates to getLineColor(NodeRealizer, boolean)
context
- the context nodeselected
- whether the node is currently selected
null
protected java.awt.Color createSelectionColor(java.awt.Color original)
original
- the color to transform to for the selected case
protected java.awt.Color getFillColor(NodeRealizer context, boolean selected)
initializeFill(NodeRealizer, Graphics2D)
to determine the first color for the fill.
context
- the context nodeselected
- whether the node is currently selected
null
protected java.awt.Paint getFillPaint(NodeRealizer context, boolean selected)
initializeFill(NodeRealizer, Graphics2D)
to determine the paint for the fill.
This method simply delegates to getFillColor(NodeRealizer, boolean)
context
- the context nodeselected
- whether the node is currently selected
null
protected java.awt.Color getFillColor2(NodeRealizer context, boolean selected)
initializeFill(NodeRealizer, Graphics2D)
to determine the second color for the fill.
context
- the context nodeselected
- whether the node is currently selected
null
protected abstract void paintNode(NodeRealizer context, java.awt.Graphics2D graphics, boolean sloppy)
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.
context
- the context nodegraphics
- the graphics context to usesloppy
- whether to draw the node sloppilyinitializeLine(NodeRealizer, Graphics2D)
,
initializeFill(NodeRealizer, Graphics2D)
public void paintSloppy(NodeRealizer context, java.awt.Graphics2D graphics)
paintNode(NodeRealizer, Graphics2D, boolean)
if the node
is visible.
paintSloppy
in interface GenericNodeRealizer.Painter
context
- the context nodegraphics
- the graphics context to use
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |