com.qoppa.pdf.annotations
Interface Annotation

All Known Subinterfaces:
Callout, Caret, Circle, FileAttachment, FreeText, Ink, Line, Link, MarkUpText, Polygon, Polyline, Popup, Redaction, RubberStamp, ShapeAnnotation, Sound, Square, Text, TextMarkup, Widget, WidgetButton, WidgetCheckBox, WidgetChoice, WidgetCombo, WidgetList, WidgetPushButton, WidgetRadioButton, WidgetSignature, WidgetText

public interface Annotation

Interface used to represent a PDF annotation.

Author:
Qoppa Software

Field Summary
static char BORDERSTYLE_BEVELED
           
static char BORDERSTYLE_DASHED
           
static char BORDERSTYLE_INSETS
           
static char BORDERSTYLE_SOLID
           
static char BORDERSTYLE_UNDERLINE
           
static int FLAGS_HIDDEN
           
static int FLAGS_INVISIBLE
           
static int FLAGS_LOCKED
           
static int FLAGS_NOROTATE
           
static int FLAGS_NOVIEW
           
static int FLAGS_NOZOOM
           
static int FLAGS_PRINTABLE
           
static int FLAGS_READONLY
           
 
Method Summary
 List getActions()
          Returns a list of actions to perform when this annotation is 'activated'
 char getBorderStyle()
          Gets this annotation's border style.
 double getBorderWidth()
          Gets this annotation's border width.
 Color getColor()
          Returns the annotation's color.
 JComponent getComponent()
          Returns the component associated with this annotation on the screen.
 String getContents()
          Returns the annotation's contents.
 Date getCreationDate()
          Deprecated. Replaced with getModifiedDate()
 String getCreator()
          Returns the annotation's creator.
 int getFlags()
          Returns this annotation's flags.
 Date getModifiedDate()
          Returns the date when the annotation was most recently modified.
 String getName()
          Returns the annotation's name.
 float getOpacity()
          Returns the annotation's opacity.
 Rectangle2D getRectangle()
          Gets the annotation's rectangle.
 String getSubject()
          Gets the subject field for this annotation.
 String getSubtype()
          Gets the annotation's subtype string.
 TriggerActions getTriggerActions()
          Returns a list of mouse related actions associated with this annotation.
 boolean isHidden()
          Returns the value of the HIDDEN flag.
 boolean isInvisible()
          Returns the value of the INVISIBLE flag.
 boolean isLocked()
          Returns the value of the LOCKED flag.
 boolean isNoRotate()
          Returns the value of the NOROTATE flag.
 boolean isNoView()
          Returns the value of the NOVIEW flag.
 boolean isNoZoom()
          Returns the value of the NOZOOM flag.
 boolean isPrintable()
          Returns the value of the PRINTABLE flag.
 boolean isReadOnly()
          Returns the value of the READONLY flag.
 void paint(Graphics g)
          Paints this annotation to a graphics object.
 void paint(Graphics g, boolean hasFocus)
          Deprecated. in favor of Paint (Graphics g). This method is still available, but the boolean is ignored.
 void print(Graphics g)
          Prints this annotation to a graphics object.
 void revalidate()
          Revalidates this annotation.
 void setActions(List actions)
          Sets this annotation's actions.
 void setBorderStyle(char borderStyle)
          Sets the annotation's border syle.
 void setBorderWidth(double borderWidth)
          Sets the annotation's border width.
 void setColor(Color c)
          Sets the annotation's color.
 void setComponent(JComponent component)
          Sets the component associated with this annotation on the screen.
 void setComponentVisible(boolean visible)
          Sets the visibility of the component associated with this annotation on the screen.
 void setCreationDate(Date creationDate)
          Deprecated. Replaced with setModifiedDate(Date)
 void setCreator(String creator)
          Sets the creator.
 void setFlags(int flags)
          Sets this annotation's flags: An annotation contains a set of flags that describe how the annotation is handled during display and printing.
 void setHidden(boolean hidden)
          Sets this Annotation's HIDDEN flag.
 void setInvisible(boolean invisible)
          Sets the value of the INVISIBLE flag.
 void setLayer(Layer layer)
          Sets the layer that this annotation belongs to.
 void setLocked(boolean locked)
          Sets the value of the LOCKED flag.
 void setModifiedDate(Date modifiedDate)
          Sets the annotation's modified date.
 void setName(String name)
          Sets the annotation's name.
 void setNoRotate(boolean noRotate)
          Sets the value of the NOROTATE flag.
 void setNoView(boolean noView)
          Sets the value of the NOVIEW flag.
 void setNoZoom(boolean noZoom)
          Sets the value of the NOZOOM flag.
 void setOpacity(float opacity)
          Sets the annotation's opacity.
 void setPrintable(boolean printable)
          Sets the value of the PRINTABLE flag.
 void setReadOnly(boolean readOnly)
          Sets the value of the READONLY flag.
 void setRectangle(Rectangle2D rectangle)
          Sets the annotation's rectangle.
 void setSubject(String subject)
          Sets the subject field for this annotation.
 void setSubtype(String subtype)
          Deprecated. This method is not used for common Annotations.
 void setTriggerActions(TriggerActions tActions)
          Sets the mouse trigger actions for this annotation.
 void shiftRectangle(double deltaX, double deltaY)
          Shifts the annotation's rectangle in MediaBox coordinates.
 

