Package com.levigo.jadice.annotation
Class TextAnnotation
java.lang.Object
com.levigo.jadice.annotation.Annotation
com.levigo.jadice.annotation.ShapeBasedAnnotation
com.levigo.jadice.annotation.RectangleAnnotation
com.levigo.jadice.annotation.TextAnnotation
- All Implemented Interfaces:
PermissionsProvider<Annotation>
,PropertiesProvider
,com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation
,Serializable
,org.jadice.util.base.MementoOriginator
- Direct Known Subclasses:
CalloutAnnotation
,HistoryAnnotation
,StampAnnotation
An annotation looking like a piece of text.
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected String
protected boolean
protected String
protected float
protected HorizontalAlignment
protected boolean
protected int
protected boolean
protected boolean
protected String
protected Color
protected boolean
Fields inherited from class com.levigo.jadice.annotation.RectangleAnnotation
rect, shape
Fields inherited from class com.levigo.jadice.annotation.ShapeBasedAnnotation
allowResize, fillColor, filled, iconified, linePainted, lineWidth, strokeColor, strokeResolution
Fields inherited from class com.levigo.jadice.annotation.Annotation
createdAt, createdBy, doFireAnnotationEvents, id, initializer, isModified, lastModifiedAt, lastModifiedBy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()
protected void
copyAttributesTo
(Annotation annotation) Returns an integerRectangle
that completely encloses the annotation.Returns the current default text.Returns the logical name of the display fontfloat
Returns the font size of the displayed text.Return the for this annotation used text alignmentint
int
Returns the rotation of the annotation in degrees.getText()
Returns the actual displayed text of this annotation.boolean
isBold()
boolean
boolean
isItalic()
boolean
boolean
boolean
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 horizontal alignment of the text within the annotation.void
setItalic
(boolean fontStyleItalic) void
setLocation
(double x, double y) Set the location (upper-left corner) of the annotation to the given point.void
setMaxCharacters
(int maxCharacters) void
setRotation
(int rotation) Sets the rotation of the annotation.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
Sets the display text of this annotation.void
setTextColor
(Color textColor) void
setUnderscored
(boolean underscored) void
translate
(double dx, double dy) Translates thisAnnotation
the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.Methods inherited from class com.levigo.jadice.annotation.RectangleAnnotation
getRectangle, getShape, setRectangle, update
Methods inherited from class com.levigo.jadice.annotation.ShapeBasedAnnotation
getFillColor, getLineWidth, getStrokeColor, getStrokeResolution, isAllowResize, isFilled, isIconified, isLinePainted, prepareSerialisation, setAllowResize, setFillColor, setFilled, setIconified, setLinePainted, setLineWidth, setStrokeColor, setStrokeResolution
Methods inherited from class com.levigo.jadice.annotation.Annotation
clearModified, clone, createMemento, fireAnnotationChange, getChangeHandler, getCreatedAt, getCreatedBy, getID, getInitializer, getLastModifiedAt, getLastModifiedBy, getModCount, getPermissions, getProfileId, getProperties, getType, getTypeName, initialize, isDoFireAnnotationEvents, isInitialized, isModified, restoreFrom, setChangeHandler, setCreatedBy, setCreationTimestamp, setDoFireAnnotationEvents, setID, setInitializer, setLastModifiedBy, setModified, setModifyTimestamp, setProfileId, setType, setTypeName
-
Field Details
-
text
-
fontFace
-
fontSize
protected float fontSize -
italic
protected boolean italic -
bold
protected boolean bold -
horizontalAlignment
-
underscored
protected boolean underscored -
strikethrough
protected boolean strikethrough -
textColor
-
defaultText
-
scaleText
protected boolean scaleText -
editable
protected boolean editable -
rotation
protected int rotation
-
-
Constructor Details
-
TextAnnotation
public TextAnnotation()
-
-
Method Details
-
getRotation
public int getRotation()Returns the rotation of the annotation in degrees.- Returns:
- the rotation in degrees
-
setRotation
public void setRotation(int rotation) Sets the rotation of the annotation.- Parameters:
rotation
- The rotation in degrees
-
getText
Returns the actual displayed text of this annotation.- Returns:
- annotations text
-
setText
Sets the display text of this annotation. If the given text isnull
or empty a default text will be set.- Parameters:
text
-
-
getFontSize
public float getFontSize()Returns the font size of the displayed text.- Returns:
- int font size
-
setFontSize
public void setFontSize(float fontSize) Sets the font size of the displayed text.- Parameters:
fontSize
- The fontSize to set
-
getFontFace
Returns the logical name of the display font- Returns:
- String
-
setFontFace
Sets the logical name of the font to display.- Parameters:
fontFace
- The fontFace to set
-
setSize
public void setSize(double width, double height) Description copied from class:Annotation
Set the size of the annotation to the given size. Depending on the type of annotation, this may not be possible. E.g. stamp annotations handle the sizing on their own, so they will refuse to resize themselves. AnIllegalArgumentException
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.- Overrides:
setSize
in classRectangleAnnotation
- Parameters:
width
-height
-
-
setLocation
public void setLocation(double x, double y) Description copied from class:ShapeBasedAnnotation
Set the location (upper-left corner) of the annotation to the given point. 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.- Overrides:
setLocation
in classRectangleAnnotation
- Parameters:
x
- X-positiony
- Y-position
-
translate
public void translate(double dx, double dy) Description copied from class:Annotation
Translates thisAnnotation
the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.- Overrides:
translate
in classRectangleAnnotation
- Parameters:
dx
- the distance to move thisRectangle
along the x axisdy
- the distance to move thisRectangle
along the y axis
-
getBounds
Description copied from class:ShapeBasedAnnotation
Returns an integerRectangle
that completely encloses the annotation.- Overrides:
getBounds
in classRectangleAnnotation
- Returns:
- Rectangle annotation bounding box
-
getPathIterator
- Returns:
- Returns the PathIterator for the rotated shape
-
copy
- Specified by:
copy
in interfacecom.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation
- Overrides:
copy
in classRectangleAnnotation
-
copyAttributesTo
- Overrides:
copyAttributesTo
in classRectangleAnnotation
-
getTextColor
-
setTextColor
-
isItalic
public boolean isItalic() -
setItalic
public void setItalic(boolean fontStyleItalic) -
isBold
public boolean isBold() -
setBold
public void setBold(boolean fontStyleBold) -
isUnderscored
public boolean isUnderscored() -
setUnderscored
public void setUnderscored(boolean underscored) -
isStrikethrough
public boolean isStrikethrough() -
setStrikethrough
public void setStrikethrough(boolean strikethrough) -
setMaxCharacters
public void setMaxCharacters(int maxCharacters) - Parameters:
maxCharacters
- the maxCharacters to set
-
getMaxCharacters
public int getMaxCharacters()- Returns:
- the maxCharacters
-
isScaleText
public boolean isScaleText() -
setScaleText
public void setScaleText(boolean scaleText) -
isEditable
public boolean isEditable() -
setEditable
public void setEditable(boolean editable) Sets the ability to edit the annotation.true
= Annotation can be edited via editors (Context menu / hover editor).false
= Annotation is not editable.
- Parameters:
editable
-
-
setDefaultText
Sets a default text. This text will be used if an empty string or anull
value will be set viasetText(String)
.- Parameters:
defaultText
- Default text
-
getDefaultText
Returns the current default text.- Returns:
- Current default text.
-
getHorizontalAlignment
Return the for this annotation used text alignment- Returns:
- Current text alignment
-
setHorizontalAlignment
Sets the horizontal alignment of the text within the annotation. This effects the rendered text and the text while editing the annotation. See also:HorizontalAlignment
- Parameters:
horizontalAlignment
- The alignment for the text.
-