public class FormEditor extends java.lang.Object implements com.aspose.ms.System.Collections.Generic.IGenericEnumerable<FormElementBase>, com.aspose.ms.System.IDisposable
This class represents the editor over the HTMLFormElement
that creates a easier way for .net developers to edit the html forms.
Modifier and Type | Method and Description |
---|---|
<T extends FormElementBase> |
add(java.lang.String name,
java.lang.Class<T> clazz)
Creates a new
HTMLElement and adds it to the end of the form. |
InputElement |
addInput(java.lang.String name)
Creates a new
InputElement and adds it to the end of the form. |
InputElement |
addInput(java.lang.String name,
int type)
Creates a new
InputElement and adds it to the end of the form. |
static FormEditor |
create(HTMLDocument document,
int index)
Creates a new
FormEditor based on HTMLFormElement selected from the HTMLDocument.Forms (HTMLDocument.getForms() ) collection by index. |
static FormEditor |
create(HTMLDocument document,
java.lang.String id)
Creates a new
FormEditor based on HTMLFormElement selected from the document by id. |
static FormEditor |
create(HTMLFormElement form)
Creates a new
FormEditor based on HTMLFormElement . |
static FormEditor |
createNew(HTMLDocument document)
Creates a new
HTMLFormElement and associated it with FormEditor . |
void |
dispose()
Releases unmanaged and managed resources.
|
void |
fill(com.aspose.ms.System.Collections.Generic.IGenericDictionary<java.lang.String,java.lang.String> values)
Deprecated.
|
void |
fill(java.util.Map values) |
FormElementBase |
get_Item(int index)
Returns the element by specified index.
|
FormElementBase |
get_Item(java.lang.String name)
Returns the element by specified name or id.
|
java.lang.String |
getAction()
Server-side form handler.
|
int |
getCount()
The number of form controls in the form.
|
<T extends FormElementBase> |
getElement(java.lang.Class<T> typeOfT,
int index)
Returns the element by specified index.
|
<T extends FormElementBase> |
getElement(java.lang.Class<T> typeOfT,
java.lang.String name)
Returns the element by specified name.
|
HTMLFormElement |
getForm()
The original
HTMLFormElement that is associated with current instance of FormEditor . |
HttpMethod |
getMethod() |
com.aspose.ms.System.Collections.Generic.IGenericEnumerator<FormElementBase> |
iterator()
Gets the enumerator.
|
void |
setAction(java.lang.String value)
Server-side form handler.
|
void |
setMethod(HttpMethod value) |
public static FormEditor createNew(HTMLDocument document)
Creates a new HTMLFormElement
and associated it with FormEditor
. HTMLFormElement
is created in the detached from the document state; in order to attach it to the document, please select proper location and use Node.appendChild(Node)
method.
document
- The HTMLDocument
.FormEditor
classpublic static FormEditor create(HTMLFormElement form)
Creates a new FormEditor
based on HTMLFormElement
.
form
- The html form elementFormEditor
classpublic static FormEditor create(HTMLDocument document, int index)
Creates a new FormEditor
based on HTMLFormElement
selected from the HTMLDocument.Forms
(HTMLDocument.getForms()
) collection by index.
document
- The document.index
- The index inside the forms collection.FormEditor
classDOMException
- The exception is occured if index out of the range.public static FormEditor create(HTMLDocument document, java.lang.String id)
Creates a new FormEditor
based on HTMLFormElement
selected from the document by id.
document
- The document.id
- The identifier.public HTMLFormElement getForm()
The original HTMLFormElement
that is associated with current instance of FormEditor
.
public int getCount()
The number of form controls in the form.
public HttpMethod getMethod()
public void setMethod(HttpMethod value)
public java.lang.String getAction()
Server-side form handler. See the action attribute definition in HTML 4.01.
public void setAction(java.lang.String value)
Server-side form handler. See the action attribute definition in HTML 4.01.
public <T extends FormElementBase> T add(java.lang.String name, java.lang.Class<T> clazz)
Creates a new HTMLElement
and adds it to the end of the form.
name
- Name of the element
T
: Type of form element
public InputElement addInput(java.lang.String name)
Creates a new InputElement
and adds it to the end of the form.
name
- Name of input elementInputElement
.public InputElement addInput(java.lang.String name, int type)
Creates a new InputElement
and adds it to the end of the form.
name
- Name of input elementtype
- Type of input elementInputElement
.public FormElementBase get_Item(int index)
Returns the element by specified index.
index
- The index of the elementpublic FormElementBase get_Item(java.lang.String name)
Returns the element by specified name or id.
name
- The element namepublic <T extends FormElementBase> T getElement(java.lang.Class<T> typeOfT, int index)
Returns the element by specified index.
index
- The index of the element
T
: Type of the form element
public <T extends FormElementBase> T getElement(java.lang.Class<T> typeOfT, java.lang.String name)
Returns the element by specified name.
name
- The element name
T
: Type of the form element
@Deprecated public void fill(com.aspose.ms.System.Collections.Generic.IGenericDictionary<java.lang.String,java.lang.String> values)
This method fills the whole form with the specified values.
values
- The values represented by key-value pair that is contains name and value for form elements.public void fill(java.util.Map values)
public com.aspose.ms.System.Collections.Generic.IGenericEnumerator<FormElementBase> iterator()
Gets the enumerator.
iterator
in interface com.aspose.ms.System.Collections.Generic.IGenericEnumerable<FormElementBase>
iterator
in interface com.aspose.ms.System.Collections.IEnumerable<FormElementBase>
iterator
in interface java.lang.Iterable<FormElementBase>
public void dispose()
Releases unmanaged and managed resources.
dispose
in interface com.aspose.ms.System.IDisposable