Field Detail

BORDERSTYLE_SOLID

static final char BORDERSTYLE_SOLID
See Also:
Constant Field Values

BORDERSTYLE_DASHED

static final char BORDERSTYLE_DASHED
See Also:
Constant Field Values

BORDERSTYLE_BEVELED

static final char BORDERSTYLE_BEVELED
See Also:
Constant Field Values

BORDERSTYLE_INSETS

static final char BORDERSTYLE_INSETS
See Also:
Constant Field Values

BORDERSTYLE_UNDERLINE

static final char BORDERSTYLE_UNDERLINE
See Also:
Constant Field Values

FLAGS_INVISIBLE

static final int FLAGS_INVISIBLE
See Also:
Constant Field Values

FLAGS_HIDDEN

static final int FLAGS_HIDDEN
See Also:
Constant Field Values

FLAGS_PRINTABLE

static final int FLAGS_PRINTABLE
See Also:
Constant Field Values

FLAGS_NOZOOM

static final int FLAGS_NOZOOM
See Also:
Constant Field Values

FLAGS_NOROTATE

static final int FLAGS_NOROTATE
See Also:
Constant Field Values

FLAGS_NOVIEW

static final int FLAGS_NOVIEW
See Also:
Constant Field Values

FLAGS_READONLY

static final int FLAGS_READONLY
See Also:
Constant Field Values

FLAGS_LOCKED

static final int FLAGS_LOCKED
See Also:
Constant Field Values
Method Detail

paint

void paint(Graphics g,
           boolean hasFocus)
Deprecated. in favor of Paint (Graphics g). This method is still available, but the boolean is ignored.

Paints this annotation to a graphics object.

Parameters:
g - The graphics object to paint the annotation to.

paint

void paint(Graphics g)
Paints this annotation to a graphics object.

Parameters:
g - The graphics object to paint the annotation to.

print

void print(Graphics g)
Prints this annotation to a graphics object. This method will only print the annotation if the printable flag is set and the hidden flag is not set.

Parameters:
g - The graphics object to use when drawing.

revalidate

void revalidate()
Revalidates this annotation.


getSubtype

String getSubtype()
Gets the annotation's subtype string.

Returns:
The annotation subtype.

setSubtype

void setSubtype(String subtype)
Deprecated. This method is not used for common Annotations.

Sets the annotation's subtype string.

Parameters:
subtype - The annotation subtype.

getBorderWidth

double getBorderWidth()
Gets this annotation's border width.

Returns:
The border width.

setBorderWidth

void setBorderWidth(double borderWidth)
Sets the annotation's border width.

Parameters:
borderWidth - Width of the border.

getBorderStyle

char getBorderStyle()
Gets this annotation's border style.

Returns:
The border style.

setBorderStyle

void setBorderStyle(char borderStyle)
Sets the annotation's border syle.

Parameters:
borderStyle - Style of the border.

getActions

List getActions()
Returns a list of actions to perform when this annotation is 'activated'

Returns:
List of actions.

setActions

