org.faceless.pdf2

## Class AnnotationShape

- java.lang.Object
- - org.faceless.pdf2.PDFAnnotation
  - - org.faceless.pdf2.AnnotationShape

- All Implemented Interfaces:
    Cloneable

      public class AnnotationShape
      extends PDFAnnotation

  Creates an annotation based on the specified `Shape`. Any type of shape may be specified - the Annotation will be created as a Square, Circle, Line, Polygon or PolyLine depending on the type of shape.

  Lines and PolyLines may have their endings specified with the `setFirstLineEnding(java.lang.String)` and `setLastLineEnding(java.lang.String)` methods - these are ignored for the other types, which may be filled, stroked or both depending on the `LineColor` and `FillColor` of the line.

  The list of valid line endings is:

  None | No line ending (the default)
  Square | A Square filled with the annotations fill color, if any
  Circle | A Circle filled with the annotations fill color, if any
  Diamond | A Diamond filled with the annotations fill color, if any
  OpenArrow | Two short lines meeting in an acute angle to form an open arrowhead
  ClosedArrow | Two short lines meeting in an acute angle as in the OpenArrow style and connected by a third line to form a triangular closed arrowhead filled with the annotation's fill color, if any
  Butt | A short line at the endpoint perpendicular to the line itself
  ROpenArrow | Two short lines in the reverse direction from OpenArrow
  RClosedArrow | A triangular closed arrowhead in the reverse direction from ClosedArrow
  Slash | A short line at the endpoint approximately 30 degrees clockwise from perpendicular to the line itself

  Since:
    2.11.7

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AnnotationShape()` Create a new AnnotationShape.
    `AnnotationShape(Shape shape)` Create a new AnnotationShape and immediately set its shape by calling `setShape()`
    `AnnotationShape(Shape shape, String end1, String end2)` Creates a new AnnotationShape and set its shape and line-ending style.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getFirstLineEnding()` Returns the line ending style for the endpoint defined by the first pair of coordinates in the shape.
    `String` | `getLastLineEnding()` Returns the line ending style for the endpoint defined by the last pair of coordinates in the shape.
    `Shape` | `getShape()` Returns the shape of this annotation
    `PDFStyle` | `getStyle()` Returns the style used to draw this shape, as set by `setStyle()`
    `void` | `rebuild()` Recreate the appearance
    `void` | `setFirstLineEnding(String le)` Sets the line ending style for the first endpoint.
    `void` | `setLastLineEnding(String le)` Sets the line ending style for the end of the line.
    `void` | `setShape(Shape shape)` Set the Shape of this Annotation.
    `void` | `setStyle(PDFStyle style)` Sets the style used to draw this shape
    `String` | `toString()`

    - ### Methods inherited from class org.faceless.pdf2.PDFAnnotation

      `addPropertyChangeListener, addReview, flatten, getAuthor, getColor, getContents, getCreationDate, getInReplyTo, getMetaData, getModifyDate, getOpacity, getPage, getPopup, getRectangle, getReplies, getReviews, getSubject, getType, getUniqueID, hasAppearanceState, isContentLocked, isPositionLocked, isPrintable, isReadOnly, isVisible, removePropertyChangeListener, setAuthor, setColor, setContents, setCreationDate, setInReplyTo, setLocked, setMetaData, setModifyDate, setOpacity, setPage, setPrintable, setReadOnly, setRectangle, setSubject, setUniqueID, setVisible`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AnnotationShape

          public AnnotationShape()

      Create a new AnnotationShape. The `setShape()` method must be called before any other methods on this object.

    - #### AnnotationShape

          public AnnotationShape(Shape shape)

      Create a new AnnotationShape and immediately set its shape by calling `setShape()`
      Parameters:
        `shape` - the shape of this annotation
      See Also:
        `setShape(java.awt.Shape)`

    - #### AnnotationShape

          public AnnotationShape(Shape shape,
                                 String end1,
                                 String end2)

      Creates a new AnnotationShape and set its shape and line-ending style.
      Parameters:
        `shape` - the shape of this annotation
        `end1` - the style for the start of the line
        `end2` - the style for the end of the line
      See Also:
        `setShape(java.awt.Shape)`, `setFirstLineEnding(java.lang.String)`, `setLastLineEnding(java.lang.String)`

  - ### Method Detail

    - #### setShape

          public void setShape(Shape shape)

      Set the Shape of this Annotation. The co-ordinates of the Shape are absolute page co-ordinates, measured in points from the bottom-left of the page. For example:

           annot.setShape(new Line2D.Float(0, 0, 100, 100));

      Will add a Line annotation at the bottom-left of the page.
      Parameters:
        `shape` - the Shape

    - #### getShape

          public Shape getShape()

      Returns the shape of this annotation

    - #### getFirstLineEnding

          public String getFirstLineEnding()

      Returns the line ending style for the endpoint defined by the first pair of coordinates in the shape. This is only meaningful for Line and PolyLine annotations, other types will return null.
      See Also:
        `setFirstLineEnding(java.lang.String)`

    - #### setFirstLineEnding

          public void setFirstLineEnding(String le)

      Sets the line ending style for the first endpoint. This will be ignored if the type of the annotation is not polyline.
      Parameters:
        `le` - the LineEnding for the start of the line
      See Also:
        `getFirstLineEnding()`

    - #### getLastLineEnding

          public String getLastLineEnding()

      Returns the line ending style for the endpoint defined by the last pair of coordinates in the shape. This is only meaningful for polyline annotations, other types will return null.
      See Also:
        `setLastLineEnding(java.lang.String)`

    - #### setLastLineEnding

          public void setLastLineEnding(String le)

      Sets the line ending style for the end of the line. This will be ignored if the type of the annotation is not Line or PolyLine.
      Parameters:
        `le` - the LineEnding for the end of the line
      See Also:
        `getLastLineEnding()`

    - #### getStyle

          public PDFStyle getStyle()

      Returns the style used to draw this shape, as set by `setStyle()`

    - #### setStyle

          public void setStyle(PDFStyle style)

      Sets the style used to draw this shape
      Parameters:
        `style` - the style to use
      See Also:
        `getStyle()`

    - #### rebuild

          public void rebuild()

      Recreate the appearance
      Overrides:
        `rebuild` in class `PDFAnnotation`

    - #### toString

          public String toString()

Copyright © 2001-2015 Big Faceless Organization