Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 979 → Rev 980

/trunk/src/org/tela_botanica/client/vues/Formulaire.java
3,8 → 3,10
import java.util.Iterator;
import java.util.List;
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.configuration.Configuration;
import org.tela_botanica.client.i18n.Constantes;
import org.tela_botanica.client.images.Images;
37,6 → 39,8
import com.extjs.gxt.ui.client.widget.form.Radio;
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
import com.extjs.gxt.ui.client.widget.form.SliderField;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
294,4 → 298,34
combo.setStore(store);
}
}
public static Listener<BaseEvent> creerEcouteurChampObligatoire() {
return new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
Field<?> champ = null;
boolean etreVide = true;
if (be.getSource() instanceof TextField<?>) {
champ = (TextField<?>) be.getSource();
etreVide = (champ.getRawValue().isEmpty()) ? true : false;
} else if (be.getSource() instanceof TextArea) {
champ = (TextArea) be.getSource();
etreVide = (champ.getRawValue().isEmpty()) ? true : false;
} else if (be.getSource() instanceof ChampComboBoxListeValeurs) {
champ = (ChampComboBoxListeValeurs) be.getSource();
etreVide = (champ.getValue() == null) ? true : false;
} else if (be.getSource() instanceof ComboBox<?>) {
champ = (ComboBox<?>) be.getSource();
etreVide = (champ.getValue() == null) ? true : false;
}
champ.removeStyleName(ComposantClass.OBLIGATOIRE);
champ.removeStyleName(ComposantClass.OBLIGATOIRE_OK);
if (etreVide == false) {
champ.addStyleName(ComposantClass.OBLIGATOIRE_OK);
} else {
champ.addStyleName(ComposantClass.OBLIGATOIRE);
}
}
};
}
}