Class TextAnnotation

All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable, PermissionsProvider<Annotation>, PropertiesProvider, com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation, Serializable
Direct Known Subclasses:
CalloutAnnotation, HistoryAnnotation, StampAnnotation

public class TextAnnotation extends RectangleAnnotation
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 Details

    • text

      protected String text
    • fontFace

      protected String fontFace
    • fontSize

      protected float fontSize
    • italic

      protected boolean italic
    • bold

      protected boolean bold
    • horizontalAlignment

      protected HorizontalAlignment horizontalAlignment
    • underscored

      protected boolean underscored
    • strikethrough

      protected boolean strikethrough
    • textColor

      protected Color textColor
    • defaultText

      protected String 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

      public String getText()
      Returns the actual displayed text of this annotation.
      Returns:
      annotations text
    • setText

      public void setText(String text)
      Sets the display text of this annotation. If the given text is null 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

      public String getFontFace()
      Returns the logical name of the display font
      Returns:
      String
    • setFontFace

      public void setFontFace(String fontFace)
      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. An IllegalArgumentExceptionis 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 class RectangleAnnotation
    • 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 class RectangleAnnotation
      Parameters:
      x - X-position
      y - Y-position
    • translate

      public void translate(double dx, double dy)
      Description copied from class: Annotation
      Translates this Annotation the indicated distance, to the right along the x coordinate axis, and downward along the y coordinate axis.
      Overrides:
      translate in class RectangleAnnotation
      Parameters:
      dx - the distance to move this Rectangle along the x axis
      dy - the distance to move this Rectangle along the y axis
    • getBounds

      public Rectangle2D getBounds()
      Description copied from class: ShapeBasedAnnotation
      Returns an integer Rectanglethat completely encloses the annotation.
      Overrides:
      getBounds in class RectangleAnnotation
      Returns:
      Rectangle annotation bounding box
    • getPathIterator

      public PathIterator getPathIterator()
      Returns:
      Returns the PathIterator for the rotated shape
    • copy

      public TextAnnotation copy()
      Specified by:
      copy in interface com.levigo.jadice.web.shared.model.annotation.internal.JwtAnnotation
      Overrides:
      copy in class RectangleAnnotation
    • copyAttributesTo

      protected void copyAttributesTo(Annotation annotation)
      Overrides:
      copyAttributesTo in class RectangleAnnotation
    • getTextColor

      public Color getTextColor()
    • setTextColor

      public void setTextColor(Color textColor)
    • 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

      public void setDefaultText(String defaultText)
      Sets a default text. This text will be used if an empty string or a null value will be set via setText(String).
      Parameters:
      defaultText - Default text
    • getDefaultText

      public String getDefaultText()
      Returns the current default text.
      Returns:
      Current default text.
    • getHorizontalAlignment

      public HorizontalAlignment getHorizontalAlignment()
      Return the for this annotation used text alignment
      Returns:
      Current text alignment
    • setHorizontalAlignment

      public void setHorizontalAlignment(HorizontalAlignment horizontalAlignment)
      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.