Class AcroFields.Item

  • Enclosing class:
    AcroFields

    public static class AcroFields.Item
    extends java.lang.Object
    The field representations for retrieval and modification.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.ArrayList<PdfDictionary> merged
      An array of PdfDictionary with all the field and widget tags merged.
      protected java.util.ArrayList<java.lang.Integer> page
      An array of Integer with the page numbers where the widgets are displayed.
      protected java.util.ArrayList<java.lang.Integer> tabOrder
      An array of Integer with the tab order of the field in the page.
      protected java.util.ArrayList<PdfDictionary> values
      An array of PdfDictionary where the value tag /V is present.
      protected java.util.ArrayList<PdfIndirectReference> widget_refs
      An array of PdfDictionary with the widget references.
      protected java.util.ArrayList<PdfDictionary> widgets
      An array of PdfDictionary with the widgets.
      static int WRITE_MERGED
      writeToAll constant.
      static int WRITE_VALUE
      writeToAll and markUsed constant.
      static int WRITE_WIDGET
      writeToAll and markUsed constant.
    • Constructor Summary

      Constructors 
      Constructor Description
      Item()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void addMerged​(PdfDictionary mergeDict)
      Adds a merged dictionary to this Item.
      (package private) void addPage​(int pg)
      Adds a page to the current Item.
      (package private) void addTabOrder​(int order)
      Adds a tab order value to this Item.
      (package private) void addValue​(PdfDictionary value)
      Add a value dict to this Item
      (package private) void addWidget​(PdfDictionary widget)
      Add a widget dict to this Item
      (package private) void addWidgetRef​(PdfIndirectReference widgRef)
      Add a widget ref to this Item
      (package private) void forcePage​(int idx, int pg)
      forces a page value into the Item.
      PdfDictionary getMerged​(int idx)
      Retrieve the merged dictionary for the given instance.
      java.lang.Integer getPage​(int idx)
      Retrieve the page number of the given instance
      java.lang.Integer getTabOrder​(int idx)
      Gets the tabOrder.
      PdfDictionary getValue​(int idx)
      Retrieve the value dictionary of the given instance
      PdfDictionary getWidget​(int idx)
      Retrieve the widget dictionary of the given instance
      PdfIndirectReference getWidgetRef​(int idx)
      Retrieve the reference to the given instance
      void markUsed​(AcroFields parentFields, int writeFlags)
      Mark all the item dictionaries used matching the given flags
      (package private) void remove​(int killIdx)
      Remove the given instance from this item.
      int size()
      Preferred method of determining the number of instances of a given field.
      void writeToAll​(PdfName key, PdfObject value, int writeFlags)
      This function writes the given key/value pair to all the instances of merged, widget, and/or value, depending on the writeFlags setting
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • WRITE_MERGED

        public static final int WRITE_MERGED
        writeToAll constant.
        Since:
        2.1.5
        See Also:
        Constant Field Values
      • WRITE_WIDGET

        public static final int WRITE_WIDGET
        writeToAll and markUsed constant.
        Since:
        2.1.5
        See Also:
        Constant Field Values
      • WRITE_VALUE

        public static final int WRITE_VALUE
        writeToAll and markUsed constant.
        Since:
        2.1.5
        See Also:
        Constant Field Values
      • values

        protected java.util.ArrayList<PdfDictionary> values
        An array of PdfDictionary where the value tag /V is present.
        Since:
        5.0.2 public is now protected
      • widgets

        protected java.util.ArrayList<PdfDictionary> widgets
        An array of PdfDictionary with the widgets.
        Since:
        5.0.2 public is now protected
      • widget_refs

        protected java.util.ArrayList<PdfIndirectReference> widget_refs
        An array of PdfDictionary with the widget references.
        Since:
        5.0.2 public is now protected
      • merged

        protected java.util.ArrayList<PdfDictionary> merged
        An array of PdfDictionary with all the field and widget tags merged.
        Since:
        5.0.2 public is now protected
      • page

        protected java.util.ArrayList<java.lang.Integer> page
        An array of Integer with the page numbers where the widgets are displayed.
        Since:
        5.0.2 public is now protected
      • tabOrder

        protected java.util.ArrayList<java.lang.Integer> tabOrder
        An array of Integer with the tab order of the field in the page.
        Since:
        5.0.2 public is now protected
    • Constructor Detail

      • Item

        public Item()
    • Method Detail

      • writeToAll

        public void writeToAll​(PdfName key,
                               PdfObject value,
                               int writeFlags)
        This function writes the given key/value pair to all the instances of merged, widget, and/or value, depending on the writeFlags setting
        Parameters:
        key - you'll never guess what this is for.
        value - if value is null, the key will be removed
        writeFlags - ORed together WRITE_* flags
        Since:
        2.1.5
      • markUsed

        public void markUsed​(AcroFields parentFields,
                             int writeFlags)
        Mark all the item dictionaries used matching the given flags
        Parameters:
        writeFlags - WRITE_MERGED is ignored
        Since:
        2.1.5
      • size

        public int size()
        Preferred method of determining the number of instances of a given field.
        Returns:
        number of instances
        Since:
        2.1.5
      • remove

        void remove​(int killIdx)
        Remove the given instance from this item. It is possible to remove all instances using this function.
        Parameters:
        killIdx -
        Since:
        2.1.5
      • getValue

        public PdfDictionary getValue​(int idx)
        Retrieve the value dictionary of the given instance
        Parameters:
        idx - instance index
        Returns:
        dictionary storing this instance's value. It may be shared across instances.
        Since:
        2.1.5
      • addValue

        void addValue​(PdfDictionary value)
        Add a value dict to this Item
        Parameters:
        value - new value dictionary
        Since:
        2.1.5
      • getWidget

        public PdfDictionary getWidget​(int idx)
        Retrieve the widget dictionary of the given instance
        Parameters:
        idx - instance index
        Returns:
        The dictionary found in the appropriate page's Annot array.
        Since:
        2.1.5
      • addWidget

        void addWidget​(PdfDictionary widget)
        Add a widget dict to this Item
        Parameters:
        widget -
        Since:
        2.1.5
      • getWidgetRef

        public PdfIndirectReference getWidgetRef​(int idx)
        Retrieve the reference to the given instance
        Parameters:
        idx - instance index
        Returns:
        reference to the given field instance
        Since:
        2.1.5
      • addWidgetRef

        void addWidgetRef​(PdfIndirectReference widgRef)
        Add a widget ref to this Item
        Parameters:
        widgRef -
        Since:
        2.1.5
      • getMerged

        public PdfDictionary getMerged​(int idx)
        Retrieve the merged dictionary for the given instance. The merged dictionary contains all the keys present in parent fields, though they may have been overwritten (or modified?) by children. Example: a merged radio field dict will contain /V
        Parameters:
        idx - instance index
        Returns:
        the merged dictionary for the given instance
        Since:
        2.1.5
      • addMerged

        void addMerged​(PdfDictionary mergeDict)
        Adds a merged dictionary to this Item.
        Parameters:
        mergeDict -
        Since:
        2.1.5
      • getPage

        public java.lang.Integer getPage​(int idx)
        Retrieve the page number of the given instance
        Parameters:
        idx -
        Returns:
        remember, pages are "1-indexed", not "0-indexed" like field instances.
        Since:
        2.1.5
      • addPage

        void addPage​(int pg)
        Adds a page to the current Item.
        Parameters:
        pg -
        Since:
        2.1.5
      • forcePage

        void forcePage​(int idx,
                       int pg)
        forces a page value into the Item.
        Parameters:
        idx -
        Since:
        2.1.5
      • getTabOrder

        public java.lang.Integer getTabOrder​(int idx)
        Gets the tabOrder.
        Parameters:
        idx -
        Returns:
        tab index of the given field instance
        Since:
        2.1.5
      • addTabOrder

        void addTabOrder​(int order)
        Adds a tab order value to this Item.
        Parameters:
        order -
        Since:
        2.1.5