tigase.jaxmpp.core.client.xmpp.forms
Class JabberDataElement

java.lang.Object
  extended by tigase.jaxmpp.core.client.xml.ElementWrapper
      extended by tigase.jaxmpp.core.client.xmpp.forms.JabberDataElement
All Implemented Interfaces:
Element

public class JabberDataElement
extends ElementWrapper

Implementation of Data Form.


Constructor Summary
JabberDataElement(Element x)
          Creates instance of JabberDataElement and parse fields.
JabberDataElement(XDataType type)
          Creates empty form instance.
 
Method Summary
 BooleanField addBooleanField(String var, Boolean value)
          Adds boolean field to form.
protected  void addField(AbstractField<?> f)
           
 FixedField addFixedField(String value)
          Adds fixed field to form.
 void addFORM_TYPE(String value)
          Adds field "FORM_TYPE" hidded field to form.
 HiddenField addHiddenField(String var, String value)
          Adds hidden field to form.
 JidMultiField addJidMultiField(String var, JID... value)
          Adds jid-multi field to form.
 JidSingleField addJidSingleField(String var, JID value)
          Adds jid-single field to form.
 ListMultiField addListMultiField(String var, String... value)
          Adds list-multi field to form.
 ListSingleField addListSingleField(String var, String value)
          Adds list-single field to form.
 TextMultiField addTextMultiField(String var, String... value)
          Adds text-multi field to form.
 TextPrivateField addTextPrivateField(String var, String value)
          Adds text-private field to form.
 TextSingleField addTextSingleField(String var, String value)
          Adds text-single field to form.
 Element createSubmitableElement(XDataType type)
          Creates XML Element contains only values of fields.
<X extends AbstractField<?>>
X
getField(String var)
          Returns field with given name.
 ArrayList<AbstractField<?>> getFields()
          Returns all fields of form.
 String getInstructions()
          Returns natural language instruction.
 String getTitle()
          Returns title.
 XDataType getType()
          Return data type.
 void setInstructions(String instructions)
          Sets natural-language instruction.
 void setTitle(String title)
          Sets form title.
 
Methods inherited from class tigase.jaxmpp.core.client.xml.ElementWrapper
addChild, equals, getAsString, getAttribute, getAttributes, getChildAfter, getChildElementValue, getChildElementValue, getChildren, getChildren, getChildrenNS, getChildrenNS, getFirstChild, getFirstChild, getName, getNextSibling, getParent, getValue, getXMLNS, hashCode, removeAttribute, removeChild, setAttribute, setAttributes, setChildElementValue, setChildElementValue, setParent, setValue, setXMLNS
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JabberDataElement

public JabberDataElement(Element x)
                  throws JaxmppException
Creates instance of JabberDataElement and parse fields.

Parameters:
x - <x xmlns='jabber:x:data'/> element.
Throws:
JaxmppException

JabberDataElement

public JabberDataElement(XDataType type)
                  throws XMLException
Creates empty form instance.

Parameters:
type - type of data.
Throws:
XMLException
Method Detail

addBooleanField

public final BooleanField addBooleanField(String var,
                                          Boolean value)
                                   throws XMLException
Adds boolean field to form.

Parameters:
var - name of field
value - value of field
Returns:
BooleanField
Throws:
XMLException

addField

protected void addField(AbstractField<?> f)
                 throws XMLException
Throws:
XMLException

addFixedField

public final FixedField addFixedField(String value)
                               throws XMLException
Adds fixed field to form.

Parameters:
value - value of field
Returns:
FixedField
Throws:
XMLException

addFORM_TYPE

public void addFORM_TYPE(String value)
                  throws XMLException
Adds field "FORM_TYPE" hidded field to form.

Parameters:
value - value of field
Throws:
XMLException

addHiddenField

public final HiddenField addHiddenField(String var,
                                        String value)
                                 throws XMLException
Adds hidden field to form.

Parameters:
var - name of field
value - value of field
Returns:
HiddenField
Throws:
XMLException

addJidMultiField

public final JidMultiField addJidMultiField(String var,
                                            JID... value)
                                     throws XMLException
Adds jid-multi field to form.

Parameters:
var - name of field
value - values of field
Returns:
JidMultiField
Throws:
XMLException

addJidSingleField

public final JidSingleField addJidSingleField(String var,
                                              JID value)
                                       throws XMLException
Adds jid-single field to form.

Parameters:
var - name of field
value - value of field
Returns:
JidSingleField
Throws:
XMLException

addListMultiField

public final ListMultiField addListMultiField(String var,
                                              String... value)
                                       throws XMLException
Adds list-multi field to form.

Parameters:
var - name of field
value - values of field
Returns:
ListMultiField
Throws:
XMLException

addListSingleField

public final ListSingleField addListSingleField(String var,
                                                String value)
                                         throws XMLException
Adds list-single field to form.

Parameters:
var - name of field.
value - value of field
Returns:
ListSingleField
Throws:
XMLException

addTextMultiField

public final TextMultiField addTextMultiField(String var,
                                              String... value)
                                       throws XMLException
Adds text-multi field to form.

Parameters:
var - name of field
value - values of field
Returns:
TextMultiField
Throws:
XMLException

addTextPrivateField

public final TextPrivateField addTextPrivateField(String var,
                                                  String value)
                                           throws XMLException
Adds text-private field to form.

Parameters:
var - name of field.
value - value of field
Returns:
TextPrivateField
Throws:
XMLException

addTextSingleField

public final TextSingleField addTextSingleField(String var,
                                                String value)
                                         throws XMLException
Adds text-single field to form.

Parameters:
var - name of field.
value - value od field.
Returns:
TextSingleField
Throws:
XMLException

createSubmitableElement

public Element createSubmitableElement(XDataType type)
                                throws XMLException
Creates XML Element contains only values of fields.

Parameters:
type - data type
Returns:
<x xmlns='jabber:x:data'/> XML Element with form
Throws:
XMLException

getField

public <X extends AbstractField<?>> X getField(String var)
Returns field with given name.

Parameters:
var - name of field
Returns:
field or null is field with given name doesn't exists in form.

getFields

public ArrayList<AbstractField<?>> getFields()
Returns all fields of form.

Returns:
list of all fields in form.

getInstructions

public String getInstructions()
                       throws XMLException
Returns natural language instruction.

Returns:
natural language instruction.
Throws:
XMLException

getTitle

public String getTitle()
                throws XMLException
Returns title.

Returns:
title
Throws:
XMLException

getType

public XDataType getType()
                  throws XMLException
Return data type.

Returns:
XDataType
Throws:
XMLException

setInstructions

public void setInstructions(String instructions)
                     throws XMLException
Sets natural-language instruction.

Parameters:
instructions - instruction.
Throws:
XMLException

setTitle

public void setTitle(String title)
              throws XMLException
Sets form title.

Parameters:
title - title
Throws:
XMLException


Copyright © 2006-2012 Tigase. All Rights Reserved.