Home | History | Annotate | Download | only in smackx

Lines Matching defs:form

33  * Represents a Form for gathering data. The form could be of the following types:
35 * <li>form -> Indicates a form to fill out.</li>
36 * <li>submit -> The form is filled out, and this is the data that is being returned from
37 * the form.</li>
38 * <li>cancel -> The form was cancelled. Tell the asker that piece of information.</li>
42 * Depending of the form's type different operations are available. For example, it's only possible
43 * to set answers if the form is of type "submit".
49 public class Form {
51 public static final String TYPE_FORM = "form";
66 * @return the data form parsed from the packet or <tt>null</tt> if there was not
67 * a form in the packet.
69 public static Form getFormFrom(Packet packet) {
76 return new Form(dataForm);
83 * Creates a new Form that will wrap an existing DataForm. The wrapped DataForm must be
86 * @param dataForm the data form used for gathering data.
88 public Form(DataForm dataForm) {
93 * Creates a new Form of a given type from scratch.<p>
95 * Possible form types are:
97 * <li>form -> Indicates a form to fill out.</li>
98 * <li>submit -> The form is filled out, and this is the data that is being returned from
99 * the form.</li>
100 * <li>cancel -> The form was cancelled. Tell the asker that piece of information.</li>
104 * @param type the form's type (e.g. form, submit,cancel,result).
106 public Form(String type) {
111 * Adds a new field to complete as part of the form.
120 * Sets a new String value to a given form's field. The field whose variable matches the
129 * @throws IllegalStateException if the form is not of type "submit".
130 * @throws IllegalArgumentException if the form does not include the specified variable or
149 * Sets a new int value to a given form's field. The field whose variable matches the
155 * @throws IllegalStateException if the form is not of type "submit".
156 * @throws IllegalArgumentException if the form does not include the specified variable or
173 * Sets a new long value to a given form's field. The field whose variable matches the
179 * @throws IllegalStateException if the form is not of type "submit".
180 * @throws IllegalArgumentException if the form does not include the specified variable or
197 * Sets a new float value to a given form's field. The field whose variable matches the
203 * @throws IllegalStateException if the form is not of type "submit".
204 * @throws IllegalArgumentException if the form does not include the specified variable or
221 * Sets a new double value to a given form's field. The field whose variable matches the
227 * @throws IllegalStateException if the form is not of type "submit".
228 * @throws IllegalArgumentException if the form does not include the specified variable or
245 * Sets a new boolean value to a given form's field. The field whose variable matches the
251 * @throws IllegalStateException if the form is not of type "submit".
252 * @throws IllegalArgumentException if the form does not include the specified variable or
267 * Sets a new Object value to a given form's field. In fact, the object representation
274 * Before setting the new value to the field we will check if the form is of type submit. If
275 * the form isn't of type submit means that it's not possible to complete the form and an
278 * @param field the form field that was completed.
281 * @throws IllegalStateException if the form is not of type "submit".
285 throw new IllegalStateException("Cannot set an answer if the form is not of type " +
293 * Sets a new values to a given form's field. The field whose variable matches the requested
302 * @throws IllegalStateException if the form is not of type "submit".
303 * @throws IllegalArgumentException if the form does not include the specified variable.
307 throw new IllegalStateException("Cannot set an answer if the form is not of type " +
331 * Sets the default value as the value of a given form's field. The field whose variable matches
336 * @throws IllegalStateException if the form is not of type "submit".
337 * @throws IllegalArgumentException if the form does not include the specified variable.
341 throw new IllegalStateException("Cannot set an answer if the form is not of type " +
359 * Returns an Iterator for the fields that are part of the form.
361 * @return an Iterator for the fields that are part of the form.
368 * Returns the field of the form whose variable matches the specified variable.
372 * @param variable the variable to look for in the form fields.
373 * @return the field of the form whose variable matches the specified variable.
391 * Returns the instructions that explain how to fill out the form and what the form is about.
393 * @return instructions that explain how to fill out the form.
411 * window. You can put a <title/> on either a form to fill out, or a set of data results.
421 * Returns the meaning of the data within the context. The data could be part of a form
422 * to fill out, a form submission or data results.<p>
424 * Possible form types are:
426 * <li>form -> Indicates a form to fill out.</li>
427 * <li>submit -> The form is filled out, and this is the data that is being returned from
428 * the form.</li>
429 * <li>cancel -> The form was cancelled. Tell the asker that piece of information.</li>
433 * @return the form's type.
441 * Sets instructions that explain how to fill out the form and what the form is about.
443 * @param instructions instructions that explain how to fill out the form.
460 * You can put a <title/> on either a form to fill out, or a set of data results.
469 * Returns a DataForm that serves to send this Form to the server. If the form is of type
471 * exist to assist the user while editing/completing the form in a UI.
491 * Returns true if the form is a form to fill out.
493 * @return if the form is a form to fill out.
500 * Returns true if the form is a form to submit.
502 * @return if the form is a form to submit.
509 * Returns a new Form to submit the completed values. The new Form will include all the fields
510 * of the original form except for the fields of type FIXED. Only the HIDDEN fields will
511 * include the same value of the original form. The other fields of the new form MUST be
512 * completed. If a field remains with no answer when sending the completed form, then it won't
513 * be included as part of the completed form.<p>
515 * The reason why the fields with variables are included in the new form is to provide a model
516 * for binding with any UI. This means that the UIs will use the original form (of type
517 * "form") to learn how to render the form, but the UIs will bind the fields to the form of
520 * @return a Form to submit the completed values.
522 public Form createAnswerForm() {
524 throw new IllegalStateException("Only forms of type \"form\" could be answered");
526 // Create a new Form
527 Form form = new Form(TYPE_SUBMIT);
530 // Add to the new form any type of field that includes a variable.
535 form.addField(newField);
544 form.setAnswer(field.getVariable(), values);
548 return form;