Skip to main content

FormFieldReferenceCollection Class

A collection of form fields that an interactive action affects.

Declaration

public class FormFieldReferenceCollection extends TrackedObjectCollection<FormField>

Remarks

Call the ResetFormAction.getFields() method to access form fields that a reset-form action resets or excludes from the reset operation.

The collection implements the java.util.List interface and does not accept null items. If you add or insert a null item or replace an item with null, the API throws an ArgumentNullException. If you pass an index outside the collection bounds, the API throws an ArgumentOutOfRangeException.

Refer to the following help topic for additional information: Document Navigation Annotations.

The following code snippet creates a link annotation that resets the Name form field:

import java.io.*;
import java.nio.file.*;
import com.devexpress.docs.pdf.*;
import com.devexpress.system.drawing.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (PdfDocument document = new PdfDocument()) {
            Page page = document.getPages().add(595, 842);

            TextBoxField nameField = new TextBoxField("Name");
            TextBoxField emailField = new TextBoxField("Email");
            document.getFields().add(nameField);
            document.getFields().add(emailField);
            page.getAnnotations().add(new TextBoxWidgetAnnotation(nameField, new RectangleF(50, 700, 150, 20)));
            page.getAnnotations().add(new TextBoxWidgetAnnotation(emailField, new RectangleF(50, 670, 150, 20)));

            ResetFormAction resetAction = new ResetFormAction();
            resetAction.getFields().add(nameField);

            page.addTextFragment("Clear Name", 50, 640);
            LinkAnnotation resetLink = new LinkAnnotation(new RectangleF(50, 630, 80, 20));
            resetLink.setActionTarget(new ActionTarget(resetAction));
            page.getAnnotations().add(resetLink);

            Files.createDirectories(Path.of("output"));
            try (OutputStream stream = Files.newOutputStream(Path.of("output", "Document.pdf"))) {
                document.save(stream);
            }
        }
    }
}

Inherited Members

com.devexpress.java.internal.collections.JListAdapter.add(T)
com.devexpress.java.internal.collections.JListAdapter.add(int,T)
com.devexpress.java.internal.collections.JListAdapter.clear()
com.devexpress.java.internal.collections.JListAdapter.contains(java.lang.Object)
com.devexpress.java.internal.collections.JListAdapter.get(int)
com.devexpress.java.internal.collections.JListAdapter.indexOf(java.lang.Object)
com.devexpress.java.internal.collections.JListAdapter.remove(int)
com.devexpress.java.internal.collections.JListAdapter.remove(java.lang.Object)
com.devexpress.java.internal.collections.JListAdapter.set(int,T)
com.devexpress.java.internal.collections.JListAdapter.size()
java.lang.Object.clone()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)
java.util.AbstractCollection.<T>toArray(T[])
java.util.AbstractCollection.addAll(java.util.Collection<? extends E>)
java.util.AbstractCollection.containsAll(java.util.Collection<?>)
java.util.AbstractCollection.isEmpty()
java.util.AbstractCollection.removeAll(java.util.Collection<?>)
java.util.AbstractCollection.retainAll(java.util.Collection<?>)
java.util.AbstractCollection.toArray()
java.util.AbstractCollection.toString()
java.util.AbstractList.add(E)
java.util.AbstractList.add(int,E)
java.util.AbstractList.addAll(int,java.util.Collection<? extends E>)
java.util.AbstractList.equals(java.lang.Object)
java.util.AbstractList.hashCode()
java.util.AbstractList.iterator()
java.util.AbstractList.lastIndexOf(java.lang.Object)
java.util.AbstractList.listIterator()
java.util.AbstractList.listIterator(int)
java.util.AbstractList.removeRange(int,int)
java.util.AbstractList.set(int,E)
java.util.AbstractList.subList(int,int)

Inheritance

Object
java.util.AbstractCollection
java.util.AbstractList
JListAdapter
TrackedObjectCollection<T>
FormFieldReferenceCollection

Constructors

FormFieldReferenceCollection() Constructor

Initializes a new instance of the FormFieldReferenceCollection class.

Declaration

public FormFieldReferenceCollection()

FormFieldReferenceCollection(Iterable<FormField> fields) Constructor

Initializes a new instance of the FormFieldReferenceCollection class with the specified form fields.

Declaration

public FormFieldReferenceCollection(Iterable<FormField> fields)

Parameters

Name Type Description
fields java.lang.Iterable<FormField>

Form fields to add to the collection.

Exceptions

Type Description
ArgumentNullException

Thrown if the fields collection contains a null item.

Methods

getSource() Method

Returns the internal collection that stores collection items.

Declaration

public FormFieldReferenceCollection getSource()

Returns

Type Description
com.devexpress.docs.pdf.internal.FormFieldReferenceCollection

The internal collection.

Remarks

The getSource() method supports the internal infrastructure of the PDF Document API. Do not call the getSource() method in your code.