public class IlvHTMLText extends IlvGraphic
IlvHTMLText
represents a piece of text specified as a HTML
string.
Note: The setForeground
method has
no effect in this class. In order to set the text color, you can use
color
style attribute of the
<body>
element.
Example: <body style="color: #FF5010;">
text
attribute of the <body>
tag.
Example: <body text="#FF5010">
. (Deprecated.)
Note: The setBackground
method has
no effect in this class. In order to set the background color, you can use
background-color
style attribute of the
<body>
element.
Example: <body style="background-color: #663333;">
bgcolor
attribute of the <body>
tag.
Example: <body bgcolor="#663333">
. (Deprecated.)
Limitations:
text-decoration: blink
is unsupported.dir="rtl"
or dir="ltr"
is unsupported. Instead, you have to use the Unicode control
characters LRE (‪
),
RLE (‫
), and
PDF (‬
).Constructor and Description |
---|
IlvHTMLText()
Creates an initially empty HTML text.
|
IlvHTMLText(IlvInputStream stream)
Creates an
IlvHTMLText instance from the contents of an
IlvInputStream . |
IlvHTMLText(String htmlText)
Creates a HTML text that displays a given HTML string.
|
Modifier and Type | Method and Description |
---|---|
void |
addHTMLInteractionListener(HTMLInteractionListener listener)
Adds an interaction listener to this object.
|
void |
applyTransform(IlvTransformer t)
Applies an additional transformation to the rendering of the
IlvHTMLText . |
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of this
IlvHTMLText . |
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the outline of the object.
|
IlvGraphic |
copy()
Returns a copy of this
IlvHTMLText instance. |
void |
draw(Graphics g,
IlvTransformer t)
Draws this
IlvHTMLText object. |
float |
getBottomMargin()
Returns the bottom margin of the box around the text.
|
Font |
getDefaultFont()
Returns the default font used for rendering text.
|
String |
getHTMLText()
Returns the HTML string that is displayed by this
IlvHTMLText
object. |
float |
getLeftMargin()
Returns the left margin of the box around the text.
|
float |
getPageWidth()
Returns the page width.
|
float |
getRightMargin()
Returns the right margin of the box around the text.
|
float |
getTopMargin()
Returns the top margin of the box around the text.
|
boolean |
isAntiAliasing()
Returns
true if the anti-aliasing mode
of the text is on. |
boolean |
isFractionalMetrics()
Returns
true if the fractional metrics mode
of the text is on. |
void |
processMouseClicked(MouseEvent event,
IlvTransformer transformToView)
This method is invoked when a mouse click on this object happened.
|
void |
removeHTMLInteractionListener(HTMLInteractionListener listener)
Removes an interaction listener from this object.
|
void |
setAntiAliasing(boolean set)
Changes the anti-aliasing mode of the text.
|
void |
setBottomMargin(float margin)
Sets the bottom margin of the box around the text.
|
void |
setDefaultFont(Font font)
Changes the default font used for rendering text.
|
void |
setFractionalMetrics(boolean set)
Changes the fractional metrics mode of the text.
|
void |
setHTMLText(String text)
Sets the HTML string that is displayed by this
IlvHTMLText
object. |
void |
setLeftMargin(float margin)
Sets the left margin of the box around the text.
|
void |
setPageWidth(float pageWidth)
Sets the page width.
|
void |
setRightMargin(float margin)
Sets the right margin of the box around the text.
|
void |
setTopMargin(float margin)
Sets the top margin of the box around the text.
|
void |
write(IlvOutputStream stream)
Writes the contents of this
IlvHTMLText to an IVL file. |
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getResolvedBaseTextDirection, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, inside, intersects, invalidateBBoxCache, invalidateBidiCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isPersistent, isSelectable, isVisible, localeChanged, makeSelection, move, move, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setForeground, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved, zoomable
public IlvHTMLText()
public IlvHTMLText(String htmlText)
htmlText
- A string in HTML syntax. The <html>
and <body>
tags are optional.public IlvHTMLText(IlvInputStream stream) throws IlvReadFileException
IlvHTMLText
instance from the contents of an
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.public String getHTMLText()
IlvHTMLText
object.public void setHTMLText(String text)
IlvHTMLText
object.text
- A string in HTML syntax. The <html>
and <body>
tags are optional.public final boolean isFractionalMetrics()
true
if the fractional metrics mode
of the text is on. The default value is true
. Setting
it to false
will speed up the IlvHTMLText
but may
lead to less precise text positioning.public void setFractionalMetrics(boolean set)
true
. Setting it to false
will speed up the
IlvHTMLText
but may lead to less precise text positioning.
Note that this method call may change the 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.
public final boolean isAntiAliasing()
true
if the anti-aliasing mode
of the text is on. The default value is false
.public void setAntiAliasing(boolean set)
false
.
Note that this method call may change the 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.
public Font getDefaultFont()
public void setDefaultFont(Font font)
Note that this method call may change the 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.
public float getPageWidth()
public void setPageWidth(float pageWidth)
The default value is 800.
Note that this method call may change the 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.
public final float getLeftMargin()
0
.setLeftMargin(float)
public void setLeftMargin(float margin)
0
.
Note that this margin is not filled with the background color.
If you want a margin that is filled with the background color,
use the margin-left
and background-color
style
attributes of the <body>
element. Example:
<body style="background-color: #663333; margin-left:10px;">
Note that this method call may change the bounding rectangle.
For this reason, if the object is contained inside a manager
you should modify the parameter using the applyToObject
method of the manager.
public final float getRightMargin()
0
.setRightMargin(float)
public void setRightMargin(float margin)
0
.
Note that this margin is not filled with the background color.
If you want a margin that is filled with the background color,
use the margin-right
and background-color
style
attributes of the <body>
element. Example:
<body style="background-color: #663333; margin-right:10px;">
Note that this method call may change the bounding rectangle.
For this reason, if the object is contained inside a manager
you should modify the parameter using the applyToObject
method of the manager.
public final float getTopMargin()
0
.setTopMargin(float)
public void setTopMargin(float margin)
0
.
Note that this margin is not filled with the background color.
If you want a margin that is filled with the background color,
use the margin-top
and background-color
style
attributes of the <body>
element. Example:
<body style="background-color: #663333; margin-top:10px;">
Note that this method call may change the bounding rectangle.
For this reason, if the object is contained inside a manager
you should modify the parameter using the applyToObject
method of the manager.
public final float getBottomMargin()
0
.setTopMargin(float)
public void setBottomMargin(float margin)
0
.
Note that this margin is not filled with the background color.
If you want a margin that is filled with the background color,
use the margin-bottom
and background-color
style
attributes of the <body>
element. Example:
<body style="background-color: #663333; margin-bottom:10px;">
Note that this method call may change the bounding rectangle.
For this reason, if the object is contained inside a manager
you should modify the parameter using the applyToObject
method of the manager.
public IlvGraphic copy()
IlvHTMLText
instance.copy
in class IlvGraphic
IlvGraphic
instance.IlvGraphic
public void draw(Graphics g, IlvTransformer t)
IlvHTMLText
object.draw
in class IlvGraphic
g
- The destination Graphics.t
- The view transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public IlvRect boundingBox(IlvTransformer t)
IlvHTMLText
.boundingBox
in class IlvGraphic
t
- The view 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 used to draw the object.true
if the point lies inside this graphic object.IlvGraphic
public void applyTransform(IlvTransformer t)
IlvHTMLText
.
This can be used to rotate or scale the text.applyTransform
in class IlvGraphic
t
- The transformer to be applied.IlvGraphic
public void processMouseClicked(MouseEvent event, IlvTransformer transformToView)
You should normally not call this method.
public void addHTMLInteractionListener(HTMLInteractionListener listener)
public void removeHTMLInteractionListener(HTMLInteractionListener listener)
public void write(IlvOutputStream stream) throws IOException
IlvHTMLText
to an IVL file.write
in interface IlvPersistentObject
write
in class IlvGraphic
stream
- The output stream to write this graphic object to.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright Rogue Wave Software, Inc. 1997, 2015. All Rights Reserved.