void setActions(List actions)
Sets this annotation's actions. Must be a list of com.qoppa.pdfViewer.actions.Action objects. The list is copied to an internal list kept by the annotation, so any subsequent changes to the items in the list will not be reflected in the annotation.

Parameters:
actions - The list of actions.

setComponentVisible

void setComponentVisible(boolean visible)
Sets the visibility of the component associated with this annotation on the screen. This method should be used when component visibility needs to be changed temporarily on the screen. To hide the annotation definitively, use the setHidden method that will set the hidden flag in the document.

Parameters:
visible - The new value of the components visibility.

setFlags

void setFlags(int flags)
Sets this annotation's flags: An annotation contains a set of flags that describe how the annotation is handled during display and printing. The flags are defined by a set of constants and are or'ed together to define multiple flags:

FLAGS_INVISIBLE - Do not display the annotation if it is not a standard annotation.
FLAGS_HIDDEN - Do not display or print the annotation.
FLAGS_PRINT - Print the annotation when sending the document to a printer.
FLAGS_NOZOOM - Do not scale the annotation when zooming in and out of the document.
FLAGS_NOROTATE - Do not rotate the annotation when rotating the document for display.
FLAGS_NOVIEW - Do display the annotation on screen. Annotation may still print depending on the FLAGS_PRINT value.
FLAGS_READONLY - Display the annotation but do not respond to user clicks.
FLAGS_LOCKED - Do not allow the annotation to be deleted or its properties changed.

Parameters:
flags - The annotation's or'ed flags.

getFlags

int getFlags()
Returns this annotation's flags. An annotation contains a set of flags that describe how the annotation is handled during display and printing. The flags are defined by a set of constants and are or'ed together to define multiple flags:

FLAGS_INVISIBLE - Do not display the annotation if it is not a standard annotation.
FLAGS_HIDDEN - Do not display or print the annotation.
FLAGS_PRINT - Print the annotation when sending the document to a printer.
FLAGS_NOZOOM - Do not scale the annotation when zooming in and out of the document.
FLAGS_NOROTATE - Do not rotate the annotation when rotating the document for display.
FLAGS_NOVIEW - Do display the annotation on screen. Annotation may still print depending on the FLAGS_PRINT value.
FLAGS_READONLY - Display the annotation but do not respond to user clicks.
FLAGS_LOCKED - Do not allow the annotation to be deleted or its properties changed.

Returns:
The annotation's flags

isInvisible

boolean isInvisible()
Returns the value of the INVISIBLE flag.

Returns:
Value of the INVISIBLE flag

setInvisible

void setInvisible(boolean invisible)
Sets the value of the INVISIBLE flag.

Parameters:
invisible - The new value for the INVISIBLE flag.

isHidden

boolean isHidden()
Returns the value of the HIDDEN flag.

Returns:
Value of the HIDDEN flag

setHidden

void setHidden(boolean hidden)
Sets this Annotation's HIDDEN flag. A hidden annotation will not be displayed on the screen and will not print.

Parameters:
hidden - The new value of the HIDDEN flag.

isPrintable

boolean isPrintable()
Returns the value of the PRINTABLE flag.

Returns:
Value of the PRINTABLE flag

setPrintable

void setPrintable(boolean printable)
Sets the value of the PRINTABLE flag.

Parameters:
printable - The new value for the PRINTABLE flag.

isNoZoom

boolean isNoZoom()
Returns the value of the NOZOOM flag.

Returns:
Value of the NOZOOM flag

setNoZoom

void setNoZoom(boolean noZoom)
Sets the value of the NOZOOM flag.

Parameters:
noZoom - The new value for the NOZOOM flag.

isNoRotate

boolean isNoRotate()
Returns the value of the NOROTATE flag.

Returns:
Value of the NOROTATE flag

setNoRotate

void setNoRotate(boolean noRotate)
Sets the value of the NOROTATE flag.

Parameters:
noRotate - The new value for the NOROTATE flag.

isNoView

boolean isNoView()
Returns the value of the NOVIEW flag.

Returns:
Value of the NOVIEW flag

setNoView

void setNoView(boolean noView)
Sets the value of the NOVIEW flag.

Parameters:
noView - The new value for the NOVIEW flag.

isReadOnly

