Exemplo n.º 1
0
  /**
   * Generates a text box for the given setting suitable for adding to an existing form.
   *
   * @param value The current value of the option. It is displayed in the text box.
   * @param fullName The full name of the option, used to name the text field.
   * @param o The option, used to add the short description as an "alt" attribute.
   * @param disabled Whether the text box should be disabled.
   * @return An input of type "text" and class "config" containing the current value of the option.
   */
  public static HTMLNode addTextBox(String value, String fullName, Option<?> o, boolean disabled) {
    HTMLNode result;

    if (disabled) {
      result =
          new HTMLNode(
              "input",
              new String[] {"type", "class", "disabled", "alt", "name", "value"}, //
              new String[] {"text", "config", "disabled", o.getShortDesc(), fullName, value});
    } else {
      result =
          new HTMLNode(
              "input",
              new String[] {"type", "class", "alt", "name", "value"}, //
              new String[] {"text", "config", o.getShortDesc(), fullName, value});
    }

    return result;
  }