Package org.jivesoftware.smackx

Examples of org.jivesoftware.smackx.FormField


    return (formField.getValues().hasNext()) ? formField.getValues().next() : null;
  }

  private Iterator<String> getFieldValues(ConfigureNodeFields field)
  {
    FormField formField = getField(field.getFieldName());
   
    return formField.getValues();
  }
View Full Code Here


  {
    String fieldName = nodeField.getFieldName();
   
    if (getField(fieldName) == null)
    {
      FormField field = new FormField(fieldName);
      field.setType(type);
      addField(field);
    }
  }
View Full Code Here

    boolean isLeafNode = true;
   
    if (config != null)
    {
      request.addExtension(new FormNode(FormNodeType.CONFIGURE, config));
      FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName());
     
      if (nodeTypeField != null)
        isLeafNode = nodeTypeField.getValues().next().equals(NodeType.leaf.toString());
    }

    // Errors will cause exceptions in getReply, so it only returns
    // on success.
    sendPubsubPacket(con, to, Type.SET, request);
View Full Code Here

        public String toXML() {
            StringBuilder buf = new StringBuilder();
            buf.append("<item>");
            // Loop through all the form items and append them to the string buffer
            for (Iterator<FormField> i = getFields(); i.hasNext();) {
                FormField field = i.next();
                buf.append(field.toXML());
            }
            buf.append("</item>");
            return buf.toString();
        }
View Full Code Here

        for (Iterator<PacketExtension> i = info.getExtensions().iterator(); i.hasNext();) {
            PacketExtension pe = i.next();
            if (pe.getNamespace().equals(Form.NAMESPACE)) {
                DataForm df = (DataForm) pe;
                for (Iterator<FormField> it = df.getFields(); it.hasNext();) {
                    FormField f = it.next();
                    if (f.getVariable().equals("FORM_TYPE")) {
                        for (FormField fft : foundFormTypes) {
                            if (f.equals(fft))
                                return true;
                        }
                        foundFormTypes.add(f);
                    }
                }
View Full Code Here

                    public int compare(FormField f1, FormField f2) {
                        return f1.getVariable().compareTo(f2.getVariable());
                    }
                });

                FormField ft = null;

                for (Iterator<FormField> i = extendedInfo.getFields(); i.hasNext();) {
                    FormField f = i.next();
                    if (!f.getVariable().equals("FORM_TYPE")) {
                        fs.add(f);
                    } else {
                        ft = f;
                    }
                }

                // Add FORM_TYPE values
                if (ft != null) {
                    formFieldValuesToCaps(ft.getValues(), sb);
                }

                // 7. 3. For each field other than FORM_TYPE:
                // 1. Append the value of the "var" attribute, followed by the
                // '<' character.
                // 2. Sort values by the XML character data of the <value/>
                // element.
                // 3. For each <value/> element, append the XML character data,
                // followed by the '<' character.
                for (FormField f : fs) {
                    sb.append(f.getVariable());
                    sb.append("<");
                    formFieldValuesToCaps(f.getValues(), sb);
                }
            }
        }
        // 8. Ensure that S is encoded according to the UTF-8 encoding (RFC
        // 3269).
View Full Code Here

            Item item = i.next();
            buf.append(item.toXML());
        }
        // Loop through all the form fields and append them to the string buffer
        for (Iterator<FormField> i = getFields(); i.hasNext();) {
            FormField field = i.next();
            buf.append(field.toXML());
        }
        buf.append("</").append(getElementName()).append(">");
        return buf.toString();
    }
View Full Code Here

        public String toXML() {
            StringBuilder buf = new StringBuilder();
            buf.append("<reported>");
            // Loop through all the form items and append them to the string buffer
            for (Iterator<FormField> i = getFields(); i.hasNext();) {
                FormField field = i.next();
                buf.append(field.toXML());
            }
            buf.append("</reported>");
            return buf.toString();
        }
View Full Code Here

        this.passwordProtected = info.containsFeature("muc_passwordprotected");
        this.persistent = info.containsFeature("muc_persistent");
        // Get the information based on the discovered extended information
        Form form = Form.getFormFrom(info);
        if (form != null) {
            FormField descField = form.getField("muc#roominfo_description");
            this.description = ( descField == null || !(descField.getValues().hasNext()) )? "" : descField.getValues().next();

            FormField subjField = form.getField("muc#roominfo_subject");
            this.subject = ( subjField == null || !(subjField.getValues().hasNext()) ) ? "" : subjField.getValues().next();

            FormField occCountField = form.getField("muc#roominfo_occupants");
            this.occupantsCount = occCountField == null ? -1 : Integer.parseInt(occCountField.getValues()
                    .next());
        }
    }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.FormField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.