boolean isReadOnly()
Returns the value of the READONLY flag.

Returns:
Value of the READONLY flag

setReadOnly

void setReadOnly(boolean readOnly)
Sets the value of the READONLY flag.

Parameters:
readOnly - The new value for the READONLY flag.

isLocked

boolean isLocked()
Returns the value of the LOCKED flag.

Returns:
Value of the LOCKED flag

setLocked

void setLocked(boolean locked)
Sets the value of the LOCKED flag.

Parameters:
locked - The new value for the LCCKED flag.

getColor

Color getColor()
Returns the annotation's color.

Returns:
The annotation's color.

setColor

void setColor(Color c)
Sets the annotation's color.

Parameters:
c - The new color.

getComponent

JComponent getComponent()
Returns the component associated with this annotation on the screen. The component returned is guaranteed to implement the AnnotationComponent interface.

Returns:
The annotation's component.

setComponent

void setComponent(JComponent component)
Sets the component associated with this annotation on the screen.

Parameters:
component - The annotation's component.

getTriggerActions

TriggerActions getTriggerActions()
Returns a list of mouse related actions associated with this annotation. This includes actions on mouse enter, exit, up and down.

Returns:
A TriggerActions object that contains lists of actions for the different mouse events

setTriggerActions

void setTriggerActions(TriggerActions tActions)
Sets the mouse trigger actions for this annotation.

Parameters:
tActions - A TriggerActions object containing list of actions for the different mouse events.

shiftRectangle

void shiftRectangle(double deltaX,
                    double deltaY)
Shifts the annotation's rectangle in MediaBox coordinates.

Parameters:
deltaX - the shift in the x axis.
deltaY - the shift in the y axis.

getRectangle

Rectangle2D getRectangle()
Gets the annotation's rectangle. The annotation's rectangle is in MediaBox coordinates.

Returns:
The annotation's location on the page.

setRectangle

void setRectangle(Rectangle2D rectangle)
Sets the annotation's rectangle. The annotation's rectangle is in MediaBox coordinates.

Parameters:
rectangle - The new location of the annotation on the page.

getContents

String getContents()
Returns the annotation's contents.

Returns:
The annotation's contents.

getName

String getName()
Returns the annotation's name.

Returns:
The annotation's name.

setName

void setName(String name)
Sets the annotation's name.

Parameters:
name - The new annotation's name.

getOpacity

float getOpacity()
Returns the annotation's opacity.

Returns:
The new annotation's opacity.

setOpacity

void setOpacity(float opacity)
Sets the annotation's opacity.

Parameters:
opacity - The annotation's opacity.

getCreationDate

Date getCreationDate()
Deprecated. Replaced with getModifiedDate()

Returns the annotation's creation date. Milliseconds are always zero since the PDF date format doesn't support milliseconds.

Note: This method will return null if the annotation does not have a creation date.

Returns:
The annotation's creation date.

getModifiedDate

Date getModifiedDate()
Returns the date when the annotation was most recently modified. Milliseconds are always zero since the PDF date format doesn't support milliseconds.

Note: This method will return null if the annotation does not have a modified date.

Returns:
The date when the annotation was most recently modified

getCreator

String getCreator()
Returns the annotation's creator.

Returns:
The annotation's creator.

setCreationDate

void setCreationDate(Date creationDate)
Deprecated. Replaced with setModifiedDate(Date)

Sets the creation date. Note that milliseconds, if any, will be zeroed out as PDF date format doesn't support milliseconds.

Parameters:
creationDate - The annotation's creation date.

setModifiedDate

void setModifiedDate(Date modifiedDate)
Sets the annotation's modified date. Note that milliseconds, if any, will be zeroed out as PDF date format doesn't support milliseconds.

Parameters:
modifiedDate - The annotation's modified date

setCreator

void setCreator(String creator)
Sets the creator.

Parameters:
creator - The annotation's creator.

setLayer

void setLayer(Layer layer)
Sets the layer that this annotation belongs to.

Parameters:
layer - The parent layer.

setSubject

void setSubject(String subject)
Sets the subject field for this annotation.

Parameters:
subject - The subject

getSubject

String getSubject()
Gets the subject field for this annotation.

Returns:
subject