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
public class FloatFormValidator extends AbstractTextFieldValidator {
9
 
10
	public FloatFormValidator(TextBox textBox, HTML sideHTML) {
11
		super(textBox, sideHTML);
12
	}
13
 
14
	@Override
15
	public boolean validate() {
16
		try {
17
			Float.parseFloat(getTextBox().getText());
18
			getSideHTML().setHTML("");
19
			return true;
20
		} catch (Exception e) {
21
			getSideHTML().setHTML("<font color='red'>" + I18n.getVocabulary().valeurNonNumerique() + "</font>");
22
			return false;
23
		}
24
	}
25
 
26
}