Class FieldObject

java.lang.Object
com.itextpdf.forms.xfdf.FieldObject

public class FieldObject extends Object
Represents the field element, a child of the fields and field elements. The field element corresponds to a form field. Content model: ( field* | value* | ( value? & value-richtext? )). Required attributes: name. For more details see paragraph 6.3.2 in XFDF document specification.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of FieldObject.
    FieldObject(String name, String value, boolean containsRichText)
    Creates an instance of FieldObject.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the string value of the name attribute of the field element.
    Gets a parent field of current field.
    Gets the string representation of the value-richtext element, a child of the field element and contains the field's value formatted as a rich text string.
    Gets the string representation of the value element, a child of the field element and contains the field's value, whose format may vary depending on the field type.
    boolean
    Gets a boolean indicating if a value-richtext element is present inside the field.
    void
    setContainsRichText(boolean containsRichText)
    Sets a boolean indicating if a value-richtext element is present inside the field.
    void
    setName(String name)
    Sets the string value of the name attribute of the field element.
    void
    Sets a parent field of current field.
    void
    setRichTextValue(String richTextValue)
    Sets the string representation of the value-richtext element, a child of the field element and contains the field's value formatted as a rich text string.
    void
    setValue(String value)
    Sets the string representation of the value element, a child of the field element and contains the field's value, whose format may vary depending on the field type.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FieldObject

      public FieldObject()
      Creates an instance of FieldObject.
    • FieldObject

      public FieldObject (String name, String value, boolean containsRichText)
      Creates an instance of FieldObject.
      Parameters:
      name - the name attribute of the field element
      value - the field's value
      containsRichText - indicates if a value-richtext element is present inside the field
  • Method Details

    • getName

      public String getName()
      Gets the string value of the name attribute of the field element. Corresponds to the T key in the field dictionary. In a hierarchical form field, the name is the partial field name. For more details see paragraph 6.3.2.2 in XFDF document specification.
      Returns:
      String value of field name attribute.
    • setName

      public void setName (String name)
      Sets the string value of the name attribute of the field element. Corresponds to the T key in the field dictionary. In a hierarchical form field, the name is the partial field name.
      Parameters:
      name - String value of field name attribute
    • getValue

      public String getValue()
      Gets the string representation of the value element, a child of the field element and contains the field's value, whose format may vary depending on the field type. Corresponds to the V key in the FDF field dictionary. For more details see paragraph 6.3.3 in XFDF document specification.
      Returns:
      String representation of inner value element of the field.
    • setValue

      public void setValue (String value)
      Sets the string representation of the value element, a child of the field element and contains the field's value, whose format may vary depending on the field type. Corresponds to the V key in the FDF field dictionary.
      Parameters:
      value - String representation of inner value element of the field
    • getRichTextValue

      public String getRichTextValue()
      Gets the string representation of the value-richtext element, a child of the field element and contains the field's value formatted as a rich text string. Corresponds to the RV key in the variable text field dictionary. Content model: text strign or rich text string. For more details see paragraph 6.3.4 in XFDF document specification.
      Returns:
      String representation of inner value-richtext element of the field.
    • setRichTextValue

      public void setRichTextValue (String richTextValue)
      Sets the string representation of the value-richtext element, a child of the field element and contains the field's value formatted as a rich text string. Corresponds to the RV key in the variable text field dictionary. Content model: text string or rich text string.
      Parameters:
      richTextValue - String representation of inner value-richtext element of the field
    • isContainsRichText

      public boolean isContainsRichText()
      Gets a boolean indicating if a value-richtext element is present inside the field.
      Returns:
      true if a value-richtext element is present inside the field, false otherwise.
    • setContainsRichText

      public void setContainsRichText (boolean containsRichText)
      Sets a boolean indicating if a value-richtext element is present inside the field.
      Parameters:
      containsRichText - a boolean indicating if a value-richtext element is present inside the field
    • getParent

      public FieldObject getParent()
      Gets a parent field of current field.
      Returns:
      parent field object of the current field.
    • setParent

      public void setParent (FieldObject parent)
      Sets a parent field of current field.
      Parameters:
      parent - field object that is a parent of the current field