public class IlvShadowLabel extends IlvShadowRectangle implements IlvFontInterface, IlvLabelInterface
IlvShadowLabel represents a labeled rectangle with a shadow.
The default values for an IlvShadowLabel instance are as
follows:
Color.blackColor.blackIlvRect(0, 0, 100, 100)2IlvConstants.BOTTOM_RIGHTIlvToolkit.defaultFontThe default foreground and background colors are black. You must change one of these colors for the label to be visible.
Note: calls to the following methods result in a
RuntimeException being thrown:
setCorners(int)setFillOn(boolean)setRadius(int)setStrokeOn(boolean)
The following code example shows how to use an IlvShadowLabel in a
simple Java application:
IlvManager manager = new IlvManager();
IlvShadowLabel myDefaultRect = new IlvShadowLabel();
IlvShadowLabel myCustomRect = new IlvShadowLabel(
new IlvRect(60,90,80,20),
"My Custom Shadow Label",
6, IlvConstants.TOP_LEFT);
myCustomRect.setForeground(Color.blue);
myCustomRect.setBackground(Color.yellow);
myCustomRect.setFont(new Font("SansSerif", Font.BOLD, 14));
manager.addObject( myDefaultRect, true);
manager.addObject( myCustomRect, true);
The following image shows the graphic objects created in the code example:
IlvShadowLabel is a custom graphic object, that is, a subclass of
IlvGraphic. Graphic objects are controlled using an
IlvManager instance and displayed using one or more
IlvManagerView instances in a Java Swing application.
For information about generic features for graphic objects, see
IlvGraphic.IlvRect,
IlvManager,
IlvManagerView,
Serialized FormBOTTOM_LEFT, BOTTOM_RIGHT, drawrect, TOP_LEFT, TOP_RIGHT| Constructor and Description |
|---|
IlvShadowLabel()
Creates a new
IlvShadowLabel with a (0, 0, 100, 100)
definition rectangle, an empty label, a thickness of 2 and a IlvConstants.BOTTOM_RIGHT
shadow position. |
IlvShadowLabel(IlvInputStream stream)
Reads the object from an
IlvInputStream. |
IlvShadowLabel(IlvPoint at,
String label,
double thickness,
double hMargin,
double vMargin,
int shadowPosition)
Creates a new
IlvShadowLabel at a specified position and
with specified label, thickness, margins, and shadow position. |
IlvShadowLabel(IlvRect rect,
String label,
double thickness,
int shadowPosition)
Creates a new
IlvShadowLabel with a specified definition
rectangle, label, thickness, and shadow position. |
IlvShadowLabel(IlvShadowLabel source)
Creates a new
IlvShadowLabel by copying an existing one. |
| Modifier and Type | Method and Description |
|---|---|
void |
baseTextDirectionChanged(int oldBaseTextDirection,
int newBaseTextDirection)
Called when the object is base text direction sensitive and the
resolved base text direction has changed.
|
void |
componentOrientationChanged(ComponentOrientation oldOri,
ComponentOrientation newOri)
Called when the object is component orientation sensitive and the
component orientation has changed.
|
IlvGraphic |
copy()
Copies the object.
|
protected void |
drawContent(Graphics dst,
IlvRect rect,
IlvTransformer t)
Draws the inner part of the object.
|
void |
drawLabel(Graphics dst,
IlvRect rect,
IlvTransformer t)
Draws the label inside the shadow rectangle.
|
void |
fitToLabel(double hMargin,
double vMargin)
Recomputes the size of the object according to the current
label and using the specified horizontal and vertical margins.
|
int |
getBaseTextDirection()
Returns the base direction of the text.
|
ComponentOrientation |
getComponentOrientation()
Returns the component orientation of this object.
|
Font |
getFont()
Returns the font of the object.
|
String |
getLabel()
Returns the label of the object.
|
IlvRect |
getLabelBBox(IlvTransformer t)
Returns the bounding area within which the label is displayed.
|
int |
getResolvedBaseTextDirection()
Returns the resolved base text direction.
|
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 text is on. |
boolean |
isBaseTextDirectionSensitive()
Returns
true because the bounding box of this object
depends on its text direction. |
void |
setAntialiasing(boolean set)
Changes the anti-aliasing mode of the text.
|
void |
setBaseTextDirection(int baseTextDirection)
Changes the base direction of the text.
|
void |
setFont(Font font)
Changes the font of the object.
|
void |
setLabel(String label)
Changes the label of the object.
|
boolean |
supportMultiline()
Returns
false
since this object does not support multiline text. |
String |
toString()
Returns a string representation of the graphic object.
|
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. |
draw, getShadowPosition, getThickness, setCorners, setFillOn, setRadius, setShadowPosition, setStrokeOn, setThicknessapplyTransform, boundingBox, contains, getBackground, getCorners, getDefinitionRect, getForeground, getIntersectionWithOutline, getRadius, isCornersZoomable, isFillOn, isStrokeOn, moveResize, resize, setBackground, setCornersZoomable, setDefinitionRect, setForeground, translateaddActionListener, 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, makeSelection, 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, updateNeedsViewNotification, viewAddedOrRemoved, zoomablepublic IlvShadowLabel()
IlvShadowLabel with a (0, 0, 100, 100)
definition rectangle, an empty label, a thickness of 2 and a IlvConstants.BOTTOM_RIGHT
shadow position.IlvShadowLabel(IlvRect, String, double, int)public IlvShadowLabel(IlvRect rect, String label, double thickness, int shadowPosition)
IlvShadowLabel with a specified definition
rectangle, label, thickness, and shadow position.rect - The definition rectangle of the object.label - The label.thickness - The thickness of the shadow.shadowPosition - The position of the shadow.
Valid values are IlvConstants.TOP_LEFT,
IlvConstants.BOTTOM_LEFT, IlvConstants.TOP_RIGHT,
and IlvConstants.BOTTOM_RIGHT.setLabel(java.lang.String),
IlvShadowRectangle.setThickness(double),
IlvShadowRectangle.setShadowPosition(int)public IlvShadowLabel(IlvPoint at, String label, double thickness, double hMargin, double vMargin, int shadowPosition)
IlvShadowLabel at a specified position and
with specified label, thickness, margins, and shadow position.
This constructor computes the definition rectangle of the object using the
method fitToLabel(double, double), which preserves the specified margins around
the label.at - The upper-left point of the object.label - The label.thickness - The thickness of the shadow.hMargin - The margin that is preserved on the left and right
sides of the label.vMargin - The margin that is preserved on the top and bottom
sides of the label.shadowPosition - The position of the shadow.
Valid values are IlvConstants.TOP_LEFT,
IlvConstants.BOTTOM_LEFT, IlvConstants.TOP_RIGHT,
and IlvConstants.BOTTOM_RIGHT.setLabel(java.lang.String),
IlvShadowRectangle.setThickness(double),
IlvShadowRectangle.setShadowPosition(int),
fitToLabel(double, double)public IlvShadowLabel(IlvShadowLabel source)
IlvShadowLabel by copying an existing one.source - The copied object.public IlvShadowLabel(IlvInputStream stream) throws IlvReadFileException
IlvInputStream.stream - The input stream.IlvReadFileException - if the format is not correct.public IlvGraphic copy()
copy in class IlvShadowRectangleIlvGraphicpublic String getLabel()
getLabel in interface IlvLabelInterfacepublic void setLabel(String label)
setLabel in interface IlvLabelInterfacepublic void fitToLabel(double hMargin,
double vMargin)
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean).hMargin - The margin to be preserved on the left and right
sides of the bounding box of the label.vMargin - The margin to be preserved on the top and bottom
sides of the bounding box of the label.getLabel()public Font getFont()
getFont in interface IlvFontInterfacepublic void setFont(Font font)
setFont in interface IlvFontInterfacefont - The new font.public ComponentOrientation getComponentOrientation()
getComponentOrientation in class IlvGraphicIlvGraphic.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 IlvBaseTextDirectionInterfacesetBaseTextDirection in class IlvGraphicbaseTextDirection - 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 IlvBaseTextDirectionInterfacegetBaseTextDirection in class IlvGraphicpublic int getResolvedBaseTextDirection()
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 IlvBaseTextDirectionInterfacegetResolvedBaseTextDirection in class IlvGraphicprotected void invalidateBidiCache()
invalidateBidiCache in class IlvGraphicpublic 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 IlvGraphicpublic boolean isBaseTextDirectionSensitive()
true because the bounding box of this object
depends on its text direction.isBaseTextDirectionSensitive in class IlvGraphicpublic void baseTextDirectionChanged(int oldBaseTextDirection,
int newBaseTextDirection)
baseTextDirectionChanged in class IlvGraphicoldBaseTextDirection - 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 IlvGraphicoldOri - Orientation of this object before the orientation change.newOri - Orientation of this object after the orientation change.IlvGraphic.isComponentOrientationSensitive()public final boolean isAntialiasing()
true if the anti-aliasing mode
of the text is on.public final void setAntialiasing(boolean set)
public boolean supportMultiline()
false
since this object does not support multiline text.supportMultiline in interface IlvLabelInterfacepublic IlvRect getLabelBBox(IlvTransformer t)
getLabelBBox in interface IlvLabelInterfacet - The transformer used to draw the object.public void drawLabel(Graphics dst, IlvRect rect, IlvTransformer t)
dst - The destination Graphics.rect - The rectangle defining the inner part of the shadow rectangle
(that is, the bounding box with the relief shadow removed). Note that
this rectangle is already transformed by the transformer used to draw
the object.t - The transformation used to draw the object.protected void drawContent(Graphics dst, IlvRect rect, IlvTransformer t)
drawContent of the class IlvShadowRectangle to
draw the label of the object.drawContent in class IlvShadowRectangledst - The Graphics to perform the drawing.rect - The rectangle defining the inner part of the shadow rectangle
(that is, the bounding box with the relief shadow removed). Note that
this rectangle is already transformed by the transformer used to draw
the object.t - The transformer used to draw the object.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 IlvPersistentObjectwrite in class IlvShadowRectanglestream - 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 IlvGraphicIlvGraphic.getName()© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.