congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Form.setAnswer
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: igniterealtime/Smack

/**
 * Set if the room is members only. Rooms are not members only per default.
 *
 * @param isMembersOnly if the room should be members only.
 * @return a reference to this object.
 * @throws MucConfigurationNotSupportedException
 */
public MucConfigFormManager setMembersOnly(boolean isMembersOnly) throws MucConfigurationNotSupportedException {
  if (!supportsMembersOnly()) {
    throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_MEMBERSONLY);
  }
  answerForm.setAnswer(MUC_ROOMCONFIG_MEMBERSONLY, isMembersOnly);
  return this;
}
origin: igniterealtime/Smack

/**
 * Sets a new boolean value to a given form's field. The field whose variable matches the
 * requested variable will be completed with the specified value. If no field could be found
 * for the specified variable then an exception will be raised.
 *
 * @param variable the variable name that was completed.
 * @param value the boolean value that was answered.
 * @throws IllegalStateException if the form is not of type "submit".
 * @throws IllegalArgumentException if the form does not include the specified variable or
 *      if the answer type does not correspond with the field type.
 */
public void setAnswer(String variable, boolean value) {
  FormField field = getField(variable);
  if (field == null) {
    throw new IllegalArgumentException("Field not found for the specified variable name.");
  }
  if (field.getType() != FormField.Type.bool) {
    throw new IllegalArgumentException("This field is not of type boolean.");
  }
  setAnswer(field, Boolean.toString(value));
}
origin: igniterealtime/Smack

/**
 * Sets a new int value to a given form's field. The field whose variable matches the
 * requested variable will be completed with the specified value. If no field could be found
 * for the specified variable then an exception will be raised.
 *
 * @param variable the variable name that was completed.
 * @param value the int value that was answered.
 * @throws IllegalStateException if the form is not of type "submit".
 * @throws IllegalArgumentException if the form does not include the specified variable or
 *      if the answer type does not correspond with the field type.
 */
public void setAnswer(String variable, int value) {
  FormField field = getField(variable);
  if (field == null) {
    throw new IllegalArgumentException("Field not found for the specified variable name.");
  }
  validateThatFieldIsText(field);
  setAnswer(field, value);
}
origin: igniterealtime/Smack

/**
 * Sets a new long value to a given form's field. The field whose variable matches the
 * requested variable will be completed with the specified value. If no field could be found
 * for the specified variable then an exception will be raised.
 *
 * @param variable the variable name that was completed.
 * @param value the long value that was answered.
 * @throws IllegalStateException if the form is not of type "submit".
 * @throws IllegalArgumentException if the form does not include the specified variable or
 *      if the answer type does not correspond with the field type.
 */
public void setAnswer(String variable, long value) {
  FormField field = getField(variable);
  if (field == null) {
    throw new IllegalArgumentException("Field not found for the specified variable name.");
  }
  validateThatFieldIsText(field);
  setAnswer(field, value);
}
origin: igniterealtime/Smack

  /**
   * Submit the configuration as {@link Form} to the room.
   *
   * @throws NoResponseException if there was no response from the room.
   * @throws XMPPErrorException
   * @throws NotConnectedException
   * @throws InterruptedException
   */
  public void submitConfigurationForm() throws NoResponseException, XMPPErrorException, NotConnectedException,
          InterruptedException {
    if (owners != null) {
      answerForm.setAnswer(MUC_ROOMCONFIG_ROOMOWNERS, JidUtil.toStringList(owners));
    }
    multiUserChat.sendConfigurationForm(answerForm);
  }
}
origin: igniterealtime/Smack

/**
 * Sets a new float value to a given form's field. The field whose variable matches the
 * requested variable will be completed with the specified value. If no field could be found
 * for the specified variable then an exception will be raised.
 *
 * @param variable the variable name that was completed.
 * @param value the float value that was answered.
 * @throws IllegalStateException if the form is not of type "submit".
 * @throws IllegalArgumentException if the form does not include the specified variable or
 *      if the answer type does not correspond with the field type.
 */
