public class TextAnnotation extends RectangleAnnotation
An text annotation could be used to add additional information to the displayed document page. For this purpose it can be rotated, changed its appearance color and text style.
Modifier and Type | Field and Description |
---|---|
protected boolean |
bold |
protected String |
defaultText |
protected boolean |
editable |
protected String |
fontFace |
protected float |
fontSize |
protected HorizontalAlignment |
horizontalAlignment |
protected boolean |
italic |
protected int |
rotation |
protected boolean |
scaleText |
protected boolean |
strikethrough |
protected String |
text |
protected Color |
textColor |
protected boolean |
underscored |
shape
allowResize, fillColor, filled, iconified, linePainted, lineWidth, strokeColor, strokeResolution
createdAt, createdBy, doFireAnnotationEvents, id, initializer, isModified, lastModifiedAt, lastModifiedBy
Constructor and Description |
---|
TextAnnotation() |
Modifier and Type | Method and Description |
---|---|
TextAnnotation |
clone() |
protected void |
copyAttributesTo(Annotation annotation)
Copy annotation type related attributes to new annotation.
|
Rectangle2D |
getBounds()
Returns the bounds of this annotation
|
String |
getDefaultText()
Returns the current default text.
|
String |
getFontFace()
Returns the logical name of the display font
|
float |
getFontSize()
Returns the font size of the displayed text.
|
HorizontalAlignment |
getHorizontalAlignment()
Return the for this annotation used text alignment
|
int |
getMaxCharacters() |
PathIterator |
getPathIterator() |
int |
getRotation() |
String |
getText()
Returns the actual displayed text of this annotation.
|
Color |
getTextColor() |
boolean |
isBold() |
boolean |
isEditable() |
boolean |
isItalic() |
boolean |
isScaleText() |
boolean |
isStrikethrough() |
boolean |
isUnderscored() |
void |
setBold(boolean fontStyleBold) |
void |
setDefaultText(String defaultText)
Sets a default text.
|
void |
setEditable(boolean editable)
Sets the ability to edit the annotation.
|
void |
setFontFace(String fontFace)
Sets the logical name of the font to display.
|
void |
setFontSize(float fontSize)
Sets the font size of the displayed text.
|
void |
setHorizontalAlignment(HorizontalAlignment horizontalAlignment)
Sets the alignment of the text within the annotation.
|
void |
setItalic(boolean fontStyleItalic) |
void |
setMaxCharacters(int maxCharacters) |
void |
setRotation(int rotation)
Set rotation, values not matching range (0-359) will be normalized.
|
void |
setScaleText(boolean scaleText) |
void |
setSize(double width,
double height)
Set the size of the annotation to the given size.
|
void |
setStrikethrough(boolean strikethrough) |
void |
setText(String text)
Sets the display text of this annotation.
|
void |
setTextColor(Color textColor) |
void |
setUnderscored(boolean underscored) |
void |
translate(double dx,
double dy)
Translates this
Annotation the indicated distance, to the right along the x
coordinate axis, and downward along the y coordinate axis. |
getRectangle, getShape, setLocation, setRectangle
createColorWithAlpha, getFillColor, getLineWidth, getStrokeColor, getStrokeResolution, isAllowResize, isFilled, isIconified, isLinePainted, setAllowResize, setFillColor, setFilled, setIconified, setLinePainted, setLineWidth, setStrokeColor, setStrokeResolution
clearModified, createMemento, fireAnnotationChange, getChangeHandler, getCreatedAt, getCreatedBy, getID, getInitializer, getLastModifiedAt, getLastModifiedBy, getModCount, getPermissions, getProperties, getType, initialize, isDoFireAnnotationEvents, isInitialized, isLoadedAnnotation, isModified, restoreFrom, setChangeHandler, setCreatedBy, setCreationTimestamp, setDoFireAnnotationEvents, setID, setInitializer, setLastModifiedBy, setModified, setModifyTimestamp, setType
protected String text
protected String fontFace
protected float fontSize
protected boolean italic
protected boolean bold
protected HorizontalAlignment horizontalAlignment
protected boolean underscored
protected boolean strikethrough
protected Color textColor
protected String defaultText
protected boolean scaleText
protected boolean editable
protected int rotation
public String getText()
public void setText(String text)
null
or empty a
default text will be set.public void setSize(double width, double height)
Annotation
IllegalArgumentException
is thrown in this case.
Caveat: it is currently necessary, to force a repaint on the viewer
in order to make the results of the modification visible. Moreover there
are no modification events fired on the page and document. This will change
in the future.setSize
in class RectangleAnnotation
public void translate(double dx, double dy)
Annotation
Annotation
the indicated distance, to the right along the x
coordinate axis, and downward along the y coordinate axis.translate
in class RectangleAnnotation
dx
- the distance to move this Rectangle
along the x axisdy
- the distance to move this Rectangle
along the y axispublic Rectangle2D getBounds()
getBounds
in class RectangleAnnotation
public PathIterator getPathIterator()
public float getFontSize()
public void setFontSize(float fontSize)
fontSize
- The fontSize to setpublic String getFontFace()
public void setFontFace(String fontFace)
fontFace
- The fontFace to setpublic int getRotation()
public void setRotation(int rotation)
public TextAnnotation clone()
clone
in class RectangleAnnotation
Object.clone()
protected void copyAttributesTo(Annotation annotation)
Annotation
copyAttributesTo
in class RectangleAnnotation
annotation
- Annotation to set attributespublic Color getTextColor()
public void setTextColor(Color textColor)
public boolean isItalic()
public void setItalic(boolean fontStyleItalic)
public boolean isBold()
public void setBold(boolean fontStyleBold)
public boolean isUnderscored()
public void setUnderscored(boolean underscored)
public boolean isStrikethrough()
public void setStrikethrough(boolean strikethrough)
public void setMaxCharacters(int maxCharacters)
maxCharacters
- the maxCharacters to setpublic int getMaxCharacters()
public boolean isScaleText()
public void setScaleText(boolean scaleText)
public boolean isEditable()
public void setEditable(boolean editable)
true
= Annotation can be edited via editors (Context menu / hover editor).
false
= Annotation is not editable.
public void setDefaultText(String defaultText)
null
value will
be set via setText(String)
.defaultText
- Default textpublic String getDefaultText()
public HorizontalAlignment getHorizontalAlignment()
public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment)
HorizontalAlignment
horizontalAlignment
- The alignment for the text.Copyright © 2024 levigo holding gmbh. All rights reserved.