Subversion Repositories eFlore/Applications.del

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
101 benjamin 1
package org.tela_botanica.del.client.composants.validation;
2
 
3
import org.tela_botanica.del.client.i18n.I18n;
4
 
5
import com.google.gwt.user.client.ui.HTML;
6
import com.google.gwt.user.client.ui.TextBox;
7
 
8
 
9
public class DoubleFormValidator extends AbstractTextFieldValidator {
10
 
11
	public DoubleFormValidator(TextBox textBox, HTML sideHTML) {
12
		super(textBox, sideHTML);
13
	}
14
 
15
	@Override
16
	public boolean validate() {
17
		try {
18
			Double.parseDouble(getTextBox().getText());
19
			getSideHTML().setHTML("");
20
			return true;
21
		} catch (Exception e) {
22
			getSideHTML().setHTML("<font color='red'>" + I18n.getVocabulary().valeurNonNumerique() + "</font>");
23
			return false;
24
		}
25
	}
26
 
27
}