public void setAnswer(String variable, float value) {
  FormField field = getField(variable);
  if (field == null) {
    throw new IllegalArgumentException("Field not found for the specified variable name.");
  }
  validateThatFieldIsText(field);
  setAnswer(field, value);
}
origin: igniterealtime/Smack

/**
 * Sets a new double value to a given form's field. The field whose variable matches the
 * requested variable will be completed with the specified value. If no field could be found
 * for the specified variable then an exception will be raised.
 *
 * @param variable the variable name that was completed.
 * @param value the double value that was answered.
 * @throws IllegalStateException if the form is not of type "submit".
 * @throws IllegalArgumentException if the form does not include the specified variable or
 *      if the answer type does not correspond with the field type.
 */
public void setAnswer(String variable, double value) {
  FormField field = getField(variable);
  if (field == null) {
    throw new IllegalArgumentException("Field not found for the specified variable name.");
  }
  validateThatFieldIsText(field);
  setAnswer(field, value);
}
origin: igniterealtime/Smack

/**
 * Set if this room is password protected. Rooms are by default not password protected.
 *
 * @param isPasswordProtected
 * @return a reference to this object.
 * @throws MucConfigurationNotSupportedException
 */
public MucConfigFormManager setIsPasswordProtected(boolean isPasswordProtected)
        throws MucConfigurationNotSupportedException {
  if (!supportsMembersOnly()) {
    throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM);
  }
  answerForm.setAnswer(MUC_ROOMCONFIG_PASSWORDPROTECTEDROOM, isPasswordProtected);
  return this;
}
origin: igniterealtime/Smack

/**
 * Set the room secret, aka the room password. If set and enabled, the password is required to
 * join the room. Note that this does only set it by does not enable password protection. Use
 * {@link #setAndEnablePassword(String)} to set a password and make the room protected.
 *
 * @param secret the secret/password.
 * @return a reference to this object.
 * @throws MucConfigurationNotSupportedException
 */
public MucConfigFormManager setRoomSecret(String secret)
        throws MucConfigurationNotSupportedException {
  if (!answerForm.hasField(MUC_ROOMCONFIG_ROOMSECRET)) {
    throw new MucConfigurationNotSupportedException(MUC_ROOMCONFIG_ROOMSECRET);
  }
  answerForm.setAnswer(MUC_ROOMCONFIG_ROOMSECRET, secret);
  return this;
}
origin: igniterealtime/Smack

  throw new IllegalArgumentException("This field is not of type String.");
setAnswer(field, value);
origin: igniterealtime/Smack

field.setType(FormField.Type.text_single);
form.addField(field);
form.setAnswer(name, value);
origin: igniterealtime/Smack

form.setAnswer(field.getVariable(), values);
origin: igniterealtime/Smack

  completedForm.setAnswer("name", true);
  fail("A boolean value was set to a field of type String");
completedForm.setAnswer("name", "Credit card number invalid");
completedForm.setAnswer(
  "description",
  "The ATM says that my credit card number is invalid. What's going on?");
completedForm.setAnswer("time", true);
completedForm.setAnswer("age", 20);
origin: stackoverflow.com

 muc.create(nickname);
Form form = muc.getConfigurationForm().createAnswerForm();
form.setAnswer("muc#roomconfig_roomowners", owners);
muc.sendConfigurationForm(form);
origin: stackoverflow.com

if( !chatRoom.isJoined() ){
   chatRoom.createOrJoin("your nickname");
   List<String> owners = new ArrayList<String>();
   owners.add("currUser@"+MYSITE);
   Form form = chatRoom.getConfigurationForm().createAnswerForm();
   form.setAnswer("muc#roomconfig_roomname", "your roomname");
   form.setAnswer("muc#roomconfig_roomowners", owners);
   form.setAnswer("muc#roomconfig_persistentroom", true);
   form.setAnswer("muc#roomconfig_publicroom", true);
   chatRoom.sendConfigurationForm(form);
 }
