public class IlvZoomableLabel extends IlvBidiGraphic implements IlvFontInterface, IlvLabelInterface
IlvText
except if you need some IlvZoomableLabel
specific features such
as stroked letters.Constructor and Description |
---|
IlvZoomableLabel()
Creates a new
IlvZoomableLabel with the lower-left corner
in (0, 0) and an empty label. |
IlvZoomableLabel(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvZoomableLabel(IlvPoint position,
String label)
Creates a new
IlvZoomableLabel instance. |
IlvZoomableLabel(IlvPoint position,
String label,
boolean compatibility)
Creates a new
IlvZoomableLabel instance. |
IlvZoomableLabel(IlvZoomableLabel source)
Copy constructor of
IlvZoomableLabel . |
Modifier and Type | Method and Description |
---|---|
protected Paint |
adaptPaint(Shape shape,
Paint paint)
Returns a
new
Paint object that will fit the shape parameter
according to the initial paint parameter. |
void |
applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object.
|
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 outline of the object.
|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
Paint |
getBackgroundPaint()
Returns the paint object used to fill the background rectangle.
|
double |
getBottomMargin()
Returns the bottom margin of the box around the label.
|
IlvPoint |
getCenter()
Returns the center of the label.
|
Shape |
getClip()
Returns the shape that will clip the object.
|
Paint |
getFillPaint()
Returns the paint object used to draw the label text.
|
Font |
getFont()
Returns the font of the object.
|
int |
getJustification()
Returns the justification of the text.
|
String |
getLabel()
Returns the label.
|
IlvRect |
getLabelBBox(IlvTransformer t)
Returns the bounding area where the label is displayed.
|
double |
getLeftMargin()
Returns the left margin of the box around the label.
|
double |
getMultilineSpacing()
Returns the additional spacing to separate adjacent lines of a multiline
label.
|
double |
getRightMargin()
Returns the right margin of the box around the label.
|
Stroke |
getStroke()
Returns the stroke object used when stroking the path.
|
Paint |
getStrokePaint()
Returns the paint object used when stroking the path.
|
double |
getTopMargin()
Returns the top margin of the box around the label.
|
IlvTransformer |
getTransformer()
Returns the transformation used to draw the label.
|
boolean |
isAntialiasing()
Returns
true if the anti-aliasing mode
of the label is on. |
boolean |
isBackgroundOn()
Returns
true if the background of the
object will be filled. |
boolean |
isBaseTextDirectionSensitive()
Returns
true because the bounding box of this object
depends on its text direction. |
boolean |
isBorderOn()
Returns
true if the border of the object will be drawn. |
boolean |
isFillOn()
Returns
true if the inside of the
text will be filled. |
boolean |
isFractionalMetrics()
Returns
true if the fractional metrics mode
of the label is on. |
boolean |
isPaintAbsolute()
Returns
false if the TexturePaint or
GradientPaint will be adapted to the bounding rectangle of the
object. |
boolean |
isStrokeOn()
Returns
true if the outline of the text of the
object is stroked. |
static boolean |
IsTransformerDependentRendering()
Returns whether all
IlvZoomableLabel objects are rendered with
a strategy that requires rerendering when the transformer changes. |
void |
moveResize(IlvRect size)
Resizes the object.
|
void |
resize(double neww,
double newh)
Resizes the object.
|
void |
setAntialiasing(boolean set)
Changes the anti-aliasing mode of the label.
|
void |
setBackgroundOn(boolean set)
If set to
true the background of the
object will be filled. |
void |
setBackgroundPaint(Paint paint)
Changes the paint object used to fill the background rectangle.
|
void |
setBorderOn(boolean set)
If
true , specifies that the border of the
object will be drawn. |
void |
setBottomMargin(double margin)
Sets the bottom margin of the box around the label.
|
void |
setCenter(IlvPoint pt)
Changes the center of the label.
|
void |
setClip(Shape clip)
Changes the shape that will clip the object.
|
void |
setFillOn(boolean set)
If
true , specifies that the inside of the
text will be filled. |
void |
setFillPaint(Paint paint)
Changes the paint object used to draw the label text.
|
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.
|
void |
setJustification(int direction)
Changes the justification of the multiline text.
|
void |
setLabel(String label)
Changes the label.
|
void |
setLeftMargin(double margin)
Sets the left margin of the box around the label.
|
void |
setMultilineSpacing(double spacing)
Sets the additional spacing to separate adjacent lines of a multiline
label.
|
void |
setPaintAbsolute(boolean set)
When set to
false , specifies that the
TexturePaint or GradientPaint will be adapted to
the bounding rectangle of the object. |
void |
setRightMargin(double margin)
Sets the right margin of the box around the label.
|
void |
setStroke(Stroke stroke)
Changes the stroke object used when stroking the path.
|
void |
setStrokeOn(boolean set)
When set to
true , specifies that the outline of the text
of the object is stroked. |
void |
setStrokePaint(Paint paint)
Changes the paint object used when stroking the path.
|
void |
setTopMargin(double margin)
Sets the top margin of the box around the label.
|
void |
setTransformer(IlvTransformer t)
Sets the transformation used to draw the label.
|
static void |
SetTransformerDependentRendering(boolean flag)
Sets whether all
IlvZoomableLabel objects are rendered with
a strategy that requires rerendering when the transformer changes. |
boolean |
supportMultiline()
Returns
true
since this object supports multiline text. |
String |
toString()
Returns a string representation of the graphic object.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
calcResolvedBaseTextDirection, getBaseTextDirection, getComponentOrientation, getResolvedBaseTextDirection, getULocale, invalidateBidiCache, setBaseTextDirection, setBaseTextDirection, setBaseTextDirectionDuringConstruction
addActionListener, addNamedPropertyListener, allViewsRemoved, blinkingStateOn, boundingBox, callDraw, getAndAssociateObjectInteractor, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isPersistent, isSelectable, isVisible, localeChanged, makeSelection, move, move, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, rotate, scale, setBackground, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved, zoomable
public IlvZoomableLabel()
IlvZoomableLabel
with the lower-left corner
in (0, 0)
and an empty label.IlvZoomableLabel(IlvPoint, String)
public IlvZoomableLabel(IlvPoint position, String label, boolean compatibility)
IlvZoomableLabel
instance. If the compatibility
parameter is set to true
, the object, when drawn without
stroke and filled with a simple color,
is drawn using the Graphics.drawString
primitive as in Perforce
JViews versions prior to Perforce JViews 3.5.
Under some conditions, such a drawing method does not provide a fully
zoomable drawing; this may lead in some cases to minor errors in
the bounding box computation.
If the compatibility
parameter is set to false
,
the object is always drawn using the shape
of the glyphs. In this case, the bounding box will always be flawless but
the rendering may not be exactly the same as with the compatibility flag.IlvZoomableLabel(IlvPoint,String)
,
IlvGraphic.zoomable()
public IlvZoomableLabel(IlvPoint position, String label)
IlvZoomableLabel
instance. It calls the other
constructor with the compatibility flag set.position
- The lower-left corner of the label.label
- The text of the label.public IlvZoomableLabel(IlvZoomableLabel source)
IlvZoomableLabel
.source
- The object that is copied.public IlvZoomableLabel(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.public void setCenter(IlvPoint pt)
public IlvPoint getCenter()
public IlvRect getLabelBBox(IlvTransformer t)
getLabelBBox
in interface IlvLabelInterface
t
- The transformer used to draw the object.public void resize(double neww, double newh)
neww
, newh
).
This method calls the applyTransform
method.resize
in class IlvGraphic
neww
- The new horizontal width.newh
- The new horizontal height.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public void moveResize(IlvRect size)
IlvRect
parameter.
This method calls the applyTransform
method.moveResize
in class IlvGraphic
size
- The new bounding rectangle of the object.IlvGraphic
,
IlvGraphic.applyTransform(IlvTransformer)
public IlvTransformer getTransformer()
public void setTransformer(IlvTransformer t)
getClip()
)
node the center (see getCenter()
) are adapted, hence it is
in general more useful to call the higher level methods moveResize(ilog.views.IlvRect)
or applyTransform(ilog.views.IlvTransformer)
.
Note that this method may change its bounding rectangle. For this reason,
if the object is contained inside a manager, you should modify the font
using the applyToObject
method of the manager.t
- The new transformer.getTransformer()
public IlvRect boundingBox(IlvTransformer t)
boundingBox
in class IlvGraphic
t
- The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains
in class IlvGraphic
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.IlvGraphic
public IlvGraphic copy()
copy
in class IlvGraphic
IlvGraphic
public String getLabel()
getLabel
in interface IlvLabelInterface
setLabel(java.lang.String)
public void setLabel(String label)
applyToObject
method of the manager.setLabel
in interface IlvLabelInterface
label
- The new label.getLabel()
public boolean supportMultiline()
true
since this object supports multiline text.supportMultiline
in interface IlvLabelInterface
public final boolean isAntialiasing()
true
if the anti-aliasing mode
of the label is on.public void setAntialiasing(boolean set)
applyToObject
method of the manager.public final boolean isFractionalMetrics()
true
if the fractional metrics mode
of the label is on.public void setFractionalMetrics(boolean set)
applyToObject
method of the manager.public Font getFont()
getFont
in interface IlvFontInterface
setFont(java.awt.Font)
public void setFont(Font font)
applyToObject
method of the manager.setFont
in interface IlvFontInterface
font
- The new font.getFont()
public Shape getClip()
null
if no clip is applied. The shape is modified when a
transformation is applied to the object.public void setClip(Shape clip)
null
if no clip is applied.clip
- The new clip.public void setForeground(Color color)
setFillPaint
on the object.setForeground
in class IlvGraphic
color
- The new color.setFillPaint(java.awt.Paint)
public Paint getFillPaint()
setFillPaint(java.awt.Paint)
public void setFillPaint(Paint paint)
applyToObject
method of the manager.
This property supports
IlvBlinkingPaint
.paint
- The new filling object.getFillPaint()
,
isFillOn()
public Paint getStrokePaint()
setStrokePaint(java.awt.Paint)
,
setStroke(java.awt.Stroke)
public void setStrokePaint(Paint paint)
IlvBlinkingPaint
.paint
- the new paint object.getStrokePaint()
,
isStrokeOn()
,
isBorderOn()
,
setStroke(java.awt.Stroke)
public boolean isFillOn()
true
if the inside of the
text will be filled.setFillPaint(java.awt.Paint)
,
setFillOn(boolean)
public void setFillOn(boolean set)
true
, specifies that the inside of the
text will be filled.setFillOn
in class IlvGraphic
set
- Set to true
to enable the fill style for this
graphic object.isFillOn()
,
setFillPaint(java.awt.Paint)
public boolean isStrokeOn()
true
if the outline of the text of the
object is stroked.setStroke(java.awt.Stroke)
,
setStrokePaint(java.awt.Paint)
,
setStrokeOn(boolean)
public void setStrokeOn(boolean set)
true
, specifies that the outline of the text
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 this flag
using the applyToObject
method of the manager.setStrokeOn
in class IlvGraphic
set
- Set to true
to enable the stroke in your
customized graphic object.setStroke(java.awt.Stroke)
,
setStrokePaint(java.awt.Paint)
,
isStrokeOn()
public Stroke getStroke()
null
if there is
no stroke specified.getStrokePaint()
,
setStroke(java.awt.Stroke)
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 stroke using the applyToObject
method of the manager.getStrokePaint()
,
getStroke()
,
isStrokeOn()
,
isBorderOn()
public void setBackgroundPaint(Paint paint)
IlvBlinkingPaint
.paint
- The new paint object.getBackgroundPaint()
public Paint getBackgroundPaint()
setBackgroundPaint(java.awt.Paint)
public boolean isBackgroundOn()
true
if the background of the
object will be filled.setBackgroundPaint(java.awt.Paint)
,
setBackgroundOn(boolean)
public void setBackgroundOn(boolean set)
true
the background of the
object will be filled.
Note that this may change its bounding rectangle.
For this reason, if the object is contained inside a manager
you should modify this flag using the applyToObject
method of the manager.isBackgroundOn()
,
setBackgroundPaint(java.awt.Paint)
public boolean isBorderOn()
true
if the border of the object will be drawn.
This method uses the stroke paint and the stroke for drawing the border.setStrokePaint(java.awt.Paint)
,
setStroke(java.awt.Stroke)
,
setBorderOn(boolean)
public void setBorderOn(boolean set)
true
, specifies that the border of the
object will be drawn.
This method uses the stroke paint and the stroke for drawing the border.
Note that this may change its bounding rectangle.
For this reason, if the object is contained inside a manager
you should modify this flag using the applyToObject
method of the manager.isBorderOn()
,
setStrokePaint(java.awt.Paint)
,
setStroke(java.awt.Stroke)
public boolean isPaintAbsolute()
false
if the TexturePaint
or
GradientPaint
will be adapted to the bounding rectangle of the
object. The default value is false
. This value does not
affect automatically adjusted Paint
such as
ilog.views.java2d.IlvLinearGradientPaint
.public void setPaintAbsolute(boolean set)
false
, specifies that the
TexturePaint
or GradientPaint
will be adapted to
the bounding rectangle of the object.
The default value is false
. This value does not affect
automatically adjusted Paint
such as
ilog.views.java2d.IlvLinearGradientPaint
.protected Paint adaptPaint(Shape shape, Paint paint)
Paint
object that will fit the shape parameter
according to the initial paint parameter.
This method is called only if isPaintAbsolute()
returns
false
.
By default, it deals with GradientPaint
and
TexturePaint
instances to adapt them correctly because they
do not automatically fit the shape of the object on which they are drawn.
You can override this method to manage your own Paint
subclasses if they do not take the shape of the object into account. You
will generally call the superclass method for GradientPaint
and TexturePaint
instances.
Other Paint
objects deriving from
IlvMultipleGradientPaint
automatically take into
account the shape of the object if their
IlvMultipleGradientPaint.isAdapting()
method
returns true
and thus are not modified by this method.shape
- The shape parameter that the returned Paint
should fit.paint
- The initial Paint
object.isPaintAbsolute()
public void setLeftMargin(double margin)
applyToObject
method of the manager.public double getLeftMargin()
public void setRightMargin(double margin)
applyToObject
method of the manager.public double getRightMargin()
public void setTopMargin(double margin)
applyToObject
method of the manager.public double getTopMargin()
public void setBottomMargin(double margin)
applyToObject
method of the manager.public double getBottomMargin()
public void setJustification(int direction)
IlvConstants.LEFT
: left justified text.
IlvConstants.RIGHT
: right justified text.
IlvConstants.CENTER
: centered text.
public final int getJustification()
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 final void setMultilineSpacing(double spacing)
applyToObject
method of the manager.public final double getMultilineSpacing()
public void draw(Graphics dst, IlvTransformer t)
draw
in class IlvGraphic
dst
- The destination Graphics.t
- The transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public void applyTransform(IlvTransformer t)
applyTransform
in class IlvGraphic
t
- The transformer to be applied.IlvGraphic
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 IlvGraphic
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.public String toString()
IlvGraphic.toString()
with the label
(see getLabel()
).toString
in class IlvGraphic
IlvGraphic.getName()
public static void SetTransformerDependentRendering(boolean flag)
IlvZoomableLabel
objects are rendered with
a strategy that requires rerendering when the transformer changes.
This is slower and uses more memory per label,
but some Chinese and Japanese fonts cannot be rendered
with the faster default strategy where the rendering is precalculated
regardless the transformer.
In JDK 1.4, the slow transformer dependent mode was not required.
In JDK 1.5 and later, the slow mode might be required. This depends
on the operating system, on the available fonts, and
on the status of Sun's bug list related to Chinese and Japanese rendering.
The default value is false
.
public static boolean IsTransformerDependentRendering()
IlvZoomableLabel
objects are rendered with
a strategy that requires rerendering when the transformer changes.
This is slower and uses more memory per label,
but some Chinese and Japanese fonts cannot be rendered
with the faster default strategy where the rendering is precalculated
regardless the transformer.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.