|
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 y.view.FramedEdgePainter
public class FramedEdgePainter
A GenericEdgeRealizer.Painter
implementation that draws (and
optionally fills) the outline of an edge.
This painter tries to calculate the combined outline of the edge path,
the edge's source arrow, and the edge's target arrow. However, taking the
outlines of arrows into account is supported only for shaped arrows
(i.e. Arrow.getShape()
not null
). Moreover,
even though that is the case for arrows PLAIN
,
DASH
, SKEWED_DASH
,
and T_SHAPE
, these arrows are rendered "as
usual" without being outlined.
Sample visualization for line color BLACK
, line type
LINE_4
, source arrow NONE
, and
target arrow STANDARD
:
Field Summary | |
---|---|
static java.lang.String |
PROPERTY_FILL_COLOR
Style property key to specify a fill color for framed edges. |
Constructor Summary | |
---|---|
FramedEdgePainter()
Initializes a new FramedEdgePainter instance. |
Method Summary | |
---|---|
protected java.awt.Paint |
getFillPaint(EdgeRealizer context,
boolean selected)
Determines the background paint to fill the outline of the edge. |
protected java.awt.Stroke |
getLineStroke(EdgeRealizer context,
boolean selected)
Determines the stroke used to calculate the outline of the edge. |
protected java.awt.Stroke |
getOutlineStroke(EdgeRealizer context,
boolean selected)
Determines the stroke to draw the outline of the edge. |
protected double |
getSourceArrowScaleFactor(EdgeRealizer context,
Arrow arrow,
boolean selected)
Calculates the scaling factor for the source arrow. |
protected java.awt.geom.AffineTransform |
getSourceArrowTransform(EdgeRealizer context,
java.awt.geom.GeneralPath path,
Arrow arrow,
boolean selected)
Calculates the transform that places the specified arrow at the source intersection
of the given edge realizer. |
protected double |
getTargetArrowScaleFactor(EdgeRealizer context,
Arrow arrow,
boolean selected)
Calculates the scaling factor for the target arrow. |
protected java.awt.geom.AffineTransform |
getTargetArrowTransform(EdgeRealizer context,
java.awt.geom.GeneralPath path,
Arrow arrow,
boolean selected)
Calculates the transform that places the specified arrow at the target intersection
of the given edge realizer. |
protected void |
paintBackground(EdgeRealizer context,
java.awt.Graphics2D gfx,
java.awt.geom.GeneralPath path,
java.awt.geom.GeneralPath outline,
boolean selected)
Fills the outline of the edge path (including arrow outlines). |
protected void |
paintForeground(EdgeRealizer context,
java.awt.Graphics2D gfx,
java.awt.geom.GeneralPath path,
java.awt.geom.GeneralPath outline,
boolean selected)
Draws the outline of the edge path (including arrow outlines). |
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 |
paintSourceArrow(EdgeRealizer context,
java.awt.Graphics2D gfx,
java.awt.geom.GeneralPath path,
Arrow arrow,
java.awt.geom.AffineTransform t)
Paints the source arrow if its outline could not be incorporated in the outline of the edge path. |
protected void |
paintTargetArrow(EdgeRealizer context,
java.awt.Graphics2D gfx,
java.awt.geom.GeneralPath path,
Arrow arrow,
java.awt.geom.AffineTransform t)
Paints the target arrow if its outline could not be incorporated in the outline of the edge path. |
protected void |
renderPath(EdgeRealizer context,
java.awt.Graphics2D gfx,
java.awt.geom.GeneralPath path,
boolean selected)
Renders the edge represented by the given realizer by painting the outline of the edge. |
Methods inherited from class y.view.GenericEdgePainter |
---|
adjustPath, getLinePaint, getSelectionLinePaint, getSelectionLineStroke, getSloppyLineStroke, initializeControlPolygonLine, initializeLine, initializeSelectionLine, paint, paintArrows, paintBends, paintControlPolygon, paintHighlightedBends, paintLabels, paintPorts, paintSloppy |
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 PROPERTY_FILL_COLOR
Constructor Detail |
---|
public FramedEdgePainter()
FramedEdgePainter
instance.
Method Detail |
---|
protected void paintPath(EdgeRealizer context, BendList bends, java.awt.geom.GeneralPath path, java.awt.Graphics2D gfx, boolean selected)
Calls
renderPath(EdgeRealizer, java.awt.Graphics2D, java.awt.geom.GeneralPath, boolean)
.
Note: This implementation does not call
GenericEdgePainter.paintArrows(EdgeRealizer, BendList, java.awt.geom.GeneralPath, java.awt.Graphics2D)
,
because the outlines of arrows are incorporated into the outline of the
edge path in
renderPath(EdgeRealizer, java.awt.Graphics2D, java.awt.geom.GeneralPath, boolean)
(if possible).
paintPath
in class GenericEdgePainter
context
- the visual representation of the edge to paint.bends
- the list of bends that the current context holdspath
- the GeneralPath instance that can be used to calculate a new result.gfx
- the graphics context to paint upon.selected
- whether or not the edge should be painted as selected.protected void renderPath(EdgeRealizer context, java.awt.Graphics2D gfx, java.awt.geom.GeneralPath path, boolean selected)
source arrow
and
target arrow
are incorporated
into the outline of the edge. Outlines of arrows are incorporated, if
the arrows' shape property
is not
null
. Notable exceptions to this rule are
Arrow.PLAIN
, Arrow.DASH
,
Arrow.SKEWED_DASH
, and Arrow.T_SHAPE
.
If an arrow's outline is not incorporated into the outline,
the arrow is painted as usual (see
paintSourceArrow
and
paintTargetArrow
respectively).
Calls
getSourceArrowTransform
,
getTargetArrowTransform
,
paintBackground
,
paintForeground
and if necessary
paintSourceArrow
and
paintTargetArrow
.
renderPath
in class GenericEdgePainter
context
- the visual representation of the edge to paint.gfx
- the graphics context to paint upon.path
- the GeneralPath instance that can be used to calculate a new result.selected
- whether or not the edge should be painted as selected.protected void paintForeground(EdgeRealizer context, java.awt.Graphics2D gfx, java.awt.geom.GeneralPath path, java.awt.geom.GeneralPath outline, boolean selected)
Calls getOutlineStroke(EdgeRealizer, boolean)
.
context
- the visual representation of the edge to paint.gfx
- the graphics context to paint upon.path
- the edge path that is outlined.outline
- the outline to draw.selected
- whether or not the edge should be painted as selected.protected void paintBackground(EdgeRealizer context, java.awt.Graphics2D gfx, java.awt.geom.GeneralPath path, java.awt.geom.GeneralPath outline, boolean selected)
Calls getFillPaint(EdgeRealizer, boolean)
.
context
- the visual representation of the edge to paint.gfx
- the graphics context to paint upon.path
- the edge path that is outlined.outline
- the outline to fill.selected
- whether or not the edge should be painted as selected.protected java.awt.geom.AffineTransform getSourceArrowTransform(EdgeRealizer context, java.awt.geom.GeneralPath path, Arrow arrow, boolean selected)
source intersection
of the given edge realizer.
Note: For performance reason this method may returned a
thread-local, shared instance of AffineTransform
.
Calls getSourceArrowScaleFactor(EdgeRealizer, Arrow, boolean)
.
context
- the visual representation of the edge to paint.path
- the edge path that is outlined.arrow
- the source arrow to be positioned.selected
- whether or not the edge should be painted as selected.
protected double getSourceArrowScaleFactor(EdgeRealizer context, Arrow arrow, boolean selected)
source arrow transform
to accommodate for the width of the realizer's line stroke.
context
- the visual representation of the edge to paint.arrow
- the source arrow to be scaled up.selected
- whether or not the edge should be painted as selected.
protected java.awt.geom.AffineTransform getTargetArrowTransform(EdgeRealizer context, java.awt.geom.GeneralPath path, Arrow arrow, boolean selected)
target intersection
of the given edge realizer.
Note: For performance reason this method may returned a
thread-local, shared instance of AffineTransform
.
Calls getTargetArrowScaleFactor(EdgeRealizer, Arrow, boolean)
.
context
- the visual representation of the edge to paint.path
- the edge path that is outlined.arrow
- the target arrow to be positioned.selected
- whether or not the edge should be painted as selected.
protected double getTargetArrowScaleFactor(EdgeRealizer context, Arrow arrow, boolean selected)
target arrow transform
to accommodate for the width of the realizer's line stroke.
context
- the visual representation of the edge to paint.arrow
- the target arrow to be scaled up.selected
- whether or not the edge should be painted as selected.
protected void paintSourceArrow(EdgeRealizer context, java.awt.Graphics2D gfx, java.awt.geom.GeneralPath path, Arrow arrow, java.awt.geom.AffineTransform t)
The default implementation calls arrow.paint(gfx, t)
.
Called from
renderPath
.
context
- the visual representation of the edge to paint.gfx
- the graphics context to paint upon.path
- the edge path that is outlined.arrow
- the source arrow that is rendered.t
- the transformation used for positioning the source arrow.protected void paintTargetArrow(EdgeRealizer context, java.awt.Graphics2D gfx, java.awt.geom.GeneralPath path, Arrow arrow, java.awt.geom.AffineTransform t)
The default implementation calls arrow.paint(gfx, t)
.
Called from
renderPath
.
context
- the visual representation of the edge to paint.gfx
- the graphics context to paint upon.path
- the edge path that is outlined.arrow
- the target arrow that is rendered.t
- the transformation used for positioning the target arrow.protected java.awt.Paint getFillPaint(EdgeRealizer context, boolean selected)
Called from
paintBackground
.
context
- the visual representation of the edge to paint.selected
- whether or not the edge should be painted as selected.
null
if no background
should be painted.protected java.awt.Stroke getOutlineStroke(EdgeRealizer context, boolean selected)
The default implementation uses the dash pattern of the specified edge
realizer's line type
and a line
width of 1
.
Called from
paintForeground
.
context
- the visual representation of the edge to paint.selected
- whether or not the edge should be painted as selected.
protected java.awt.Stroke getLineStroke(EdgeRealizer context, boolean selected)
The default implementation uses a solid line the width of the specified
edge realizer's line type
.
Called from
initializeLine
and
initializeSelectionLine
.
getLineStroke
in class GenericEdgePainter
context
- the EdgeRealizer context that is used for the current paintingselected
- whether or not the edge is selected
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |