Package com.claymus.gwt.form.fields

Source Code of com.claymus.gwt.form.fields.TextAreaFormField

package com.claymus.gwt.form.fields;

import com.claymus.gwt.form.FormField;
import com.google.gwt.user.client.ui.TextArea;

public class TextAreaFormField extends FormField<String> {

  /*
   * Constructors
   */

  public TextAreaFormField(String label, boolean required, String helpText, String... regex) {
    super(label, new TextArea(), required, helpText, regex);
    addStyleName("claymus-gwt-FormField-TextArea");
  }

  /*
   * Helper Methods
   */

  public String getText() {
    String text = ((TextArea) this.widget).getText().trim();
    return text.length() == 0 ? null : text;
  }

  public void setText(String text) {
    ((TextArea) this.widget).setText(text == null ? "" : text);
  }

  /*
   * Inherited Methods
   */

  @Override
  protected String getData() {
    return getText();
  }

  @Override
  protected void setData(String data) {
    setText(data);
  }

}
TOP

Related Classes of com.claymus.gwt.form.fields.TextAreaFormField

TOP
Copyright © 2018 www.massapi.com. 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.