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 booleanprotected Stringprotected booleanprotected Stringprotected floatprotected HorizontalAlignmentprotected booleanprotected intprotected booleanprotected booleanprotected Stringprotected Colorprotected booleanFields inherited from class com.levigo.jadice.annotation.RectangleAnnotation
rect, shapeFields inherited from class com.levigo.jadice.annotation.ShapeBasedAnnotation
allowResize, fillColor, filled, iconified, linePainted, lineWidth, strokeColor, strokeResolutionFields 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 voidcopyAttributesTo(Annotation annotation) Returns an integerRectanglethat completely encloses the annotation.Returns the current default text.Returns the logical name of the display fontfloatReturns the font size of the displayed text.Return the for this annotation used text alignmentintintReturns the rotation of the annotation in degrees.getText()Returns the actual displayed text of this annotation.booleanisBold()booleanbooleanisItalic()booleanbooleanbooleanvoidsetBold(boolean fontStyleBold) voidsetDefaultText(String defaultText) Sets a default text.voidsetEditable(boolean editable) Sets the ability to edit the annotation.voidsetFontFace(String fontFace) Sets the logical name of the font to display.voidsetFontSize(float fontSize) Sets the font size of the displayed text.voidsetHorizontalAlignment(HorizontalAlignment horizontalAlignment) Sets the horizontal alignment of the text within the annotation.voidsetItalic(boolean fontStyleItalic) voidsetLocation(double x, double y) Set the location (upper-left corner) of the annotation to the given point.voidsetMaxCharacters(int maxCharacters) voidsetRotation(int rotation) Sets the rotation of the annotation.voidsetScaleText(boolean scaleText) voidsetSize(double width, double height) Set the size of the annotation to the given size.voidsetStrikethrough(boolean strikethrough) voidSets the display text of this annotation.voidsetTextColor(Color textColor) voidsetUnderscored(boolean underscored) voidtranslate(double dx, double dy) Translates thisAnnotationthe 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, updateMethods inherited from class com.levigo.jadice.annotation.ShapeBasedAnnotation
getFillColor, getLineWidth, getStrokeColor, getStrokeResolution, isAllowResize, isFilled, isIconified, isLinePainted, prepareSerialisation, setAllowResize, setFillColor, setFilled, setIconified, setLinePainted, setLineWidth, setStrokeColor, setStrokeResolutionMethods 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 isnullor 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:AnnotationSet 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. AnIllegalArgumentExceptionis 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:
setSizein classRectangleAnnotation- Parameters:
width-height-
-
setLocation
public void setLocation(double x, double y) Description copied from class:ShapeBasedAnnotationSet 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:
setLocationin classRectangleAnnotation- Parameters:
x- X-positiony- Y-position
-
translate
public void translate(double dx, double dy) Description copied from class:AnnotationTranslates thisAnnotationthe indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.- Overrides:
translatein classRectangleAnnotation- Parameters:
dx- the distance to move thisRectanglealong the x axisdy- the distance to move thisRectanglealong the y axis
-
getBounds
Description copied from class:ShapeBasedAnnotationReturns an integerRectanglethat completely encloses the annotation.- Overrides:
getBoundsin classRectangleAnnotation- Returns:
- Rectangle annotation bounding box
-
getPathIterator
- Returns:
- Returns the PathIterator for the rotated shape
-
copy
- Specified by:
copyin interfacecom.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation- Overrides:
copyin classRectangleAnnotation
-
copyAttributesTo
- Overrides:
copyAttributesToin 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 anullvalue 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.
-