|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.GenericEdgePainter
public class GenericEdgePainter
This class serves as a base class for the GenericEdgeRealizer.Painter
interface implementations. It offers convenient methods for partially overriding
distinct behaviors during the rendering of edges.
GenericEdgeRealizer
Constructor Summary | |
---|---|
GenericEdgePainter()
Creates a new stateless instance of GenericEdgePainter |
Method Summary | |
---|---|
protected java.awt.geom.GeneralPath |
adjustPath(EdgeRealizer context,
BendList bends,
java.awt.geom.GeneralPath path,
BridgeCalculator bridgeCalculator,
boolean selected)
Callback method that can be used to adjust the calculated path before the final rendering. |
protected java.awt.Paint |
getLinePaint(EdgeRealizer context,
boolean selected)
Callback method used by initializeLine(EdgeRealizer,java.awt.Graphics2D,boolean)
and initializeSelectionLine(EdgeRealizer,java.awt.Graphics2D,boolean)
to determine the color of the line. |
protected java.awt.Stroke |
getLineStroke(EdgeRealizer context,
boolean selected)
Callback method used by initializeLine(EdgeRealizer,java.awt.Graphics2D,boolean)
and initializeSelectionLine(EdgeRealizer,java.awt.Graphics2D,boolean)
to determine the stroke of the line. |
protected java.awt.Paint |
getSelectionLinePaint(EdgeRealizer context,
boolean selected)
Callback method used by initializeSelectionLine(EdgeRealizer,java.awt.Graphics2D,boolean)
to determine the color of the selection line. |
protected java.awt.Stroke |
getSelectionLineStroke(EdgeRealizer context,
boolean selected)
Callback method used by initializeLine(EdgeRealizer,java.awt.Graphics2D,boolean)
and initializeSelectionLine(EdgeRealizer,java.awt.Graphics2D,boolean)
to determine the selection line stroke. |
protected java.awt.Stroke |
getSloppyLineStroke(EdgeRealizer context,
boolean selected)
Callback method used by paintSloppy(EdgeRealizer, BendList, java.awt.geom.GeneralPath, java.awt.Graphics2D, boolean)
to determine the stroke of the line. |
protected boolean |
initializeControlPolygonLine(EdgeRealizer context,
java.awt.Graphics2D gfx,
boolean selected)
This utility function can be called by subclasses to initialize the graphics context for the drawing of the control polygon. |
protected boolean |
initializeLine(EdgeRealizer context,
java.awt.Graphics2D gfx,
boolean selected)
This utility function can be called by subclasses to initialize the graphics context for the drawing of the lines of the edge. |
protected boolean |
initializeSelectionLine(EdgeRealizer context,
java.awt.Graphics2D gfx,
boolean selected)
This utility function can be called by subclasses to initialize the graphics context for the drawing of the lines of the edge. |
void |
paint(EdgeRealizer context,
BendList bends,
java.awt.geom.GeneralPath path,
java.awt.Graphics2D gfx,
boolean selected)
Checks whether or not the edge is visible and recalculates the path
if it is flagged dirty . |
protected void |
paintArrows(EdgeRealizer context,
BendList bends,
java.awt.geom.GeneralPath path,
java.awt.Graphics2D gfx)
This method paints the arrows of this edge. |
protected void |
paintBends(EdgeRealizer context,
BendList bends,
java.awt.geom.GeneralPath path,
java.awt.Graphics2D gfx,
boolean selected)
This method paints the bends of this edge. |
protected void |
paintControlPolygon(EdgeRealizer context,
BendList bends,
java.awt.geom.GeneralPath path,
java.awt.Graphics2D gfx,
boolean selected)
This method can be used to paint a control polygon. |
protected void |
paintHighlightedBends(EdgeRealizer context,
BendList bends,
java.awt.geom.GeneralPath path,
java.awt.Graphics2D gfx)
This method paints the highlighted bends of this edge. |
protected void |
paintLabels(EdgeRealizer context,
java.awt.Graphics2D gfx,
boolean selected)
This method paints the labels that belong to this edge. |
protected void |
paintPath(EdgeRealizer context,
BendList bends,
java.awt.geom.GeneralPath path,
java.awt.Graphics2D gfx,
boolean selected)
Paints the actual path and decorations of the edge. |
protected void |
paintPorts(EdgeRealizer context,
BendList bends,
java.awt.geom.GeneralPath path,
java.awt.Graphics2D gfx,
boolean selected)
This method paints the ports of the edges. |
void |
paintSloppy(EdgeRealizer context,
BendList bends,
java.awt.geom.GeneralPath path,
java.awt.Graphics2D gfx,
boolean selected)
This method paints the edge sloppily using simple and fast graphics operations. |
protected void |
renderPath(EdgeRealizer context,
java.awt.Graphics2D gfx,
java.awt.geom.GeneralPath path,
boolean selected)
This is a callback method that will be called finally to render the GeneralPath on the graphics context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericEdgePainter()
Method Detail |
---|
protected java.awt.geom.GeneralPath adjustPath(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, BridgeCalculator bridgeCalculator, boolean selected)
path
or reverses the path
when context.isReversedPathRenderingEnabled()
returns true
.
context
- the EdgeRealizer context that is used for the current paintingbends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.bridgeCalculator
- if a BridgeCalculator instance is associated with the current
rendering, it will be passed through this parameter, otherwise it is null
selected
- whether or not the edge should be painted in selected state
path
)protected java.awt.Paint getLinePaint(EdgeRealizer context, boolean selected)
initializeLine(EdgeRealizer,java.awt.Graphics2D,boolean)
and initializeSelectionLine(EdgeRealizer,java.awt.Graphics2D,boolean)
to determine the color of the line.
context
- the context edgeselected
- whether or not the edge is currently selected
null
protected java.awt.Paint getSelectionLinePaint(EdgeRealizer context, boolean selected)
initializeSelectionLine(EdgeRealizer,java.awt.Graphics2D,boolean)
to determine the color of the selection line.
context
- the context edgeselected
- whether or not the edge is currently selected
null
protected java.awt.Stroke getLineStroke(EdgeRealizer context, boolean selected)
initializeLine(EdgeRealizer,java.awt.Graphics2D,boolean)
and initializeSelectionLine(EdgeRealizer,java.awt.Graphics2D,boolean)
to determine the stroke of the line.
This method simply delegates to EdgeRealizer.getLineType()
.
context
- the EdgeRealizer context that is used for the current paintingselected
- whether or not the edge is selected
protected java.awt.Stroke getSelectionLineStroke(EdgeRealizer context, boolean selected)
initializeLine(EdgeRealizer,java.awt.Graphics2D,boolean)
and initializeSelectionLine(EdgeRealizer,java.awt.Graphics2D,boolean)
to determine the selection line stroke.
context
- the EdgeRealizer context that is used for the current paintingselected
- whether or not the edge is selected
protected java.awt.Stroke getSloppyLineStroke(EdgeRealizer context, boolean selected)
paintSloppy(EdgeRealizer, BendList, java.awt.geom.GeneralPath, java.awt.Graphics2D, boolean)
to determine the stroke of the line.
This method simply returns LineType.LINE_1
.
context
- the EdgeRealizer context that is used for the current paintingselected
- whether or not the edge is selected
protected boolean initializeSelectionLine(EdgeRealizer context, java.awt.Graphics2D gfx, boolean selected)
false
no lines should be drawn.
context
- the context edgegfx
- the graphics to configureselected
- whether or not the edge should be painted in selected state
protected boolean initializeLine(EdgeRealizer context, java.awt.Graphics2D gfx, boolean selected)
false
no lines should be drawn.
This method uses methods getLinePaint(EdgeRealizer, boolean)
and
getLineStroke(EdgeRealizer, boolean)
to initialize the graphics
context.
context
- the context edgegfx
- the graphics to configureselected
- whether or not the edge should be painted in selected state
protected boolean initializeControlPolygonLine(EdgeRealizer context, java.awt.Graphics2D gfx, boolean selected)
false
no lines should be drawn.
This method simply delegates to
initializeSelectionLine(EdgeRealizer, java.awt.Graphics2D, boolean)
to initialize the graphics context.
context
- the context edgegfx
- the graphics to configureselected
- whether or not the edge is selected
public void paint(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.Graphics2D gfx, boolean selected)
recalculates
the path
if it is flagged dirty
.
Then this code calls the following method on a copy of the Graphics2D context.
adjustPath(EdgeRealizer,BendList,java.awt.geom.GeneralPath,BridgeCalculator,boolean)
paintPath(EdgeRealizer,BendList,java.awt.geom.GeneralPath,java.awt.Graphics2D,boolean)
paintControlPolygon(EdgeRealizer, BendList, java.awt.geom.GeneralPath, java.awt.Graphics2D, boolean)
paintLabels(EdgeRealizer,java.awt.Graphics2D,boolean)
paintPorts(EdgeRealizer,BendList,java.awt.geom.GeneralPath,java.awt.Graphics2D,boolean)
paintBends(EdgeRealizer, BendList, java.awt.geom.GeneralPath, java.awt.Graphics2D, boolean)
paint
in interface GenericEdgeRealizer.Painter
context
- the EdgeRealizer context that is used for the current paintingbends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.selected
- whether or not the edge should be painted selectedprotected void paintPath(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.Graphics2D gfx, boolean selected)
render
the path using the settings initialized by initializeSelectionLine(EdgeRealizer, java.awt.Graphics2D, boolean)
and render the path using the settings initialized by initializeLine(EdgeRealizer, java.awt.Graphics2D, boolean)
as well as paint the arrows
.
context
- the EdgeRealizer context that is used for the current paintinggfx
- the graphics context to usebends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.selected
- whether or not the edge should be painted selectedprotected void paintControlPolygon(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.Graphics2D gfx, boolean selected)
context
- the EdgeRealizer context that is used for the current paintinggfx
- the graphics context to usebends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.selected
- whether or not the edge should be painted selectedprotected void renderPath(EdgeRealizer context, java.awt.Graphics2D gfx, java.awt.geom.GeneralPath path, boolean selected)
gfx.draw(path)
.
context
- the EdgeRealizer context that is used for the current paintinggfx
- the graphics context to usepath
- the GeneralPath instance that can be used to calculate a new result.selected
- whether or not the edge should be painted selectedprotected void paintLabels(EdgeRealizer context, java.awt.Graphics2D gfx, boolean selected)
context
- the EdgeRealizer context that is used for the current paintinggfx
- the graphics context to useselected
- whether or not the edge should be painted selectedprotected void paintPorts(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.Graphics2D gfx, boolean selected)
context
- the EdgeRealizer context that is used for the current paintinggfx
- the graphics context to usebends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.selected
- whether or not the edge should be painted selectedprotected void paintHighlightedBends(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.Graphics2D gfx)
context
- the EdgeRealizer context that is used for the current paintinggfx
- the graphics context to usebends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.protected void paintBends(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.Graphics2D gfx, boolean selected)
context
- the EdgeRealizer context that is used for the current paintinggfx
- the graphics context to usebends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.selected
- whether or not the edge should be painted in selected stateprotected void paintArrows(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.Graphics2D gfx)
context
- the EdgeRealizer context that is used for the current paintinggfx
- the graphics context to usebends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.public void paintSloppy(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.Graphics2D gfx, boolean selected)
paintSloppy
in interface GenericEdgeRealizer.Painter
context
- the EdgeRealizer context that is used for the current paintinggfx
- the graphics context to usebends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.selected
- whether or not the edge should be painted in selected state
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |