com.crionics.jpdf.forms
Class AbstractField

java.lang.Object
  extended by PdfObjectContainer
      extended by com.crionics.jpdf.forms.AbstractField
Direct Known Subclasses:
AbstractButtonField, AbstractChoiceField, ButtonField, SignatureField, TextField

public abstract class AbstractField
extends PdfObjectContainer

Abstract class containing all the generic methods associated with Form Fields.


Method Summary
 int getAssociatedPageIndex()
          Recovers the page Index where the Form Fields is present.
 java.awt.Color getBorderColor()
          gets the border color
 int getBorderStyle()
          returns the border style
 int getBorderWidth()
          Returns the border width
 java.awt.Color getFillColor()
          Recovers the background color of a Form Field
 java.lang.String getName()
          Returns the Form Field name.
 int getOrientation()
          return the widget orientation in degrees
 java.awt.Rectangle getPosition()
          Recovers the position and size of the Form Field within the page
 java.awt.Color getTextColor()
          return the text color
 java.lang.String getTextFont()
          return the name of the font
 float getTextSize()
          Return the size of the font, 0 means that the text is in autosize mode
 java.lang.String getToolTip()
          return the tooltip for this field
 boolean isHidden()
          Returns the Form Fields screen visibility flag value.
 boolean isPrintable()
          Returns the Form Fields printer visibility flag value.
 boolean isReadOnly()
          Returns the Form Field's ReadOnly flag value.
 void setBorderColor(java.awt.Color color)
          sets the border color
 void setBorderStyle(int style)
          sets the border style
 void setBorderWidth(int width)
          sets the border width
 void setFillColor(java.awt.Color bgcolor)
          Sets the background color of a Form Field
 void setHidden(boolean flag)
          Allows to hide/show a Form Field on a PDF Viewer.
 void setOrientation(int orientation)
          sets the widget orientation on teh page (in degrees)
 void setPosition(java.awt.Rectangle rect)
          Sets the position and size of the Form Field within the page
 void setPrintable(boolean flag)
          Allows to hide/show a Form Field a printed page.
 void setReadOnly(boolean flagReadOnly)
          Sets/Clears the Form Field's ReadOnly flag.
 void setTextColor(java.awt.Color color)
          Sets the text color
 void setTextFont(java.awt.Font font)
          Sets the text font. for now only the 14 native fonts are supported.
 void setTextFont(java.lang.String font)
           
 void setTextSize(float size)
          sets the text size, use 0 for auto-size mode.
 void setToolTip(java.lang.String tip)
          sets the widget tooltip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAssociatedPageIndex

public int getAssociatedPageIndex()
                           throws java.io.IOException,
                                  PdfException
Recovers the page Index where the Form Fields is present.

Returns:
The Index of the page.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getBorderColor

public java.awt.Color getBorderColor()
                              throws PdfException,
                                     java.io.IOException
gets the border color

Returns:
the border color
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getBorderStyle

public int getBorderStyle()
                   throws PdfException,
                          java.io.IOException
returns the border style

Returns:
the border style as defined in IBorderStyle
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getBorderWidth

public int getBorderWidth()
                   throws PdfException,
                          java.io.IOException
Returns the border width

Returns:
the border width, 0 means that there is no border
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getFillColor

public java.awt.Color getFillColor()
                            throws PdfException,
                                   java.io.IOException
Recovers the background color of a Form Field

Returns:
The background color or null if transparent
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getName

public java.lang.String getName()
                         throws PdfException,
                                java.io.IOException
Returns the Form Field name.

Returns:
The Form Field name.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getOrientation

public int getOrientation()
                   throws PdfException,
                          java.io.IOException
return the widget orientation in degrees

Returns:
the widget orientation in degrees
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getPosition

public java.awt.Rectangle getPosition()
                               throws java.io.IOException,
                                      PdfException
Recovers the position and size of the Form Field within the page

Returns:
The position and size of the Form Fields in pixels. Coordinates are relative to the top left corner of the page when the document is viewed on a PDF Viewer.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getTextColor

public java.awt.Color getTextColor()
                            throws PdfException,
                                   java.io.IOException
return the text color

Returns:
the text color
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getTextFont

