Openfire 3.4.1 Javadoc

org.xmpp.forms
Class DataForm

java.lang.Object
  extended by org.xmpp.packet.PacketExtension
      extended by org.xmpp.forms.DataForm

public class DataForm
extends PacketExtension

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:

In case the form represents a search, the report will be structured in columns and rows. Use addReportedField(String,String,FormField.Type) to set the columns of the report whilst the report's rows can be configured using addItemFields(Map).

Author:
Gaston Dombiak

Nested Class Summary
static class DataForm.Type
          Type-safe enumeration to represent the type of the Data forms.
 
Field Summary
static String ELEMENT_NAME
          Element name of the packet extension.
static 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.
 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 addItemFields(Map<String,Object> fields)
          Adds a new row of items of reported data.
 void addReportedField(String variable, 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(String variable)
          Returns the field whose variable matches the specified variable.
 List<FormField> getFields()
          Returns the fields that are part of the form.
 List<String> getInstructions()
          Returns an unmodifiable list of instructions that explain how to fill out the form and what the form is about.
 String getTitle()
          Returns the description of the data form.
 DataForm.Type getType()
          Returns the type of this data form.
static boolean parseBoolean(String booleanString)
           
static Date parseDate(String date)
          Returns the Date obtained by parsing the specified date representation.
 boolean removeField(String variable)
          Removes the field whose variable matches the specified variable.
 void setTitle(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

ELEMENT_NAME

public static final String ELEMENT_NAME
Element name of the packet extension.

See Also:
Constant Field Values

NAMESPACE

public static final String NAMESPACE
Namespace of the packet extension.

See Also:
Constant Field Values
Constructor Detail

DataForm

public DataForm(DataForm.Type type)

DataForm

public DataForm(org.dom4j.Element element)
Method Detail

parseDate

public static Date parseDate(String date)
                      throws ParseException
Returns the Date obtained by parsing the specified date representation. The date representation is expected to be in the UTC GMT+0 format.

Parameters:
date - date representation in the UTC GMT+0 format.
Returns:
the Date obtained by parsing the specified date representation.
Throws:
ParseException - if an error occurs while parsing the date representation.

parseBoolean

public static boolean parseBoolean(String booleanString)
                            throws ParseException
Throws:
ParseException

getType

public DataForm.Type getType()
Returns the type of this data form.

Returns:
the data form type.
See Also:
DataForm.Type

setTitle

public void setTitle(String title)
Sets the description of the data. It is similar to the title on a web page or an X window. You can put a on either a form to fill out, or a set of data results. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>title</CODE> - description of the data.</DL> </DD> </DL> <HR> <A NAME="getTitle()"><!-- --></A><H3> getTitle</H3> <PRE> public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> <B>getTitle</B>()</PRE> <DL> <DD>Returns the description of the data form. It is similar to the title on a web page or an X window. You can put a <title/> on either a form to fill out, or a set of data results. <P> <DD><DL> <DT><B>Returns:</B><DD>description of the data.</DL> </DD> </DL> <HR> <A NAME="getInstructions()"><!-- --></A><H3> getInstructions</H3> <PRE> public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html" title="class or interface in java.util">List</A><<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>> <B>getInstructions</B>()</PRE> <DL> <DD>Returns an unmodifiable list of instructions that explain how to fill out the form and what the form is about. The dataform could include multiple instructions since each instruction could not contain newlines characters. <P> <DD><DL> <DT><B>Returns:</B><DD>an unmodifiable list of instructions that explain how to fill out the form.</DL> </DD> </DL> <HR> <A NAME="addInstruction(java.lang.String)"><!-- --></A><H3> addInstruction</H3> <PRE> public void <B>addInstruction</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> instruction)</PRE> <DL> <DD>Adds a new instruction to the list of instructions that explain how to fill out the form and what the form is about. The dataform could include multiple instructions since each instruction could not contain newlines characters. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>instruction</CODE> - the new instruction that explain how to fill out the form.</DL> </DD> </DL> <HR> <A NAME="clearInstructions()"><!-- --></A><H3> clearInstructions</H3> <PRE> public void <B>clearInstructions</B>()</PRE> <DL> <DD>Clears all the stored instructions in this packet extension. <P> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="addField()"><!-- --></A><H3> addField</H3> <PRE> public <A HREF="../../../org/xmpp/forms/FormField.html" title="class in org.xmpp.forms">FormField</A> <B>addField</B>()</PRE> <DL> <DD>Adds a new field as part of the form. <P> <DD><DL> <DT><B>Returns:</B><DD>the newly created field.</DL> </DD> </DL> <HR> <A NAME="getFields()"><!-- --></A><H3> getFields</H3> <PRE> public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/List.html" title="class or interface in java.util">List</A><<A HREF="../../../org/xmpp/forms/FormField.html" title="class in org.xmpp.forms">FormField</A>> <B>getFields</B>()</PRE> <DL> <DD>Returns the fields that are part of the form. <P> <DD><DL> <DT><B>Returns:</B><DD>fields that are part of the form.</DL> </DD> </DL> <HR> <A NAME="getField(java.lang.String)"><!-- --></A><H3> getField</H3> <PRE> public <A HREF="../../../org/xmpp/forms/FormField.html" title="class in org.xmpp.forms">FormField</A> <B>getField</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> variable)</PRE> <DL> <DD>Returns the field whose variable matches the specified variable. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>variable</CODE> - the variable name of the field to search. <DT><B>Returns:</B><DD>the field whose variable matches the specified variable</DL> </DD> </DL> <HR> <A NAME="removeField(java.lang.String)"><!-- --></A><H3> removeField</H3> <PRE> public boolean <B>removeField</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> variable)</PRE> <DL> <DD>Removes the field whose variable matches the specified variable. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>variable</CODE> - the variable name of the field to remove. <DT><B>Returns:</B><DD>true if the field was removed.</DL> </DD> </DL> <HR> <A NAME="addReportedField(java.lang.String, java.lang.String, org.xmpp.forms.FormField.Type)"><!-- --></A><H3> addReportedField</H3> <PRE> public void <B>addReportedField</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> variable, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> label, <A HREF="../../../org/xmpp/forms/FormField.Type.html" title="enum in org.xmpp.forms">FormField.Type</A> type)</PRE> <DL> <DD>Adds a field to the list of fields that will be returned from a search. Each field represents a column in the report. The order of the columns in the report will honor the sequence in which they were added. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>variable</CODE> - variable name of the new column. This value will be used in <A HREF="../../../org/xmpp/forms/DataForm.html#addItemFields(java.util.Map)"><CODE>addItemFields(java.util.Map<java.lang.String, java.lang.Object>)</CODE></A> when adding reported items.<DD><CODE>label</CODE> - label that corresponds to the new column. Optional parameter.<DD><CODE>type</CODE> - indicates the type of field of the new column. Optional parameter.</DL> </DD> </DL> <HR> <A NAME="addItemFields(java.util.Map)"><!-- --></A><H3> addItemFields</H3> <PRE> public void <B>addItemFields</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Map.html" title="class or interface in java.util">Map</A><<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>,<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A>> fields)</PRE> <DL> <DD>Adds a new row of items of reported data. For each entry in the <tt>fields</tt> parameter a <tt>field</tt> element will be added to the <item> element. The variable of the new <tt>field</tt> will be the key of the entry. The new <tt>field</tt> will have several values if the entry's value is a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collection.html" title="class or interface in java.util"><CODE>Collection</CODE></A>. Since the value is of type <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang"><CODE>Object</CODE></A> 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 <A HREF="../../../org/xmpp/forms/DataForm.html#encode(java.lang.Object)"><CODE>encode(Object)</CODE></A> method. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>fields</CODE> - list of <variable,value> to be added as a new item.</DL> </DD> </DL> <HR> <A NAME="createCopy()"><!-- --></A><H3> createCopy</H3> <PRE> public <A HREF="../../../org/xmpp/forms/DataForm.html" title="class in org.xmpp.forms">DataForm</A> <B>createCopy</B>()</PRE> <DL> <DD><B>Description copied from class: <CODE><A HREF="../../../org/xmpp/packet/PacketExtension.html#createCopy()">PacketExtension</A></CODE></B></DD> <DD>Creates a deep copy of this packet extension. <P> <DD><DL> <DT><B>Overrides:</B><DD><CODE><A HREF="../../../org/xmpp/packet/PacketExtension.html#createCopy()">createCopy</A></CODE> in class <CODE><A HREF="../../../org/xmpp/packet/PacketExtension.html" title="class in org.xmpp.packet">PacketExtension</A></CODE></DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>a deep copy of this packet extension.</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev">  <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> <b>Openfire 3.4.1 Javadoc</b></EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  PREV CLASS   <A HREF="../../../org/xmpp/forms/DataForm.Type.html" title="enum in org.xmpp.forms"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/xmpp/forms/DataForm.html" target="_top"><B>FRAMES</B></A>    <A HREF="DataForm.html" target="_top"><B>NO FRAMES</B></A>    <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <i>Copyright © 2003-2007 Jive Software.</i> </BODY> </HTML>