|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmpp.packet.PacketExtension org.xmpp.forms.DataForm
@NotThreadSafe public class DataForm
Represents a form that could be use for gathering data as well as for reporting data returned from a search.
The form could be of the following types:addReportedField(String,String,FormField.Type)
to set the columns of the report whilst
the report's rows can be configured using addItemFields(Map)
.
Nested Class Summary | |
---|---|
static class |
DataForm.Type
Type-safe enumeration to represent the type of the Data forms. |
Field Summary | |
---|---|
static java.lang.String |
ELEMENT_NAME
Element name of the packet extension. |
static java.lang.String |
NAMESPACE
Namespace of the packet extension. |
Fields inherited from class org.xmpp.packet.PacketExtension |
---|
docFactory, element, registeredExtensions |
Constructor Summary | |
---|---|
DataForm(DataForm.Type type)
|
|
DataForm(org.dom4j.Element element)
|
Method Summary | |
---|---|
FormField |
addField()
Adds a new field as part of the form. |
FormField |
addField(java.lang.String variable,
java.lang.String label,
FormField.Type type)
Adds a new field as part of the form. |
void |
addInstruction(java.lang.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 |
addItemFields(java.util.Map<java.lang.String,java.lang.Object> fields)
Adds a new row of items of reported data. |
void |
addReportedField(java.lang.String variable,
java.lang.String label,
FormField.Type type)
Adds a field to the list of fields that will be returned from a search. |
void |
clearInstructions()
Clears all the stored instructions in this packet extension. |
DataForm |
createCopy()
Creates a deep copy of this packet extension. |
FormField |
getField(java.lang.String variable)
Returns the field whose variable matches the specified variable. |
java.util.List<FormField> |
getFields()
Returns the fields that are part of the form. |
java.util.List<java.lang.String> |
getInstructions()
Returns an unmodifiable list of instructions that explain how to fill out the form and what the form is about. |
java.lang.String |
getTitle()
Returns the description of the data form. |
DataForm.Type |
getType()
Returns the type of this data form. |
static boolean |
parseBoolean(java.lang.String booleanString)
|
static java.util.Date |
parseDate(java.lang.String date)
Returns the Date obtained by parsing the specified date representation. |
boolean |
removeField(java.lang.String variable)
Removes the field whose variable matches the specified variable. |
void |
setTitle(java.lang.String title)
Sets the description of the data. |
Methods inherited from class org.xmpp.packet.PacketExtension |
---|
getElement, getExtensionClass |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ELEMENT_NAME
public static final java.lang.String NAMESPACE
Constructor Detail |
---|
public DataForm(DataForm.Type type)
public DataForm(org.dom4j.Element element)
Method Detail |
---|
public static java.util.Date parseDate(java.lang.String date) throws java.text.ParseException
date
- date representation in the UTC GMT+0 format.
java.text.ParseException
- if an error occurs while parsing the date representation.public static boolean parseBoolean(java.lang.String booleanString) throws java.text.ParseException
java.text.ParseException
public DataForm.Type getType()
DataForm.Type
public void setTitle(java.lang.String title)
title
- description of the data.public java.lang.String getTitle()
public java.util.List<java.lang.String> getInstructions()
public void addInstruction(java.lang.String instruction)
Nothing will be set, if the provided argument is null or an empty String.
instruction
- the new instruction that explain how to fill out the form.public void clearInstructions()
public FormField addField()
public FormField addField(java.lang.String variable, java.lang.String label, FormField.Type type)
variable
- the unique identifier of the field in the context of the
form. Optional parameter.type
- an indicative of the format for the data. Optional parameter.label
- the label of the question. Optional parameter.
public java.util.List<FormField> getFields()
public FormField getField(java.lang.String variable)
variable
- the variable name of the field to search.
public boolean removeField(java.lang.String variable)
variable
- the variable name of the field to remove.
public void addReportedField(java.lang.String variable, java.lang.String label, FormField.Type type)
variable
- variable name of the new column. This value will be used in
addItemFields(java.util.Map)
when adding reported items.label
- label that corresponds to the new column. Optional parameter.type
- indicates the type of field of the new column. Optional parameter.public void addItemFields(java.util.Map<java.lang.String,java.lang.Object> fields)
Collection
. Since the value is of type Object
it
is possible to include any type of object as a value. The actual value to include in the
data form is the result of the encode(Object)
method.
fields
- list of public DataForm createCopy()
PacketExtension
createCopy
in class PacketExtension
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |