Subversion Repositories eFlore/Applications.del

Rev

Rev 109 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.del.client.composants.validation;

import org.tela_botanica.del.client.i18n.I18n;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.TextBox;


public class DoubleFormValidator extends AbstractTextFieldValidator {

        public DoubleFormValidator(TextBox textBox, HTML sideHTML) {
                super(textBox, sideHTML);
        }

        @Override
        public boolean validate() {
                try {
                        Double.parseDouble(getTextBox().getText());
                        getSideHTML().setHTML("");
                        return true;
                } catch (Exception e) {
                        getSideHTML().setHTML("<font color='red'>" + I18n.getVocabulary().valeurNonNumerique() + "</font>");
                        return false;
                }
        }

}