public class DataForm extends Object implements ExtensionElement
Modifier and Type | Class and Description |
---|---|
static class |
DataForm.Item
Represents items of reported data.
|
static class |
DataForm.ReportedData
Represents the fields that will be returned from a search.
|
static class |
DataForm.Type |
Modifier and Type | Field and Description |
---|---|
static String |
ELEMENT |
static String |
NAMESPACE |
Constructor and Description |
---|
DataForm(DataForm.Type type) |
Modifier and Type | Method and Description |
---|---|
void |
addExtensionElement(Element element) |
void |
addField(FormField field)
Adds a new field as part of the form.
|
boolean |
addFields(Collection<FormField> fieldsToAdd)
Add the given fields to this form.
|
void |
addInstruction(String instruction)
Adds a new instruction to the list of instructions that explain how to fill out the form
and what the form is about.
|
void |
addItem(DataForm.Item item)
Adds a new item returned from a search.
|
static DataForm |
from(Stanza packet)
Get data form from stanza.
|
String |
getElementName()
Returns the root element name.
|
List<Element> |
getExtensionElements() |
FormField |
getField(String variableName)
Return the form field with the given variable name or null.
|
List<FormField> |
getFields()
Returns a List of the fields that are part of the form.
|
FormField |
getHiddenFormTypeField()
Returns the hidden FORM_TYPE field or null if this data form has none.
|
List<String> |
getInstructions()
Returns a List of the list of instructions that explain how to fill out the form and
what the form is about.
|
List<DataForm.Item> |
getItems()
Returns a List of the items returned from a search.
|
String |
getNamespace()
Returns the root element XML namespace.
|
DataForm.ReportedData |
getReportedData()
Returns the fields that will be returned from a search.
|
String |
getTitle()
Returns the description of the data.
|
DataForm.Type |
getType()
Returns the meaning of the data within the context.
|
boolean |
hasField(String variableName)
Check if a form field with the given variable name exists.
|
boolean |
hasHiddenFormTypeField()
Returns true if this DataForm has at least one FORM_TYPE field which is
hidden.
|
void |
setInstructions(List<String> instructions)
Sets the list of instructions that explain how to fill out the form and what the form is
about.
|
void |
setReportedData(DataForm.ReportedData reportedData)
Sets the fields that will be returned from a search.
|
void |
setTitle(String title)
Sets the description of the data.
|
XmlStringBuilder |
toXML(String enclosingNamespace)
Returns the XML representation of this Element.
|
public static final String NAMESPACE
public static final String ELEMENT
public DataForm(DataForm.Type type)
public DataForm.Type getType()
public String getTitle()
public List<String> getInstructions()
public DataForm.ReportedData getReportedData()
public List<DataForm.Item> getItems()
public List<FormField> getFields()
public FormField getField(String variableName)
variableName
- public boolean hasField(String variableName)
variableName
- public String getElementName()
NamedElement
getElementName
in interface NamedElement
public String getNamespace()
ExtensionElement
getNamespace
in interface ExtensionElement
public void setTitle(String title)
title
- description of the data.public void setInstructions(List<String> instructions)
instructions
- list of instructions that explain how to fill out the form.public void setReportedData(DataForm.ReportedData reportedData)
reportedData
- the fields that will be returned from a search.public void addField(FormField field)
field
- the field to add to the form.public boolean addFields(Collection<FormField> fieldsToAdd)
fieldsToAdd
- public void addInstruction(String instruction)
instruction
- the new instruction that explain how to fill out the form.public void addItem(DataForm.Item item)
item
- the item returned from a search.public void addExtensionElement(Element element)
public List<Element> getExtensionElements()
public FormField getHiddenFormTypeField()
public boolean hasHiddenFormTypeField()
public XmlStringBuilder toXML(String enclosingNamespace)
Element