Package org.xmpp.forms

Examples of org.xmpp.forms.DataForm


                                    // <prompt>xxx</prompt>
            }
          } else if(element.getNamespaceURI().equals("jabber:iq:register")) {
            Map<String, Object> registration = getRegistration(iq.getFrom());
            if(iq.getType() == IQ.Type.get) {
              DataForm form = new DataForm(DataForm.Type.form);
              form.setTitle("Enter Your LFS Username");
              form.addInstruction("Enter Your LFS Username");
              FormField username = form.addField();
              username.setVariable("username");
              username.setLabel("LFS Username");
              username.setType(FormField.Type.text_single);
              username.setRequired(true);
              username.setDescription("Your LFS Username");
              childResult.add(form.getElement());
              childResult.addElement("instructions").addText("Enter Your LFS Username");
              Element username_element = childResult.addElement("username");
              if(registration != null) {
                username_element.setText((String) registration.get("username"));
                username.addValue(registration.get("username"));
              }
            } else if(iq.getType() == IQ.Type.set) {
              String username = null;
              DataForm form = (DataForm)iq.getExtension(DataForm.ELEMENT_NAME,DataForm.NAMESPACE);
              if(form != null) {
                List<FormField> fields = form.getFields();
                for(FormField field : fields) {
                  if(!field.getVariable().equals("username")) continue;
                  List<String> vals = field.getValues();
                  if(vals != null && vals.size() > 0)
                    username = vals.get(0);
View Full Code Here


        note.setText("Operation finished successfully");
    }

    @Override
  protected void addStageInformation(SessionData data, Element command) {
        DataForm form = new DataForm(DataForm.Type.form);
        form.setTitle("Adding a user");
        form.addInstruction("Fill out this form to add a user.");

        FormField field = form.addField();
        field.setType(FormField.Type.hidden);
        field.setVariable("FORM_TYPE");
        field.addValue("http://jabber.org/protocol/admin");

        field = form.addField();
        field.setType(FormField.Type.jid_single);
        field.setLabel("The Jabber ID for the account to be added");
        field.setVariable("accountjid");
        field.setRequired(true);

        field = form.addField();
        field.setType(FormField.Type.text_private);
        field.setLabel("The password for this account");
        field.setVariable("password");

        field = form.addField();
        field.setType(FormField.Type.text_private);
        field.setLabel("Retype password");
        field.setVariable("password-verify");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("Email address");
        field.setVariable("email");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("Given name");
        field.setVariable("given_name");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("Family name");
        field.setVariable("surname");

        // Add the form to the command
        command.add(form.getElement());
    }
View Full Code Here

        note.setText("Operation finished successfully");
    }

    @Override
  protected void addStageInformation(SessionData data, Element command) {
        DataForm form = new DataForm(DataForm.Type.form);
        form.setTitle("Dispatching a user updated event.");
        form.addInstruction("Fill out this form to dispatch a user updated event.");

        FormField field = form.addField();
        field.setType(FormField.Type.hidden);
        field.setVariable("FORM_TYPE");
        field.addValue("http://jabber.org/protocol/admin");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("The username of the user that was updated");
        field.setVariable("username");
        field.setRequired(true);

        field.setType(FormField.Type.list_single);
        field.setLabel("Change type");
        field.setVariable("changeType");
        field.addOption("Name modified", "nameModified");
        field.addOption("Email modified", "emailModified");
        field.addOption("Password modified", "passwordModified");
        field.addOption("Creation date modified", "creationDateModified");
        field.addOption("Modification date modified", "modificationDateModified");
        field.addOption("Property modified", "propertyModified");
        field.addOption("Property added", "propertyAdded");
        field.addOption("Property deleted", "propertyDeleted");
        field.addOption("Other", "other");
        field.setRequired(true);

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("Original value");
        field.setVariable("originalValue");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("Name of the property");
        field.setVariable("propertyKey");

        // Add the form to the command
        command.add(form.getElement());
    }
View Full Code Here

        note.setText("Operation finished successfully");
    }

    @Override
  protected void addStageInformation(SessionData data, Element command) {
        DataForm form = new DataForm(DataForm.Type.form);
        form.setTitle("Dispatching a group member added event.");
        form.addInstruction("Fill out this form to dispatch a group member added event.");

        FormField field = form.addField();
        field.setType(FormField.Type.hidden);
        field.setVariable("FORM_TYPE");
        field.addValue("http://jabber.org/protocol/admin");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("The group name of the group");
        field.setVariable("groupName");
        field.setRequired(true);

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("Member");
        field.setVariable("member");
        field.setRequired(true);

        // Add the form to the command
        command.add(form.getElement());
    }
View Full Code Here

    public DataForm getExtendedInfo(String name, String node, JID senderJID) {
        // Mark that offline messages shouldn't be sent when the user becomes available
        stopOfflineFlooding(senderJID);

        final DataForm dataForm = new DataForm(DataForm.Type.result);

        final FormField field1 = dataForm.addField();
        field1.setVariable("FORM_TYPE");
        field1.setType(FormField.Type.hidden);
        field1.addValue(NAMESPACE);

        final FormField field2 = dataForm.addField();
        field2.setVariable("number_of_messages");
        field2.addValue(String.valueOf(messageStore.getMessages(senderJID.getNode(), false).size()));

        return dataForm;
    }
View Full Code Here

        note.setText("Operation finished successfully");
    }

    @Override
  protected void addStageInformation(SessionData data, Element command) {
        DataForm form = new DataForm(DataForm.Type.form);
        form.setTitle("Dispatching a deleting group event.");
        form.addInstruction("Fill out this form to dispatch a deleting group event.");

        FormField field = form.addField();
        field.setType(FormField.Type.hidden);
        field.setVariable("FORM_TYPE");
        field.addValue("http://jabber.org/protocol/admin");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("The group name of the group that is being deleted");
        field.setVariable("groupName");
        field.setRequired(true);

        // Add the form to the command
        command.add(form.getElement());
    }
