public class IlvTextPath extends IlvGeneralPath implements IlvLabelInterface, IlvFontInterface
Shape
.
The text is placed on the path after flattening of the outline of the
shape.Constructor and Description |
---|
IlvTextPath(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvTextPath(IlvTextPath source)
Creates a new
IlvTextPath by copying an existing one. |
IlvTextPath(Shape shape,
String text)
Constructs a new
IlvTextPath using the specified
shape as a baseline and displaying the specified text. |
IlvTextPath(Shape shape,
String text,
int justification,
int verticalAlignment,
double baseLineShift)
Constructs a new
IlvTextPath using the specified shape
as a baseline, with the specified justification and the specified
shift from the baseline. |
Modifier and Type | Method and Description |
---|---|
protected Paint |
adaptPaint(Shape shape,
Paint paint)
This method is overridden in
IlvTextPath to deal with
auto adaptable IlvMultipleGradientPaint
instances. |
void |
baseTextDirectionChanged(int oldBaseTextDirection,
int newBaseTextDirection)
Called when the object is base text direction sensitive and the
resolved base text direction has changed.
|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
void |
componentOrientationChanged(ComponentOrientation oldOri,
ComponentOrientation newOri)
Called when the object is component orientation sensitive and the
component orientation has changed.
|
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the shape.
|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
double |
getBaselineShift()
Returns the shift perpendicular to the baseline.
|
int |
getBaseTextDirection()
Returns the base direction of the text.
|
ComponentOrientation |
getComponentOrientation()
Returns the component orientation of this object.
|
double |
getFlatness()
Returns the flatness for iterating on the path of this object.
|
Font |
getFont()
Returns the font of the object.
|
int |
getJustification()
Returns the justification of the text.
|
String |
getLabel()
Returns the label of the object.
|
IlvRect |
getLabelBBox(IlvTransformer t)
Returns the area where the label is displayed.
|
double |
getLength()
Returns the length of the shape.
|
int |
getResolvedBaseTextDirection()
Returns the resolved base text direction.
|
int |
getVerticalAlignment()
Returns the justification of the text.
|
Shape |
getVisualBounds()
Returns the visual bounds of this
IlvTextPath . |
Shape |
getVisualBounds(IlvTransformer t)
Deprecated.
Since JViews 8.9, use
getVisualBounds() . |
protected void |
invalidateBidiCache()
Mark internal caches for locale, component orientation and base
text direction invalid.
|
boolean |
isAntialiasing()
Returns
true if the anti-aliasing mode
of the label is on. |
boolean |
isBaseTextDirectionSensitive()
Returns
true because the bounding box of this object
depends on its text direction. |
boolean |
isExtendedBaseline()
Returns
true if this IlvTextPath is in
Extended baseline mode. |
boolean |
isFractionalMetrics()
Returns
true if the fractional metrics mode
of the label is on. |
boolean |
isStrokeOn()
Returns
true if the shape of the
object is stroked. |
void |
setAntialiasing(boolean set)
Changes the anti-aliasing mode of the label.
|
void |
setBaselineShift(double shift)
Sets the shift perpendicular to the baseline.
|
void |
setBaseTextDirection(int baseTextDirection)
Changes the base direction of the text.
|
void |
setExtendedBaseline(boolean set)
Changes the displaying policy of this
IlvTextPath . |
void |
setFillPaint(Paint paint)
Changes the paint object used to fill
the shape.
|
void |
setFlatness(double flatness)
Sets the flatness for iterating on the path of this
IlvTextPath . |
void |
setFont(Font font)
Changes the font of the object.
|
void |
setForeground(Color color)
Changes the foreground color of the object.
|
void |
setFractionalMetrics(boolean set)
Changes the fraction metrics mode of the label.
|
protected void |
setInternalShape(Shape shape)
Sets the internal shape.
|
void |
setJustification(int direction)
Changes the justification of the text.
|
void |
setLabel(String label)
Changes the label of this object.
|
void |
setShape(Shape shape)
Changes the shape of the object.
|
void |
setStroke(Stroke stroke)
Changes the stroke object used to stroke
the text.
|
void |
setStrokeOn(boolean set)
When set to
true , specifies that the shape of the
object is stroked. |
void |
setVerticalAlignment(int alignment)
Sets the shift policy between the text baseline and the path this
object relies on.
|
boolean |
supportMultiline()
Returns
true if the label can be a multiline label,
false otherwise. |
boolean |
usesBidiMarkers()
Returns
true if in-place editing implementation uses markers,
which should be taken into account in hit-to-point and point-to-hit
calculations. |
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
allowsPointInsertion, allowsPointMove, allowsPointRemoval, applyTransform, calcBoundingBox, getAlpha, getApplyTransformer, getClip, getFillPaint, getIntersectionWithOutline, getMaximumStrokeWidth, getOriginalShape, getPointAt, getPointsCardinal, getShape, getShapeBounds, getStroke, getStrokePaint, getTransformer, insertPoint, isContainsWhenNotFilled, isFillOn, isPaintAbsolute, isPaintZoomed, isPointEditionAllowed, isTransformedShapeMode, makeSelection, movePoint, moveResize, pointsInBBox, removePoint, resize, setAlpha, setBackground, setClip, setContainsWhenNotFilled, setFillOn, setMaximumStrokeWidth, setPaintAbsolute, setPaintZoomed, setPointEditionAllowed, setShapeBounds, setStrokePaint, setTransformedShapeMode, setTransformer
addActionListener, addNamedPropertyListener, allViewsRemoved, blinkingStateOn, boundingBox, callDraw, getAndAssociateObjectInteractor, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isPersistent, isSelectable, isVisible, localeChanged, move, move, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, rotate, scale, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, viewAddedOrRemoved, zoomable
public IlvTextPath(Shape shape, String text)
IlvTextPath
using the specified
shape as a baseline and displaying the specified text. The text is
left justified on the path, and the baseline of the text matches the path.public IlvTextPath(Shape shape, String text, int justification, int verticalAlignment, double baseLineShift)
IlvTextPath
using the specified shape
as a baseline, with the specified justification and the specified
shift from the baseline.public IlvTextPath(IlvTextPath source)
IlvTextPath
by copying an existing one.source
- The source object.public IlvTextPath(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
You should not call this
method directly; instead, you should use the write
methods of the manager.write
in interface IlvPersistentObject
write
in class IlvGeneralPath
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.protected Paint adaptPaint(Shape shape, Paint paint)
IlvTextPath
to deal with
auto adaptable IlvMultipleGradientPaint
instances. Indeed, as the IlvTextPath
is made of several
shapes, the auto adaptable will not be sufficient.adaptPaint
in class IlvGeneralPath
shape
- The shape parameter that the returned Paint
should fit.paint
- The initial Paint
object.IlvGeneralPath.isPaintAbsolute()
public final void setFlatness(double flatness)
IlvTextPath
.public final double getFlatness()
0.1
.public final void setJustification(int direction)
IlvConstants.LEFT
: left justified text.
IlvConstants.RIGHT
: right justified text.
IlvConstants.CENTER
: centered text.
public final int getJustification()
public final void setVerticalAlignment(int alignment)
IlvConstants.TOP
: The text is on top of the path.
IlvConstants.BOTTOM
: The text is under the path.
IlvConstants.CENTER
: The text is centered on the path.
IlvConstants.TOP | IlvConstants.BOTTOM
: The text
baseline and the path are merged.
public final int getVerticalAlignment()
public final void setBaselineShift(double shift)
public final double getBaselineShift()
public void setShape(Shape shape)
applyToObject
method of the manager.protected void setInternalShape(Shape shape)
setInternalShape
in class IlvGeneralPath
public void setFont(Font font)
setFont
in interface IlvFontInterface
font
- The new font.getFont()
public Font getFont()
getFont
in interface IlvFontInterface
setFont(java.awt.Font)
public final boolean isAntialiasing()
true
if the anti-aliasing mode
of the label is on.public void setAntialiasing(boolean set)
public final boolean isFractionalMetrics()
true
if the fractional metrics mode
of the label is on.public void setFractionalMetrics(boolean set)
public final boolean isExtendedBaseline()
true
if this IlvTextPath
is in
Extended baseline mode. The default is true
.public void setExtendedBaseline(boolean set)
IlvTextPath
.
Changing this mode may change the bounding box of the object.
When in Extended baseline
mode, glyphs are displayed even if they do not fit on the path limits.
Otherwise, characters that fall off the baseline are not displayed.public ComponentOrientation getComponentOrientation()
getComponentOrientation
in class IlvGraphic
IlvGraphic.isComponentOrientationSensitive()
public void setBaseTextDirection(int baseTextDirection)
IlvBidiUtil.INHERITED_DIRECTION
:
the base text direction is inherited from the
graphic bag that contains this object.
If this object is not contained in a graphic bag,
the base text direction is calculated from the
component orientation.
IlvBidiUtil.COMPONENT_DIRECTION
:
the base text direction is calculated from the
component orientation.
IlvBidiUtil.LEFT_TO_RIGHT
:
the base text direction is left-to-right.
IlvBidiUtil.RIGHT_TO_LEFT
:
the base text direction is right-to-left.
IlvBidiUtil.CONTEXTUAL_DIRECTION
:
the base test direction is determined from the text
that is displayed according to the standard Bidi
algorithm, if the text contains at least one character
with a strong left-to-right or right-to-left direction.
If the text doesn't contain any character with a strong
direction, the real text direction is determined from
the current component orientation of the object.
setBaseTextDirection
in interface IlvBaseTextDirectionInterface
setBaseTextDirection
in class IlvGraphic
baseTextDirection
- The base text directionIlvGraphic.baseTextDirectionChanged(int, int)
public int getBaseTextDirection()
IlvBidiUtil.INHERITED_DIRECTION
:
the base text direction is inherited from the
graphic bag that contains this object.
If this object is not contained in a graphic bag,
the base text direction is calculated from the
component orientation.
IlvBidiUtil.COMPONENT_DIRECTION
:
the base text direction is calculated from the
component orientation.
IlvBidiUtil.LEFT_TO_RIGHT
:
the base text direction is left-to-right.
IlvBidiUtil.RIGHT_TO_LEFT
:
the base text direction is right-to-left.
IlvBidiUtil.CONTEXTUAL_DIRECTION
:
the base test direction is determined from the text
that is displayed according to the standard Bidi
algorithm, if the text contains at least one character
with a strong left-to-right or right-to-left direction.
If the text doesn't contain any character with a strong
direction, the real text direction is determined from
the current component orientation of the object.
getBaseTextDirection
in interface IlvBaseTextDirectionInterface
getBaseTextDirection
in class IlvGraphic
public int getResolvedBaseTextDirection()
This method is similar to getBaseTextDirection()
but determines
the value when it is inherited from a parent component
(IlvBidiUtil.INHERITED_DIRECTION
) or dependent on
the component orientation (IlvBidiUtil.COMPONENT_DIRECTION
).
Hence, there are only 3 possible return values:
IlvBidiUtil.LEFT_TO_RIGHT
:
the base text direction is left-to-right.
IlvBidiUtil.RIGHT_TO_LEFT
:
the base text direction is right-to-left.
IlvBidiUtil.CONTEXTUAL_DIRECTION
:
the base test direction is determined from the text
that is displayed according to the standard Bidi
algorithm, if the text contains at least one character
with a strong left-to-right or right-to-left direction.
If the text doesn't contain any character with a strong
direction, the real text direction is determined from
the current component orientation of the object.
getResolvedBaseTextDirection
in interface IlvBaseTextDirectionInterface
getResolvedBaseTextDirection
in class IlvGraphic
protected void invalidateBidiCache()
invalidateBidiCache
in class IlvGraphic
public boolean usesBidiMarkers()
true
if in-place editing implementation uses markers,
which should be taken into account in hit-to-point and point-to-hit
calculations.usesBidiMarkers
in class IlvGraphic
public boolean isBaseTextDirectionSensitive()
true
because the bounding box of this object
depends on its text direction.isBaseTextDirectionSensitive
in class IlvGraphic
public void baseTextDirectionChanged(int oldBaseTextDirection, int newBaseTextDirection)
baseTextDirectionChanged
in class IlvGraphic
oldBaseTextDirection
- Resolved base text direction of this object before the change.newBaseTextDirection
- Resolved base text direction of this object after the change.isBaseTextDirectionSensitive()
public void componentOrientationChanged(ComponentOrientation oldOri, ComponentOrientation newOri)
componentOrientationChanged
in class IlvGraphic
oldOri
- Orientation of this object before the orientation change.newOri
- Orientation of this object after the orientation change.IlvGraphic.isComponentOrientationSensitive()
public double getLength()
public boolean isStrokeOn()
true
if the shape of the
object is stroked.isStrokeOn
in class IlvGeneralPath
setStroke(java.awt.Stroke)
,
IlvGeneralPath.setStrokePaint(java.awt.Paint)
,
setStrokeOn(boolean)
public void setStrokeOn(boolean set)
true
, specifies that the shape of the
object is stroked. Note that this may
change its bounding rectangle. For this reason,
if the object is contained inside a manager,
you should modify the shape using the applyToObject
method of the manager.setStrokeOn
in class IlvGeneralPath
set
- Set to true
to enable the stroke in your
customized graphic object.setStroke(java.awt.Stroke)
,
IlvGeneralPath.setStrokePaint(java.awt.Paint)
,
isStrokeOn()
public void setStroke(Stroke stroke)
null
to remove the
stroke. Note that changing the stroke may modify the
bounding rectangle of the object. For this reason,
if the object is contained inside a manager,
you should modify the shape using the applyToObject
method of the manager.setStroke
in class IlvGeneralPath
IlvGeneralPath.getStrokePaint()
,
IlvGeneralPath.getStroke()
,
isStrokeOn()
public void setFillPaint(Paint paint)
setFillPaint
in class IlvGeneralPath
paint
- The new filling object.IlvGeneralPath.getFillPaint()
,
IlvGeneralPath.isFillOn()
public void setForeground(Color color)
setFillPaint
on the object.setForeground
in class IlvGeneralPath
color
- The new color.setFillPaint(java.awt.Paint)
@Deprecated public Shape getVisualBounds(IlvTransformer t)
getVisualBounds()
.IlvTextPath
.
The visual bounds are a composition of the visual bounds of all
GlyphVector
needed to draw this IlvTextPath
.
It calculated the visual bounds at identity transformer, not at
input transformer. The input transformer is ignored.public Shape getVisualBounds()
IlvTextPath
.
The visual bounds are a composition of the visual bounds of all
GlyphVector
needed to draw this IlvTextPath
at identity transformer.public IlvGraphic copy()
copy
in class IlvGeneralPath
IlvGeneralPath
.IlvGraphic
public IlvRect boundingBox(IlvTransformer t)
boundingBox
in interface IlvPolyPointsInterface
boundingBox
in class IlvGeneralPath
t
- The transformer used to draw the object.IlvGeneralPath.getShapeBounds(IlvTransformer)
public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains
in class IlvGeneralPath
p
- The point to be tested.tp
- The point p
transformed by the transformer
t
.t
- The transformation that was applied to the object when it
was drawn.true
if the point lies inside this graphic object.IlvGeneralPath.isContainsWhenNotFilled()
public void draw(Graphics dst, IlvTransformer t)
draw
in class IlvGeneralPath
dst
- The destination Graphics
instance.t
- The transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public String getLabel()
getLabel
in interface IlvLabelInterface
public IlvRect getLabelBBox(IlvTransformer t)
getLabelBBox
in interface IlvLabelInterface
t
- the transformer used to draw the graphic object.public void setLabel(String label)
setLabel
in interface IlvLabelInterface
public boolean supportMultiline()
true
if the label can be a multiline label,
false
otherwise.supportMultiline
in interface IlvLabelInterface
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.