Subversion Repositories eFlore/Applications.del

Rev

Rev 228 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 228 Rev 305
1
package org.tela_botanica.del.client.composants.validation;
1
package org.tela_botanica.del.client.composants.validation;
2
 
2
 
3
import org.tela_botanica.del.client.i18n.I18n;
3
import org.tela_botanica.del.client.i18n.I18n;
4
 
4
 
5
import com.google.gwt.user.client.ui.HTML;
5
import com.google.gwt.user.client.ui.HTML;
6
import com.google.gwt.user.client.ui.TextBox;
6
import com.google.gwt.user.client.ui.TextBox;
7
 
7
 
8
public class ValidateurChampNCaracteres extends ValidateurChampTexteAbstrait {
8
public class ValidateurChampNCaracteres extends ValidateurChampTexteAbstrait {
9
 
9
 
10
	private int nbCaracteres = 0;
10
	private int nbCaracteres = 0;
11
	
11
	
12
	public ValidateurChampNCaracteres(TextBox textBox) {
12
	public ValidateurChampNCaracteres(TextBox textBox) {
13
		super(textBox);
13
		super(textBox);
14
		// TODO Auto-generated constructor stub
14
		// TODO Auto-generated constructor stub
15
	}
15
	}
16
	
16
	
17
	public void setNbCaracteres(int nbCaracteresMax) {
17
	public void setNbCaracteres(int nbCaracteresMax) {
18
		nbCaracteres = nbCaracteresMax;
18
		nbCaracteres = nbCaracteresMax;
19
	}
19
	}
20
 
20
 
21
	@Override
21
	@Override
22
	public boolean valider() {
22
	public boolean valider() {
23
		if(getTextBox().getText().length()>=nbCaracteres){
23
		if(getTextBox().getText().length()>=nbCaracteres){
24
			getTextBox().removeStyleName(getStyleErreur());
24
			supprimerStyleErreur(getStyleErreur());
25
			return true;
25
			return true;
26
		} else {
26
		} else {
27
			getTextBox().addStyleName(getStyleErreur());
27
			afficherStyleErreur(getStyleErreur());
28
			return false;
28
			return false;
29
		}
29
		}
30
	}
30
	}
31
 
31
 
32
}
32
}