View Full Code Here

        note.setText("Operation finished successfully");
    }

    @Override
  protected void addStageInformation(SessionData data, Element command) {
        DataForm form = new DataForm(DataForm.Type.form);
        form.setTitle("Dispatching a vCard deleting event.");
        form.addInstruction("Fill out this form to dispatch a vCard deleting event.");

        FormField field = form.addField();
        field.setType(FormField.Type.hidden);
        field.setVariable("FORM_TYPE");
        field.addValue("http://jabber.org/protocol/admin");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("The username of the user who's vCard is being deleted");
        field.setVariable("username");
        field.setRequired(true);

        // Add the form to the command
        command.add(form.getElement());
    }
View Full Code Here

        note.setText("Operation finished successfully");
    }

    @Override
  protected void addStageInformation(SessionData data, Element command) {
        DataForm form = new DataForm(DataForm.Type.form);
        form.setTitle("Dispatching a user deleting event.");
        form.addInstruction("Fill out this form to dispatch a user deleting event.");

        FormField field = form.addField();
        field.setType(FormField.Type.hidden);
        field.setVariable("FORM_TYPE");
        field.addValue("http://jabber.org/protocol/admin");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("The username of the user that is being deleted");
        field.setVariable("username");
        field.setRequired(true);

        // Add the form to the command
        command.add(form.getElement());
    }
View Full Code Here

        note.setText("Operation finished successfully.");
    }

    @Override
  protected void addStageInformation(SessionData data, Element command) {
        DataForm form = new DataForm(DataForm.Type.form);
        form.setTitle("Authenticating a user");
        form.addInstruction("Fill out this form to authenticate a user.");

        FormField field = form.addField();
        field.setType(FormField.Type.hidden);
        field.setVariable("FORM_TYPE");
        field.addValue("http://jabber.org/protocol/admin");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("The username for this account");
        field.setVariable("accountjid");
        field.setRequired(true);

        field = form.addField();
        field.setType(FormField.Type.text_private);
        field.setLabel("The password for this account");
        field.setVariable("password");
        field.setRequired(true);

        // Add the form to the command
        command.add(form.getElement());
    }
View Full Code Here

        note.setText("Operation finished successfully");
    }

    @Override
  protected void addStageInformation(SessionData data, Element command) {
        DataForm form = new DataForm(DataForm.Type.form);
        form.setTitle("Dispatching a user created event.");
        form.addInstruction("Fill out this form to dispatch a user created event.");

        FormField field = form.addField();
        field.setType(FormField.Type.hidden);
        field.setVariable("FORM_TYPE");
        field.addValue("http://jabber.org/protocol/admin");

        field = form.addField();
        field.setType(FormField.Type.text_single);
        field.setLabel("The username of the user that was created");
        field.setVariable("username");
        field.setRequired(true);

        // Add the form to the command
        command.add(form.getElement());
    }
View Full Code Here

TOP

Related Classes of org.xmpp.forms.DataForm

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.