/** * {@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; }
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()); }
/** * {@inheritDoc} * * @see SubmittableElement#getDefaultValue() */ public String getDefaultValue() { initDefaultValue(); return defaultValue_; }
/** * {@inheritDoc} * * @see SubmittableElement#reset() */ public void reset() { initDefaultValue(); setText(defaultValue_); }
/** * 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); }