com.qoppa.pdf.annotations
Interface Annotation

All Known Subinterfaces:
Callout, Caret, Circle, FileAttachment, FreeText, Ink, Line, Link, MarkUpText, Polygon, Polyline, Popup, RubberStamp, ShapeAnnotation, Sound, Square, Text, 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()
          Returns the annotation's creation date.
 String getCreator()
          Returns the annotation's creator.
 int getFlags()
          Returns this annotation's flags.
 String getName()
          Returns the annotation's name.
 float getOpacity()
          Returns the annotation's opacity.
 Rectangle2D getRectangle()
          Gets the annotation's rectangle.
 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)
          Sets the creation 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 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 setSubtype(String subtype)
          Sets the annotation's subtype string.
 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

public static final char BORDERSTYLE_SOLID
See Also:
Constant Field Values

BORDERSTYLE_DASHED

public static final char BORDERSTYLE_DASHED
See Also:
Constant Field Values

BORDERSTYLE_BEVELED

public static final char BORDERSTYLE_BEVELED
See Also:
Constant Field Values

BORDERSTYLE_INSETS

public static final char BORDERSTYLE_INSETS
See Also:
Constant Field Values

BORDERSTYLE_UNDERLINE

public static final char BORDERSTYLE_UNDERLINE
See Also:
Constant Field Values

FLAGS_INVISIBLE

public static final int FLAGS_INVISIBLE
See Also:
Constant Field Values

FLAGS_HIDDEN

public static final int FLAGS_HIDDEN
See Also:
Constant Field Values

FLAGS_PRINTABLE

public static final int FLAGS_PRINTABLE
See Also:
Constant Field Values

FLAGS_NOZOOM

public static final int FLAGS_NOZOOM
See Also:
Constant Field Values

FLAGS_NOROTATE

public static final int FLAGS_NOROTATE
See Also:
Constant Field Values

FLAGS_NOVIEW

public static final int FLAGS_NOVIEW
See Also:
Constant Field Values

FLAGS_READONLY

public static final int FLAGS_READONLY
See Also:
Constant Field Values

FLAGS_LOCKED

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

paint

public 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

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

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

print

public 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

public void revalidate()
Revalidates this annotation.


getSubtype

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

Returns:
The annotation subtype.

setSubtype

public void setSubtype(String subtype)
Sets the annotation's subtype string.

Parameters:
subtype - The annotation subtype.

getBorderWidth

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

Returns:
The border width.

setBorderWidth

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

Parameters:
borderWidth - Width of the border.

getBorderStyle

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

Returns:
The border style.

setBorderStyle

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

Parameters:
borderStyle - Style of the border.

getActions

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

Returns:
List of actions.

setActions

public 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

public 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

public 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

public 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

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

Returns:
Value of the INVISIBLE flag

setInvisible

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

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

isHidden

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

Returns:
Value of the HIDDEN flag

setHidden

public 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

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

Returns:
Value of the PRINTABLE flag

setPrintable

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

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

isNoZoom

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

Returns:
Value of the NOZOOM flag

setNoZoom

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

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

isNoRotate

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

Returns:
Value of the NOROTATE flag

setNoRotate

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

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

isNoView

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

Returns:
Value of the NOVIEW flag

setNoView

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

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

isReadOnly

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

Returns:
Value of the READONLY flag

setReadOnly

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

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

isLocked

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

Returns:
Value of the LOCKED flag

setLocked

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

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

getColor

public Color getColor()
Returns the annotation's color.

Returns:
The annotation's color.

setColor

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

Parameters:
c - The new color.

getComponent

public 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

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

Parameters:
component - The annotation's component.

getTriggerActions

public 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

public 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

public 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

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

Returns:
The annotation's location on the page.

setRectangle

public 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

public String getContents()
Returns the annotation's contents.

Returns:
The annotation's contents.

getName

public String getName()
Returns the annotation's name.

Returns:
The annotation's name.

setName

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

Parameters:
name - The new annotation's name.

getOpacity

public float getOpacity()
Returns the annotation's opacity.

Returns:
The new annotation's opacity.

setOpacity

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

Parameters:
opacity - The annotation's opacity.

getCreationDate

public Date getCreationDate()
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.

getCreator

public String getCreator()
Returns the annotation's creator.

Returns:
The annotation's creator.

setCreationDate

public void setCreationDate(Date creationDate)
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.

setCreator

public void setCreator(String creator)
Sets the creator.

Parameters:
creator - The annotation's creator.

setLayer

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

Parameters:
layer - The parent layer.