📄 xdatafieldbuilder.java
字号:
/*
* License
*
* The contents of this file are subject to the Jabber Open Source License
* Version 1.0 (the "License"). You may not copy or use this file, in either
* source code or executable form, except in compliance with the License. You
* may obtain a copy of the License at http://www.jabber.com/license/ or at
* http://www.opensource.org/.
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Copyrights
*
* Portions created by or assigned to Jabber.com, Inc. are
* Copyright (c) 2000 Jabber.com, Inc. All Rights Reserved. Contact
* information for Jabber.com, Inc. is available at http://www.jabber.com/.
*
* Portions Copyright (c) 1999-2000 David Waite
*
* Acknowledgements
*
* Special thanks to the Jabber Open Source Contributors for their
* suggestions and support of Jabber.
*
* Changes
*
* @author David Waite <a href="mailto:dwaite@jabber.com">
* <i><dwaite@jabber.com></i></a>
*
* @author $Author: chris $
* @version $Revision: 1.1 $
*
* j.komzak
* Changed into XDataFieldBuilder
*/
package edu.ou.kmi.buddyspace.xml;
/*
* XDataFieldBuilder.java
*
* Project: BuddySpace
* (C) Copyright Knowledge Media Institute 2002
*
*
* Created on 5 February 2003, 12:23
*/
import java.util.Vector;
import org.jabber.jabberbeans.Extension.*;
import org.jabber.jabberbeans.*;
/**
* <code>XDataFieldBuilder</code> is used to construct XDataField objects
*
* @author Jiri Komzak, Knowledge Media Institute, Open University, United Kingdom
*/
public class XDataFieldBuilder
implements ExtensionBuilder
{
/** Vector of values fields contained. */
private Vector valueList;
/** Vector of option tags contained. */
private Vector optionList;
/** Attributes. */
private String label;
private String type;
private String var;
private String desc;
private boolean required;
/** Creates a new <code>XDataFieldBuilder</code> instance. */
public XDataFieldBuilder()
{ reset(); }
/**
* <code>reset</code> the builder to a default state, so it can be reused.
*/
public void reset() {
valueList = new Vector();
optionList = new Vector();
label = type = var = desc = null;
required = false;
}
public void setLabel(String newLabel) {
label = newLabel;
}
public String getLabel() {
return label;
}
public void setType(String newType) {
type = newType;
}
public String getType() {
return type;
}
public void setVar(String newVar) {
var = newVar;
}
public String getVar() {
return var;
}
public void setDesc(String newDesc) {
desc = newDesc;
}
public String getDesc() {
return desc;
}
public void setRequired(boolean newRequired) {
required = newRequired;
}
public boolean getRequired() {
return required;
}
public void addValue(String newValue) {
//if (!valueList.contains(newValue))
valueList.addElement(newValue);
}
/**
* <code>addChild</code> adds a new child tag object to the end of this
* list.
*/
public void addChild(XMLData child)
{
if (child instanceof XDataFieldOption)
if (!optionList.contains(child))
optionList.addElement(child);
/*else if (child instanceof SingleValueTag) {
SingleValueTag t = (SingleValueTag) child;
if ("value".equals(t.getName())) {
if (!valueList.contains(t.getValue()))
valueList.addElement(t.getValue());
}
else if ("desc".equals(t.getName()))
desc = t.getValue();
else if ("required".equals(t.getName()))
setRequired(true);
}*/
}
/**
* <code>getOptions</code> returns the vector representing the option
* objects associated with this object.
*
* @return a <code>Vector</code> value
*/
public Vector getOptions()
{ return optionList; }
/**
* <code>getOptions</code> returns the vector representing the value
* objects associated with this object.
*
* @return a <code>Vector</code> value
*/
public Vector getValues()
{ return valueList; }
/**
* <code>build</code> a new MapTag object
*
* @return an <code>Extension</code> value
* @exception InstantiationException if insufficient or incorrect data
* was proviced.
*/
public Extension build()
throws InstantiationException
{ return new XDataField(this); }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -