com.qoppa.pdf.annotations
Class Annotation

java.lang.Object
  extended bycom.qoppa.pdf.annotations.Annotation
Direct Known Subclasses:
FileAttachment, FreeText, Link, MarkUpText, Popup, RubberStamp, ShapeAnnotation, Sound, Text, Widget

public abstract class Annotation
extends Object

Abstract class 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
           
 
Constructor Summary
Annotation()
          Annotation constructor.
 
Method Summary
abstract  JComponent createComponent(Point2D cropOrigin, IPDFActionHandler actionHandler)
          Creates a JComponent object capable of displaying this annotation.
 Vector getActions()
          Returns a list of actions to perform when this annotation is 'activated'
 AppearStream getAppearStream()
           
 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.
 LayerVisibility getLayer()
           
 String getName()
          Returns the annotation's name.
 float getOpacity()
          Returns the annotation's opacity.
 Popup getPopup()
          Returns the popup associated with this annotation.
 Rectangle2D getRectangle()
          Gets the annotation's rectangle.
abstract  String getSubtype()
          Gets the annotation's subtype string.
 TriggerActions getTriggerActions()
           
 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, boolean hasFocus)
          Paints this annotation to a graphics object.
 void print(Graphics g)
          Prints this annotation to a graphics object.
abstract  void revalidate()
          Revalidates this annotation.
 void setActions(Vector actions)
          Sets this annotation's actions.
 void setAppearStream(AppearStream appearStream)
           
 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(LayerVisibility layer)
           
 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 setPopup(Popup popup)
          Sets the annotation's popup.
 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 setTriggerActions(TriggerActions tActions)
           
 void shiftRectangle(double deltaX, double deltaY)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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
Constructor Detail

Annotation

public Annotation()
Annotation constructor.

Method Detail

createComponent

public abstract JComponent createComponent(Point2D cropOrigin,
                                           IPDFActionHandler actionHandler)
Creates a JComponent object capable of displaying this annotation.

Returns:
JComponent do display this annotation.

paint

public final void paint(Graphics g,
                        boolean hasFocus)
Paints this annotation to a graphics object.

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

print

public final 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 abstract void revalidate()
Revalidates this annotation.


getSubtype

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

Returns:
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 Vector getActions()
Returns a list of actions to perform when this annotation is 'activated'

Returns:
List of actions.

setActions

public void setActions(Vector actions)
Sets this annotation's actions. Must be a list of com.qoppa.pdfViewer.actions.Action objects.

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.

getAppearStream

public AppearStream getAppearStream()

setAppearStream

public void setAppearStream(AppearStream appearStream)

getComponent

public JComponent getComponent()
Returns the component associated with this annotation on the screen.

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()

setTriggerActions

public void setTriggerActions(TriggerActions tActions)

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.

getPopup

public Popup getPopup()
Returns the popup associated with this annotation.

Returns:
The annotation's popup.

setPopup

public void setPopup(Popup popup)
Sets the annotation's popup.

Parameters:
popup - The new annotation's popup.

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.

shiftRectangle

public void shiftRectangle(double deltaX,
                           double deltaY)

getCreationDate

public Date getCreationDate()
Returns the annotation's creation date. Milliseconds are always zero since the PDF date format doesn't support milliseconds.

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.

getLayer

public LayerVisibility getLayer()

setLayer

public void setLayer(LayerVisibility layer)