Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
Tinder is a Java based XMPP library, providing an implementation for XMPP stanzas and components. Tinders origins lie in code that's shared between Jive Software's Openfire and Whack implementations. The implementation that's provided in Tinder hasn't been written again from scratch. Instead, code has been moved from the original projects into Tinder, preserving al of the existing features and functionality. Most of the code that's now in Tinder is based on the org.xmpp package implementation that previously existed in Openfire and Whack. This is the code that defines classes such as Packet, JID, IQ, Component and their extensions. Additionally, some multi-purpose code (such as the DataForm and Result Set Management implementations have been moved to Tinder as well.
/**
* Copyright (C) 2004-2009 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xmpp.forms;
import net.jcip.annotations.NotThreadSafe;
import org.dom4j.Element;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Represents a field of a form. The field could be used to represent a question to complete,
* a completed question or a data returned from a search. The exact interpretation of the field
* depends on the context where the field is used.
*
* @author Gaston Dombiak
*/
@NotThreadSafe
public class FormField {
private Element element;
FormField(Element element) {
this.element = element;
}
/**
* Adds a default value to the question if the question is part of a form to fill out.
* Otherwise, adds an answered value to the question.
*
* Nothing will be added if the provided argument is null.
*
* @param value a default value or an answered value of the question.
*/
public void addValue(Object value) {
if (value == null) {
return;
}
element.addElement("value").setText(DataForm.encode(value));
}
/**
* Removes all the values of the field.
*/
@SuppressWarnings("unchecked")
public void clearValues() {
for (Iterator it = element.elementIterator("value"); it.hasNext();) {
it.next();
it.remove();
}
}
/**
* Adds an available option to the question that the user has in order to answer
* the question.
*
* If argument 'value' is null or an empty String, no option element
* will be added.
*
* @param label a label that represents the option. Optional argument.
* @param value the value of the option.
*/
public void addOption(String label, String value) {
if (value == null || value.trim().length() == 0) {
return;
}
Element option = element.addElement("option");
option.addAttribute("label", label);
option.addElement("value").setText(value);
}
/**
* Returns the available options to answer for this question. The returned options cannot
* be modified but they will be updated if the underlying DOM object gets updated.
*
* @return the available options to answer for this question.
*/
@SuppressWarnings("unchecked")
public List