Пример #1
0
  /**
   * {@inheritDoc}
   *
   * @see SubmittableElement#setDefaultValue(String)
   */
  public void setDefaultValue(String defaultValue) {
    initDefaultValue();
    if (defaultValue == null) {
      defaultValue = "";
    }

    // for FF, if value is still default value, change value too
    if (hasFeature(HTMLINPUT_DEFAULT_IS_CHECKED) && getText().equals(getDefaultValue())) {
      setTextInternal(defaultValue);
    }
    defaultValue_ = defaultValue;
  }
Пример #2
0
  private void setTextInternal(final String newValue) {
    initDefaultValue();
    final DomText child = (DomText) getFirstChild();
    if (child == null) {
      final DomText newChild = new DomText(getPage(), newValue);
      appendChild(newChild);
    } else {
      child.setData(newValue);
    }

    setSelectionStart(newValue.length());
    setSelectionEnd(newValue.length());
  }
Пример #3
0
 /**
  * {@inheritDoc}
  *
  * @see SubmittableElement#getDefaultValue()
  */
 public String getDefaultValue() {
   initDefaultValue();
   return defaultValue_;
 }
Пример #4
0
 /**
  * {@inheritDoc}
  *
  * @see SubmittableElement#reset()
  */
 public void reset() {
   initDefaultValue();
   setText(defaultValue_);
 }
Пример #5
0
  /**
   * Sets the new value of this text area.
   *
   * <p>Note that this acts like 'pasting' the text, but to simulate characters entry you should use
   * {@link #type(String)}.
   *
   * @param newValue the new value
   */
  public final void setText(final String newValue) {
    initDefaultValue();
    setTextInternal(newValue);

    HtmlInput.executeOnChangeHandlerIfAppropriate(this);
  }