|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.AbstractCustomLabelPainter
public abstract class AbstractCustomLabelPainter
Abstract base class for YLabel.Painter
implementations.
This base class contains useful utility functions and supports
non-paraxial label bounds.
The default and the CroppingLabel
node and edge label
configurations extend this class.
Constructor Summary | |
---|---|
AbstractCustomLabelPainter()
|
Method Summary | |
---|---|
static YLabel.Painter |
asAutoFlippingPainter(YLabel.Painter painter)
Decorates an existing YLabel.Painter instance to support
automatic flipping of label content according to rotation angle. |
protected java.awt.Color |
getBackgroundColor(YLabel label,
boolean selected)
Determines the color for filling the specified label's background rectangle. |
protected java.awt.Paint |
getBackgroundPaint(YLabel label,
boolean selected)
Determines the paint for filling the specified label's background rectangle. |
protected java.awt.Color |
getLineColor(YLabel label,
boolean selected)
Determines the color for drawing the specified label's border. |
protected java.awt.Paint |
getLinePaint(YLabel label,
boolean selected)
Determines the paint for drawing the specified label's border. |
protected java.awt.Stroke |
getLineStroke(YLabel label,
boolean selected)
Determines the stroke for drawing the specified label's border. |
protected boolean |
initializeBackground(YLabel label,
java.awt.Graphics2D graphics)
This utility function can be called by subclasses to initialize the graphics context for the filling of the label's background. |
protected boolean |
initializeLine(YLabel label,
java.awt.Graphics2D graphics)
This utility function can be called by subclasses to initialize the graphics context for the drawing of the label's border. |
boolean |
isAutoFlippingEnabled()
Determines whether or not this painter should automatically flip label content depending on the label's rotation angle. |
void |
paint(YLabel label,
java.awt.Graphics2D graphics)
Paints the specified label on the specified graphics context. |
void |
paintBox(YLabel label,
java.awt.Graphics2D graphics,
double x,
double y,
double width,
double height)
Paints the background of the specified label on the specified graphics context. |
protected void |
paintSelectionBox(YLabel label,
java.awt.Graphics2D graphics,
double x,
double y,
double width,
double height)
Paints a selection frame for the specified label if the label's selection state is true . |
void |
setAutoFlippingEnabled(boolean enabled)
Specifies whether or not this painter should automatically flip label content depending on the label's rotation angle. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface y.view.YLabel.Painter |
---|
getIconBox, getTextBox, paintContent |
Constructor Detail |
---|
public AbstractCustomLabelPainter()
Method Detail |
---|
public boolean isAutoFlippingEnabled()
By default, this property is set to false
.
true
if this painter automatically flips label
content depending on the label's rotation angle and false
otherwise.setAutoFlippingEnabled(boolean)
,
asAutoFlippingPainter(y.view.YLabel.Painter)
public void setAutoFlippingEnabled(boolean enabled)
By default, this property is set to false
.
enabled
- if true
, this painter will automatically flip
label content depending on the label's rotation angle.setAutoFlippingEnabled(boolean)
,
asAutoFlippingPainter(y.view.YLabel.Painter)
public void paint(YLabel label, java.awt.Graphics2D graphics)
content
and then delegates painting to
YLabel.paintImpl(java.awt.Graphics2D, double, double, double, double)
.
paint
in interface YLabel.Painter
label
- the label to paint.graphics
- the graphics context to paint upon.public void paintBox(YLabel label, java.awt.Graphics2D graphics, double x, double y, double width, double height)
initializeBackground(YLabel, java.awt.Graphics2D)
.
Then fill the rectangle.initializeLine(YLabel, java.awt.Graphics2D)
.
Then draw the rectangle.paintSelectionBox(YLabel, java.awt.Graphics2D, double, double, double, double)
to paint selection decorations.
paintBox
in interface YLabel.Painter
label
- the label to paint.graphics
- the graphics context to paint upon.x
- the x-coordinate of the upper left corner of the label's
background rectangle.y
- the y-coordinate of the upper left corner of the label's
background rectangle.width
- the width of the label's background rectangle.height
- the height of the label's background rectangle.protected void paintSelectionBox(YLabel label, java.awt.Graphics2D graphics, double x, double y, double width, double height)
selection state
is true
.
label
- the label to paint.graphics
- the graphics context to paint upon.x
- the x-coordinate of the upper left corner of the label's
background rectangle.y
- the y-coordinate of the upper left corner of the label's
background rectangle.width
- the width of the label's background rectangle.height
- the height of the label's background rectangle.protected boolean initializeBackground(YLabel label, java.awt.Graphics2D graphics)
false
the background should not be
filled.
Calls getBackgroundPaint(YLabel, boolean)
to determine the
paint for filling the background.
label
- the label to paint.graphics
- the graphics context to configure.
true
if the label background should be filled and
false
otherwise.protected java.awt.Paint getBackgroundPaint(YLabel label, boolean selected)
initializeBackground(YLabel, java.awt.Graphics2D)
.
The default implementation delegates to
getBackgroundColor(YLabel, boolean)
.
label
- the label to paint.selected
- the selection state of the label.
protected java.awt.Color getBackgroundColor(YLabel label, boolean selected)
getBackgroundPaint(YLabel, boolean)
.
label
- the label to paint.selected
- the selection state of the label.
protected boolean initializeLine(YLabel label, java.awt.Graphics2D graphics)
false
no border should be drawn.
Calls getLinePaint(YLabel, boolean)
and
getLineStroke(YLabel, boolean)
to determine the paint and stroke
for drawing the border.
label
- the label to paint.graphics
- the graphics context to configure.
true
if the label border should be drawn
and false
otherwise.protected java.awt.Stroke getLineStroke(YLabel label, boolean selected)
initializeLine(YLabel, java.awt.Graphics2D)
.
label
- the label to paint.selected
- the selection state of the label.
protected java.awt.Paint getLinePaint(YLabel label, boolean selected)
initializeLine(YLabel, java.awt.Graphics2D)
.
The default implementation delegates to
getLineColor(YLabel, boolean)
.
label
- the label to paint.selected
- the selection state of the label.
protected java.awt.Color getLineColor(YLabel label, boolean selected)
getBackgroundColor(YLabel, boolean)
.
label
- the label to paint.selected
- the selection state of the label.
public static YLabel.Painter asAutoFlippingPainter(YLabel.Painter painter)
YLabel.Painter
instance to support
automatic flipping of label content according to rotation angle.
painter
- the YLabel.Painter
instance to decorate.
YLabel.Painter
instance that supports
automatic flipping of label content according to rotation angle.isAutoFlippingEnabled()
,
setAutoFlippingEnabled(boolean)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |