Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1283 → Rev 1284

/trunk/src/org/tela_botanica/client/vues/personne/PersonneForm.java
30,7 → 30,6
import org.tela_botanica.client.modeles.publication.Publication;
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
import org.tela_botanica.client.modeles.publication.PublicationListe;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.Pattern;
import org.tela_botanica.client.util.UtilString;
import org.tela_botanica.client.vues.Formulaire;
64,7 → 63,6
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.LabelField;
import com.extjs.gxt.ui.client.widget.form.Radio;
238,7 → 236,7
cbProjets.setAllowBlank(false);
cbProjets.addStyleName(ComposantClass.OBLIGATOIRE);
cbProjets.addListener(Events.Valid, creerEcouteurChampObligatoire());
fsProjet.add(cbProjets, new FormData(450, 0));
fsProjet.add(cbProjets, new FormData(250, 0));
hmIdentite.put("cbProjets", cbProjets);
336,14 → 334,12
formLayout.setLabelAlign(LabelAlign.TOP);
LayoutContainer containerNaissance = new LayoutContainer(formLayout);
DateField dfDateNaissance = new DateField();
dfDateNaissance.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
dfDateNaissance.setFieldLabel("Date de naissance");
dfDateNaissance.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
//Remplacement du DateField par un champ texte
TextField tfDateNaissance = new TextField();
tfDateNaissance.setFieldLabel("Date de naissance");
containerNaissance.add(tfDateNaissance);
hmIdentite.put("tfDateNaissance", tfDateNaissance);
containerNaissance.add(dfDateNaissance);
hmIdentite.put("dfDateNaissance", dfDateNaissance);
// Lieu naissance
TextField<String> tfLieuNaissance = new TextField<String>();
tfLieuNaissance.setFieldLabel("Lieu de naissance");
370,12 → 366,12
public void handleEvent(ComponentEvent be) {
if(((Radio) be.getComponent()).getValue().equals(true)) {
hmIdentite.getDateField("dfDateDeces").setVisible(true);
hmIdentite.getTextField("tfDateDeces").setVisible(true);
hmIdentite.getTextField("tfLieuDeces").setVisible(true);
} else {
DateField dfDateDeces = hmIdentite.getDateField("dfDateDeces");
dfDateDeces.setValue(null);
dfDateDeces.setVisible(false);
TextField tfDateDeces = hmIdentite.getTextField("tfDateDeces");
tfDateDeces.setValue(null);
tfDateDeces.setVisible(false);
TextField tfLieuDeces = hmIdentite.getTextField("tfLieuDeces");
tfLieuDeces.setValue(null);
384,15 → 380,12
}
});
DateField dfDateDeces = new DateField();
dfDateDeces.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
dfDateDeces.setFormatValue(true);
dfDateDeces.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
dfDateDeces.setFieldLabel("Date de décès");
dfDateDeces.setVisible(false);
TextField tfDateDeces = new TextField();
tfDateDeces.setFieldLabel("Date de décès");
tfDateDeces.setVisible(false);
 
containerDeces.add(dfDateDeces);
hmIdentite.put("dfDateDeces", dfDateDeces);
containerDeces.add(tfDateDeces);
hmIdentite.put("tfDateDeces", tfDateDeces);
 
TextField<String> tfLieuDeces = new TextField<String>();
tfLieuDeces.setFieldLabel("Lieu de décès");
1004,12 → 997,12
hmIdentite.getTextField("tfAbreviation").setValue(personne.get("abreviation"));
hmIdentite.getChampMultiValeurs("abreviationAutre").peupler(personne.getString("truk_abreviation_autre"));
hmIdentite.getDateField("dfDateNaissance").setValue(personne.getDate("naissance_date"));
hmIdentite.getTextField("tfDateNaissance").setValue(personne.getAnneeOuDateNaiss());
hmIdentite.getTextField("tfLieuNaissance").setValue(personne.get("naissance_lieu"));
if (personne.estDecedee()) {
hmIdentite.getDateField("dfDateDeces").setValue(personne.getDate("deces_date"));
hmIdentite.getTextField("tfDateDeces").setValue(personne.getAnneeOuDateDeces());
hmIdentite.getTextField("tfLieuDeces").setValue(personne.get("deces_lieu"));
Radio rbEstDecede = hmIdentite.getRadio("rbEstDecedee");
rbEstDecede.setValue(true);
1064,7 → 1057,6
if ((strRegion!=null)&&(!strRegion.equals(""))) {
ComboBox<Valeur> cbRegion = hmAdresse.getComboBoxValeur("cbRegion");
System.out.println(cbRegion.getStore().getCount());
cbRegion.setVisible(true);
if (cbRegion.getStore().findModel("id_valeur", strRegion) != null) {
1235,15 → 1227,39
personneSelectionnee.setFmtNomComplet(strPrefixe, strSuffixe);
DateField dfDateNaissance = hmIdentite.getDateField("dfDateNaissance");
Date naissanceDate = dfDateNaissance.getValue();
personneSelectionnee.setNaissanceDate(naissanceDate);
//Verifier que la date est soit JJ/MM/AAAA soit AAAA
String valeurDateNaissance = (String) hmIdentite.getTextField("tfDateNaissance").getValue();
if (!UtilString.isEmpty(valeurDateNaissance)) {
if (valeurDateNaissance.matches("\\d{2}/\\d{2}/\\d{4}")) {
Date naissanceDate = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDateNaissance);
personneSelectionnee.setNaissanceDate(naissanceDate);
} else if (valeurDateNaissance.matches("\\d{4}")) {
personneSelectionnee.set("naissance_date", valeurDateNaissance + "-00-00");
} else {
lstMessageErreur.add("La date de naissance n'est pas au format jj/mm/AAAA ou AAAA.");
}
}
Radio rbEstDecedee = hmIdentite.getRadio("rbEstDecedee");
if (rbEstDecedee.getValue() == true) {
DateField dfDecesDate = hmIdentite.getDateField("dfDateDeces");
String decesLieu = (String) hmIdentite.getTextField("tfLieuDeces").getValue();
personneSelectionnee.setDeces(dfDecesDate.getValue(), decesLieu);
//Verifier que la date est soit JJ/MM/AAAA soit AAAA
Date dateDeces = null;
String valeurDateDeces = (String) hmIdentite.getTextField("tfDateDeces").getValue();
if (!UtilString.isEmpty(valeurDateDeces)) {
if (valeurDateDeces.matches("\\d{2}/\\d{2}/\\d{4}")) {
dateDeces = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDateDeces);
personneSelectionnee.setDeces(dateDeces, decesLieu);
} else if (valeurDateDeces.matches("\\d{4}")) {
personneSelectionnee.set("deces_date", valeurDateDeces + "-00-00");
personneSelectionnee.setDecesLieu(decesLieu);
} else {
lstMessageErreur.add("La date de deces n'est pas au format jj/mm/AAAA ou AAAA.");
}
}
} else {
personneSelectionnee.setNonDecedee();
}