public java.lang.String getTextFont()
                             throws java.io.IOException,
                                    PdfException
return the name of the font

Returns:
the text font
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getTextSize

public float getTextSize()
                  throws PdfException,
                         java.io.IOException
Return the size of the font, 0 means that the text is in autosize mode

Returns:
the text size
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

getToolTip

public java.lang.String getToolTip()
                            throws PdfException,
                                   java.io.IOException
return the tooltip for this field

Returns:
the tooltip for this field
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

isHidden

public boolean isHidden()
                 throws PdfException,
                        java.io.IOException
Returns the Form Fields screen visibility flag value.

Returns:
true if the Form field is visible on a PDF Viewer, false otherwise.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

isPrintable

public boolean isPrintable()
                    throws PdfException,
                           java.io.IOException
Returns the Form Fields printer visibility flag value.

Returns:
true if the Form Field will be visible after the PDF is printed, false otherwise.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

isReadOnly

public boolean isReadOnly()
Returns the Form Field's ReadOnly flag value.

Returns:
true if the flag is set, false otherwise.

setBorderColor

public void setBorderColor(java.awt.Color color)
                    throws java.io.IOException,
                           PdfException
sets the border color

Parameters:
color - color to use for the border, a transparent border can be used by using an alpha=255
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setBorderStyle

public void setBorderStyle(int style)
                    throws PdfException,
                           java.io.IOException
sets the border style

Parameters:
style - a border style as defined in IBorderStyle
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setBorderWidth

public void setBorderWidth(int width)
                    throws java.io.IOException,
                           PdfException
sets the border width

Parameters:
width - the border width, border with a 0 width are ignored
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setFillColor

public void setFillColor(java.awt.Color bgcolor)
                  throws PdfException,
                         java.io.IOException
Sets the background color of a Form Field

Parameters:
bgcolor - The background color to set, or null to render it transparent.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setHidden

public void setHidden(boolean flag)
               throws PdfException,
                      java.io.IOException
Allows to hide/show a Form Field on a PDF Viewer.

Parameters:
flag - true to show it, false to hide it.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setOrientation

public void setOrientation(int orientation)
                    throws PdfException,
                           java.io.IOException
sets the widget orientation on teh page (in degrees)

Parameters:
orientation - the widget orientation in degres
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setPosition

public void setPosition(java.awt.Rectangle rect)
                 throws java.io.IOException,
                        PdfException
Sets the position and size of the Form Field within the page

Parameters:
rect - The position and size of the Form Fields in pixels. Coordinates are relative to the top left corner of the page when the document is viewed on a PDF Viewer.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setPrintable

public void setPrintable(boolean flag)
                  throws PdfException,
                         java.io.IOException
Allows to hide/show a Form Field a printed page.

Parameters:
flag - true to show it, false to hide it.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setReadOnly

public void setReadOnly(boolean flagReadOnly)
                 throws PdfException,
                        java.io.IOException
Sets/Clears the Form Field's ReadOnly flag.

Parameters:
flagReadOnly - true to set it, false to clear it.
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setTextColor

public void setTextColor(java.awt.Color color)
                  throws PdfException,
                         java.io.IOException
Sets the text color

Parameters:
color - the text color
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setTextFont

public void setTextFont(java.awt.Font font)
                 throws PdfException,
                        java.io.IOException
Sets the text font. for now only the 14 native fonts are supported. support for embeding new fonts should be added shortly

Parameters:
name - font name
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setTextFont

public void setTextFont(java.lang.String font)
                 throws PdfException,
                        java.io.IOException
Throws:
PdfException
java.io.IOException

setTextSize

public void setTextSize(float size)
                 throws PdfException,
                        java.io.IOException
sets the text size, use 0 for auto-size mode.

Parameters:
size - the text size
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.

setToolTip

public void setToolTip(java.lang.String tip)
                throws PdfException,
                       java.io.IOException
sets the widget tooltip

Parameters:
tip - a string which will be display when the mouse is left over the widget, a tooltip
Throws:
PdfException - Raised if a problem occured while parsing the file.
java.io.IOException - Raised if a problem occured while reading the file.


Copyright © 1999-2007 Crionics. All Rights Reserved.