congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Form.isSubmitType
Code IndexAdd Tabnine to your IDE (free)

How to use
isSubmitType
method
in
org.jivesoftware.smackx.xdata.Form

Best Java code snippets using org.jivesoftware.smackx.xdata.Form.isSubmitType (Showing top 4 results out of 315)

origin: igniterealtime/Smack

/**
 * Sets a new Object value to a given form's field. In fact, the object representation
 * (i.e. #toString) will be the actual value of the field.<p>
 *
 * If the value to set to the field is not a basic type (e.g. String, boolean, int, etc.) you
 * will need to use {@link #setAnswer(String, String)} where the String value is the
 * String representation of the object.<p>
 *
 * Before setting the new value to the field we will check if the form is of type submit. If
 * the form isn't of type submit means that it's not possible to complete the form and an
 * exception will be thrown.
 *
 * @param field the form field that was completed.
 * @param value the Object value that was answered. The object representation will be the
 * actual value.
 * @throws IllegalStateException if the form is not of type "submit".
 */
private void setAnswer(FormField field, Object value) {
  if (!isSubmitType()) {
    throw new IllegalStateException("Cannot set an answer if the form is not of type " +
    "\"submit\"");
  }
  field.resetValues();
  field.addValue(value.toString());
}
origin: igniterealtime/Smack

/**
 * Sets the default value as the value of a given form's field. The field whose variable matches
 * the requested variable will be completed with its default value. If no field could be found
 * for the specified variable then an exception will be raised.
 *
 * @param variable the variable to complete with its default value.
 * @throws IllegalStateException if the form is not of type "submit".
 * @throws IllegalArgumentException if the form does not include the specified variable.
 */
public void setDefaultAnswer(String variable) {
  if (!isSubmitType()) {
    throw new IllegalStateException("Cannot set an answer if the form is not of type " +
    "\"submit\"");
  }
  FormField field = getField(variable);
  if (field != null) {
    // Clear the old values
    field.resetValues();
    // Set the default value
    for (CharSequence value : field.getValues()) {
      field.addValue(value);
    }
  }
  else {
    throw new IllegalArgumentException("Couldn't find a field for the specified variable.");
  }
}
origin: igniterealtime/Smack

if (!isSubmitType()) {
  throw new IllegalStateException("Cannot set an answer if the form is not of type " +
  "\"submit\"");
origin: igniterealtime/Smack

/**
 * Returns a DataForm that serves to send this Form to the server. If the form is of type
 * submit, it may contain fields with no value. These fields will be removed since they only
 * exist to assist the user while editing/completing the form in a UI.
 *
 * @return the wrapped DataForm.
 */
public DataForm getDataFormToSend() {
  if (isSubmitType()) {
    // Create a new DataForm that contains only the answered fields
    DataForm dataFormToSend = new DataForm(getType());
    for (FormField field : getFields()) {
      if (!field.getValues().isEmpty()) {
        dataFormToSend.addField(field);
      }
    }
    return dataFormToSend;
  }
  return dataForm;
}
org.jivesoftware.smackx.xdataFormisSubmitType

Javadoc

Returns true if the form is a form to submit.

Popular methods of Form

  • createAnswerForm
    Returns a new Form to submit the completed values. The new Form will include all the fields of the o
  • setAnswer
    Sets a new Object value to a given form's field. In fact, the object representation (i.e. #toString)
  • <init>
    Creates a new Form that will wrap an existing DataForm. The wrapped DataForm must be used for gather
  • addField
    Adds a new field to complete as part of the form.
  • getDataFormToSend
    Returns a DataForm that serves to send this Form to the server. If the form is of type submit, it ma
  • getField
    Returns the field of the form whose variable matches the specified variable. The fields of type FIXE
  • getFields
    Returns a List of the fields that are part of the form.
  • getFormFrom
    Returns a new ReportedData if the stanza is used for gathering data and includes an extension that m
  • setDefaultAnswer
    Sets the default value as the value of a given form's field. The field whose variable matches the re
  • getInstructions
    Returns the instructions that explain how to fill out the form and what the form is about.
  • getType
    Returns the meaning of the data within the context. The data could be part of a form to fill out, a
  • hasField
    Check if a field with the given variable exists.
  • getType,
  • hasField,
  • isFormType,
  • setInstructions,
  • setTitle,
  • validateThatFieldIsText

Popular in Java

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • setContentView (Activity)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • ImageIO (javax.imageio)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now