origin: stackoverflow.com

 erSearchManager search = new UserSearchManager(connection);
Form searchForm = search.getSearchForm("search."+connection.getServiceName());
Form answerForm = searchForm.createAnswerForm(); 
answerForm.setAnswer("Username", true);  
answerForm.setAnswer("search", name);//Here username must be added name replace by "amith"
origin: stackoverflow.com

MultiUserChat chatRoom = new MultiUserChat(connection, "room786@conference.dishaserver");
 chatRoom.create("nagarjuna");
 Form form = chatRoom.getConfigurationForm().createAnswerForm();
 form.setAnswer("muc#roomconfig_publicroom", true);
 form.setAnswer("muc#roomconfig_roomname", "room786");
 form.setAnswer("muc#roomconfig_roomowners",owners);
 form.setAnswer("muc#roomconfig_persistentroom", true);
 chatRoom.sendConfigurationForm(form);
origin: stackoverflow.com

 public Boolean checkIfUserExists(String user) throws XMPPException{
  UserSearchManager search = new UserSearchManager(xmppConnection);  
  Form searchForm = search.getSearchForm("search."+xmppConnection.getServiceName());
  Form answerForm = searchForm.createAnswerForm();  
  answerForm.setAnswer("Username", true);  
  answerForm.setAnswer("search", user);  
  ReportedData data = search.getSearchResults(answerForm,"search."+xmppConnection.getServiceName());  
  if (data.getRows() != null) {
    Iterator<Row> it = data.getRows();
    while (it.hasNext()) {
      Row row = it.next();
      Iterator iterator = row.getValues("jid");
      if (iterator.hasNext()) {
        String value = iterator.next().toString();
        System.out.println("Iteartor values...... " + value);
      }
    }
    return true;
  }
  return false;
}
origin: stackoverflow.com

 UserSearchManager usm= new UserSearchManager(xmpp.getConnection());
Form searchForm = usm.getSearchForm("search." +xmpp.getConnection().getServiceName());
Form answerForm = searchForm.createAnswerForm();
answerForm.setAnswer("Username", true);
answerForm.setAnswer("search", userName);
ReportedData data = usm
  .getSearchResults(answerForm, "search." + xmpp.getConnection().getServiceName());

if (data.getRows() != null) {
  for (ReportedData.Row row: data.getRows()) {
    for (String jid:row.getValues("jid")) {
    System.out.println(jid);
    }
  }
}
origin: igniterealtime/Spark

/**
 * Sends the Answer Form
 * @param answer <u>must be an answer-form</u>
 * @param chat
 */
private void sendAnswerForm(Form answer, MultiUserChat chat) {

ChatRoom room = SparkManager.getChatManager().getChatRoom(chat.getRoom().toString()); 

for (String key : _map.keySet()) {
  String value = getValueFromComponent(key);
  answer.setAnswer(key, value);
}
try {
  chat.sendRegistrationForm(answer);
  
  
  String reg = Res.getString("message.groupchat.registered.member", chat.getRoom());
  room.getTranscriptWindow().insertNotificationMessage(reg,ChatManager.NOTIFICATION_COLOR);
} catch (XMPPException | SmackException | InterruptedException e) {
  room.getTranscriptWindow().insertNotificationMessage(e.getMessage(),ChatManager.ERROR_COLOR);
}
}
org.jivesoftware.smackx.xdataFormsetAnswer

Javadoc

Sets a new double value to a given form's field. The field whose variable matches the requested variable will be completed with the specified value. If no field could be found for the specified variable then an exception will be raised.

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
  • <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.
  • isFormType
    Returns true if the form is a form to fill out.
  • hasField,
  • isFormType,
  • isSubmitType,
  • setInstructions,
  • setTitle,
  • validateThatFieldIsText

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • setScale (BigDecimal)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JFileChooser (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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