// Created on 28-jul-2003
package nu.fw.jeti.jabber.elements;
import java.util.Iterator;
import java.util.List;
/**
* @author E.S. de Boer
*
*/
public class XDataField extends Extension
{
private String desc;//multi add line end
private List options; //more 2 each
private boolean required=false;
private String value; //multi add line end
private String label;
private String var;
private String type;
//
//
//
//
//
//
//
//
//
//
public XDataField(String var, String value)
{
this.var = var;
this.value = value;
}
public XDataField(String var, String value,String type)
{
this.var = var;
this.value = value;
this.type = type;
}
public XDataField(XDataFieldBuilder builder)
{
desc = builder.getDescription();
required =builder.required;
label = builder.label;
var = builder.var;
type = builder.type;
options = builder.getOptions();
value = builder.getValue();
}
public String getDescription()
{
return desc;
}
public boolean hasOptions()
{
return options!=null;
}
public int getOptionsSize()
{
return options.size();
}
/**
* returns options as array of Object[] the label is the first element
* the value the second
* @return Object[]
*/
public Object[] getOptions()
{
return options.toArray();
}
/**
* returns options as Object[] the label is the first element
* the value the second
* @return Iterator
*/
public Iterator getOptionsIterator()
{
return options.iterator();
}
public boolean getRequired()
{
return required;
}
public String getValue()
{
return value;
}
public String getLabel()
{
return label;
}
public String getVar()
{
return var;
}
public String getType()
{
return type;
}
public void appendToXML(StringBuffer xml)
{
xml.append("");
if(desc !=null) xml.append("" +desc+ ""); //addmultiline
if(value !=null) xml.append(""+ value + "");//addmultiline
if(required == true) xml.append("");
if(options !=null)
{
for(Iterator i=options.iterator();i.hasNext();)
{
xml.append("");
}
}
xml.append("");
}
}
/*
* Overrides for emacs
* Local variables:
* tab-width: 4
* End:
*/