com.qoppa.pdf.annotations
Class Text

java.lang.Object
  extended bycom.qoppa.pdf.annotations.Annotation
      extended bycom.qoppa.pdf.annotations.Text

public class Text
extends Annotation

Class representing a Text annotation in a PDF document. Text annotations are displayed as a note icon on the PDF document and open a text box to show its contents when double-clicked.

Author:
Qoppa Software

Field Summary
static String ICON_COMMENT
           
static String ICON_DEFAULT
           
static String ICON_HELP
           
static String ICON_INSERT
           
static String ICON_KEY
           
static String ICON_NEWPARAGRAPH
           
static String ICON_NOTE
           
static String ICON_PARAGRAPH
           
 
Fields inherited from class com.qoppa.pdf.annotations.Annotation
BORDERSTYLE_BEVELED, BORDERSTYLE_DASHED, BORDERSTYLE_INSETS, BORDERSTYLE_SOLID, BORDERSTYLE_UNDERLINE, FLAGS_HIDDEN, FLAGS_INVISIBLE, FLAGS_LOCKED, FLAGS_NOROTATE, FLAGS_NOVIEW, FLAGS_NOZOOM, FLAGS_PRINTABLE, FLAGS_READONLY
 
Constructor Summary
Text(String contents, boolean initialOpen, String iconName)
          Construct a Text annotation object.
 
Method Summary
 JComponent createComponent(Point2D cropOrigin, IPDFActionHandler actionHandler)
          Creates a JComponent object capable of displaying this annotation.
 String getContents()
          Returns the string contents for this annotation.
 String getIconName()
          Returns the name of the icon for this annotation.
 Rectangle2D getRectangle()
          Override getRectangle: Bounds are set by the size of the text icon
 String getSubtype()
          Returns this annotation's subtype: "Text"
 boolean isInitialOpen()
          Returns the value of the InitialOpen flag.
 boolean isPrintable()
          Text icon never prints.
 void paintImpl(Graphics g, boolean hasFocus)
          Draws the text icon.
 void revalidate()
          Revalidates this annotation.
 void setContents(String contents)
          Sets the string contents for this annotation.
 void setInitialOpen(boolean initOpen)
          Sets the initial open flag.
 
Methods inherited from class com.qoppa.pdf.annotations.Annotation
getActions, getAppearStream, getBorderStyle, getBorderWidth, getColor, getComponent, getCreationDate, getCreator, getFlags, getName, getOpacity, getPopup, getTriggerActions, isHidden, isInvisible, isLocked, isNoRotate, isNoView, isNoZoom, isReadOnly, paint, paintAppearStream, print, setActions, setAppearStream, setBorderStyle, setBorderWidth, setColor, setComponent, setComponentVisible, setCreationDate, setCreator, setFlags, setHidden, setInvisible, setLocked, setName, setNoRotate, setNoView, setNoZoom, setOpacity, setPopup, setPrintable, setReadOnly, setRectangle, setTriggerActions, shiftRectangle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICON_NOTE

public static final String ICON_NOTE
See Also:
Constant Field Values

ICON_COMMENT

public static final String ICON_COMMENT
See Also:
Constant Field Values

ICON_KEY

public static final String ICON_KEY
See Also:
Constant Field Values

ICON_HELP

public static final String ICON_HELP
See Also:
Constant Field Values

ICON_NEWPARAGRAPH

public static final String ICON_NEWPARAGRAPH
See Also:
Constant Field Values

ICON_PARAGRAPH

public static final String ICON_PARAGRAPH
See Also:
Constant Field Values

ICON_INSERT

public static final String ICON_INSERT
See Also:
Constant Field Values

ICON_DEFAULT

public static final String ICON_DEFAULT
See Also:
Constant Field Values
Constructor Detail

Text

public Text(String contents,
            boolean initialOpen,
            String iconName)
Construct a Text annotation object.

Parameters:
contents - The textual content.
initialOpen - Flag indicating whether this annotation should be displayed open initially.
iconName - The name of the icon to use when displaying the annotation in its un-opened mode. Please use one of the constants defined in this class (ICON_XXXX) to set the name of the icon.
Method Detail

getSubtype

public String getSubtype()
Returns this annotation's subtype: "Text"

Specified by:
getSubtype in class Annotation
Returns:
The annotation subtype.

getIconName

public String getIconName()
Returns the name of the icon for this annotation.

Returns:
Name of the icon.

isInitialOpen

public boolean isInitialOpen()
Returns the value of the InitialOpen flag.

Returns:
Value of the flag.

setInitialOpen

public void setInitialOpen(boolean initOpen)
Sets the initial open flag.

Parameters:
initOpen - The new value of the initial open flag.

createComponent

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

Specified by:
createComponent in class Annotation
Returns:
JComponent do display this annotation.

getContents

public String getContents()
Returns the string contents for this annotation.

Overrides:
getContents in class Annotation
Returns:
The annotation's contents.

setContents

public void setContents(String contents)
Sets the string contents for this annotation.


paintImpl

public void paintImpl(Graphics g,
                      boolean hasFocus)
Draws the text icon.

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

revalidate

public void revalidate()
Description copied from class: Annotation
Revalidates this annotation.

Specified by:
revalidate in class Annotation

getRectangle

public Rectangle2D getRectangle()
Override getRectangle: Bounds are set by the size of the text icon

Overrides:
getRectangle in class Annotation
Returns:
The annotation's location on the page.

isPrintable

public boolean isPrintable()
Text icon never prints.

Overrides:
isPrintable in class Annotation
Returns:
Value of the PRINTABLE flag