Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 972 → Rev 973

/trunk/src/org/tela_botanica/client/vues/personne/PersonneForm.java
14,6 → 14,7
import org.tela_botanica.client.composants.ChampMultiValeurs;
import org.tela_botanica.client.composants.ChampMultiValeursImage;
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
import org.tela_botanica.client.composants.HashMapComposants;
import org.tela_botanica.client.configuration.Configuration;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
36,6 → 37,7
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
 
import com.extjs.gxt.ui.client.binding.FieldBinding;
import com.extjs.gxt.ui.client.binding.FormBinding;
 
import com.extjs.gxt.ui.client.event.ButtonEvent;
52,6 → 54,7
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.Text;
 
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
85,7 → 88,7
private Personne personneSelectionnee, personneSauvegarde = null;
//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
private HashMapComposants hmIdentite = new HashMapComposants();
private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
302,54 → 305,56
left.add(fsNoms);
FieldSet fsNaissanceEtDeces = new FieldSet();
fsNaissanceEtDeces.setHeading("Naissance et Décès");
fsNaissanceEtDeces.setLayout(new ColumnLayout());
formLayout = new FormLayout();
formLayout.setLabelAlign(LabelAlign.LEFT);
FieldSet fsNaissance = new FieldSet();
fsNaissance.setHeading("Naissance");
fsNaissance.setLayout(formLayout);
formLayout.setLabelAlign(LabelAlign.TOP);
LayoutContainer containerNaissance = new LayoutContainer(formLayout);
DateField dfDateNaissance = new DateField();
dfDateNaissance.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
dfDateNaissance.setFieldLabel("Date");
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».");
fsNaissance.add(dfDateNaissance);
containerNaissance.add(dfDateNaissance);
hmIdentite.put("dfDateNaissance", dfDateNaissance);
// Lieu naissance
TextField<String> tfLieuNaissance = new TextField<String>();
tfLieuNaissance.setFieldLabel("Lieu");
tfLieuNaissance.setFieldLabel("Lieu de naissance");
tfLieuNaissance.setName("naissance_lieu");
fsNaissance.add(tfLieuNaissance);
containerNaissance.add(tfLieuNaissance);
hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
left.add(fsNaissance);
fsNaissanceEtDeces.add(containerNaissance, new ColumnData(.5));
left.add(fsNaissanceEtDeces);
formLayout = new FormLayout();
formLayout.setLabelAlign(LabelAlign.LEFT);
formLayout.setLabelAlign(LabelAlign.TOP);
LayoutContainer containerDeces = new LayoutContainer(formLayout);
FieldSet fsDeces = new FieldSet();
fsDeces.setHeading("Décès");
fsDeces.setLayout(formLayout);
Radio rbEstDecedee = new Radio();
rbEstDecedee.setId("ce_deces");
rbEstDecedee.setBoxLabel("oui");
rbEstDecedee.setValueAttribute("1");
rbEstDecedee.setId("rbEstD");
rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
if(((Radio) be.getComponent()).getValue().equals(true)) {
((DateField) hmIdentite.get("dfDateDeces")).setVisible(true);
((TextField) hmIdentite.get("tfLieuDeces")).setVisible(true);
hmIdentite.getDateField("dfDateDeces").setVisible(true);
hmIdentite.getTextField("tfLieuDeces").setVisible(true);
} else {
DateField dfDateDeces = ((DateField) hmIdentite.get("dfDateDeces"));
DateField dfDateDeces = hmIdentite.getDateField("dfDateDeces");
dfDateDeces.setValue(null);
dfDateDeces.setVisible(false);
TextField tfLieuDeces = ((TextField) hmIdentite.get("tfLieuDeces"));
TextField tfLieuDeces = hmIdentite.getTextField("tfLieuDeces");
tfLieuDeces.setValue(null);
tfLieuDeces.setVisible(false);
}
356,77 → 361,64
}
});
hmIdentite.put("rbEstDecedee", rbEstDecedee);
Radio rbNestPasDecedee = new Radio();
rbNestPasDecedee.setValueAttribute("0");
rbNestPasDecedee.setBoxLabel("non");
rbNestPasDecedee.setValue(true);
/* Radio rbDecesInconnu = new Radio();
rbDecesInconnu.setBoxLabel("Ne sais pas");
rbDecesInconnu.setValue(true);*/
RadioGroup rbgDeces = new RadioGroup();
rbgDeces.setFieldLabel("Est décédée");
rbgDeces.add(rbEstDecedee);
rbgDeces.add(rbNestPasDecedee);
fsDeces.add(rbgDeces);
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");
dfDateDeces.setFieldLabel("Date de décès");
dfDateDeces.setVisible(false);
 
fsDeces.add(dfDateDeces);
containerDeces.add(dfDateDeces);
hmIdentite.put("dfDateDeces", dfDateDeces);
 
TextField<String> tfLieuDeces = new TextField<String>();
tfLieuDeces.setFieldLabel("Lieu");
tfLieuDeces.setFieldLabel("Lieu de décès");
tfLieuDeces.setName("deces_lieu");
tfLieuDeces.setVisible(false);
fsDeces.add(tfLieuDeces);
containerDeces.add(tfLieuDeces);
hmIdentite.put("tfLieuDeces", tfLieuDeces);
left.add(fsDeces);
hmIdentite.put("rbEstDecedee", rbEstDecedee);
Radio rbNestPasDecedee = new Radio();
rbNestPasDecedee.setValueAttribute("0");
rbNestPasDecedee.setBoxLabel("non");
rbNestPasDecedee.setValue(true);
RadioGroup rbgDeces = new RadioGroup();
rbgDeces.setFieldLabel("Est décédée");
rbgDeces.add(rbEstDecedee);
rbgDeces.add(rbNestPasDecedee);
containerDeces.add(rbgDeces);
fsNaissanceEtDeces.add(containerDeces, new ColumnData(.5));
tiIdentite.add(main);
FieldSet fsContactTel = new FieldSet();
fsContactTel.setHeading("Contact - Téléphones");
fsContactTel.setLayout(new RowLayout());
FieldSet fsContact = new FieldSet();
fsContact.setHeading("Contact");
fsContact.setLayout(new RowLayout());
LayoutContainer containerTelEtEmail = new LayoutContainer(new ColumnLayout());
ChampMultiValeursMultiTypes telephones = new ChampMultiValeursMultiTypes("Téléphones");
ChampMultiValeursMultiTypes telephones = new ChampMultiValeursMultiTypes("Téléphones", 180, 100);
hmIdentite.put("telephones", telephones);
telephones.initialiserType("tel");
fsContactTel.add(telephones);
right.add(fsContactTel);
hmIdentite.put("fsContactTel", fsContactTel);
containerTelEtEmail.add(telephones, new ColumnData(.5));
FieldSet fsContact = new FieldSet();
fsContact.setHeading("Contact - Autres");
fsContact.setId("fsContact");
fsContact.setLayout(new RowLayout());
 
ChampMultiValeurs courriels = new ChampMultiValeurs("Courriels", 280);
courriels.setValidation(Pattern.email, "moi@domaine.fr");
containerTelEtEmail.add(courriels, new ColumnData(.5));
fsContact.add(containerTelEtEmail);
right.add(fsContact);
hmIdentite.put("fsContact", fsContact);
 
ChampMultiValeurs courriels = new ChampMultiValeurs("Courriels");
courriels.setValidation(Pattern.email, "moi@domaine.fr");
fsContact.add(courriels);
hmIdentite.put("courriels", courriels);
LayoutContainer lcCourrielContainer = new LayoutContainer(new RowLayout());
fsContact.add(lcCourrielContainer);
hmIdentite.put("lcCourrielContainer", lcCourrielContainer);
 
fsContact.add(new Text(""));
ChampMultiValeurs sites = new ChampMultiValeurs("Sites web");
sites.setValeurParDefaut("http://");
sites.setValidation(Pattern.url, "http://www.monsite.com");
452,8 → 444,10
cbSexe.setFieldLabel("Sexe");
cbSexe.setDisplayField("nom");
cbSexe.setEmptyText("Choisissez le sexe:");
lcAutreInformations1.add(cbSexe, new FormData(100, 10));
FormData fd = new FormData();
fd.setWidth(100);
lcAutreInformations1.add(cbSexe, fd);
hmIdentite.put("cbSexe", cbSexe);
mediateur.obtenirListeValeurEtRafraichir(this, "sexe");
716,7 → 710,7
remplirCombobox("cbTelephone", liste, "hmIdentite");
 
//Préselection du tél
ComboBox<Valeur> cbTelephone = (ComboBox<Valeur>) hmIdentite.get("cbTelephone");
ComboBox<Valeur> cbTelephone = hmIdentite.getComboBoxValeur("cbTelephone");
cbTelephone.setValue(liste.get(1));
} else if (listeValeurs.getId().equals(config.getListeId("pays"))) {
remplirCombobox("cbPays", liste, "hmAdresse");
728,7 → 722,7
ProjetListe projets = (ProjetListe) nouvellesDonnees;
List<Projet> liste = projets.toList();
ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
ListStore<Projet> storeProjets= cbProjets.getStore();
storeProjets.removeAll();
storeProjets.add(liste);
775,7 → 769,7
}
if (nouvellesDonnees == null) {
ComboBox cb= (ComboBox) hmIdentite.get("cbPrefixe");
ComboBox<Valeur> cb= hmIdentite.getComboBoxValeur("cbPrefixe");
//Met à jour le nom Complet du formulaire
String valeurRetour = "";
782,28 → 776,30
// Prefixe
String prefixe = "";
Valeur valPrefixe = (Valeur) ((ComboBox) hmIdentite.get("cbPrefixe")).getValue();
Valeur valPrefixe = cb.getValue();
if (valPrefixe != null) {
prefixe = valPrefixe.getNom();
} else {
prefixe = (String) ((ComboBox) hmIdentite.get("cbPrefixe")).getRawValue();
prefixe = (String) cb.getRawValue();
}
// Prénom
String prenom = (String) ((TextField) hmIdentite.get("tfPrenom")).getValue();
String prenom = (String) hmIdentite.getTextField("tfPrenom").getValue();
// Nom
String nom = (String) ((TextField) hmIdentite.get("tfNom")).getValue();
String nom = (String) hmIdentite.getTextField("tfNom").getValue();
// Suffixe
ComboBox<Valeur> cbSuffixe = hmIdentite.getComboBoxValeur("cbSuffixe");
String suffixe = "";
Valeur valSuffixe = (Valeur) ((ComboBox) hmIdentite.get("cbSuffixe")).getValue();
Valeur valSuffixe = cbSuffixe.getValue();
if (valSuffixe != null) {
suffixe = valSuffixe.getNom();
} else {
suffixe = (String) ((ComboBox) hmIdentite.get("cbSuffixe")).getRawValue();
suffixe = (String) cbSuffixe.getRawValue();
}
// Mettre à jour la valeur
810,12 → 806,12
valeurRetour = prefixe + " " + prenom + " " + nom + " " + suffixe;
valeurRetour = valeurRetour.replaceAll("null", "");
((LabelField) hmIdentite.get("nomComplet")).setValue(valeurRetour);
hmIdentite.getLabelField("nomComplet").setValue(valeurRetour);
if (!valeurRetour.trim().equals("")) {
((LabelField) hmIdentite.get("nomComplet")).show();
hmIdentite.getLabelField("nomComplet").show();
} else {
((LabelField) hmIdentite.get("nomComplet")).hide();
hmIdentite.getLabelField("nomComplet").hide();
}
}
842,12 → 838,12
//Mise à jour de la personne
//Personne personne = (Personne) nouvellesDonnees;
ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
cbProjets.setValue(cbProjets.getStore().findModel("id_projet", personne.get("ce_projet")));
//Prefixe
String prefixe = personne.get("ce_truk_prefix");
ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
ComboBox<Valeur> cbPrefixe = hmIdentite.getComboBoxValeur("cbPrefixe");
String prefixeCourant = personne.get("ce_truk_prefix");
857,13 → 853,12
cbPrefixe.setRawValue(prefixeCourant);
}
hmIdentite.getTextField("tfPrenom").setValue(personne.get("prenom"));
hmIdentite.getTextField("tfNom").setValue(personne.get("nom"));
((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
//Suffixe
String suffixe = personne.get("ce_truk_suffixe");
ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
ComboBox<Valeur> cbSuffixe = hmIdentite.getComboBoxValeur("cbSuffixe");
String suffixeCourant = personne.get("ce_truk_suffix");
if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null) {
872,34 → 867,31
cbSuffixe.setRawValue(suffixeCourant);
}
((ChampMultiValeurs) hmIdentite.get("nomAutre")).peupler(personne.getString("truk_nom_autre"));
((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
((ChampMultiValeurs) hmIdentite.get("abreviationAutre")).peupler(personne.getString("truk_abreviation_autre"));
hmIdentite.getChampMultiValeurs("nomAutre").peupler(personne.getString("truk_nom_autre"));
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("tfLieuNaissance").setValue(personne.get("naissance_lieu"));
(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
if (personne.estDecedee()) {
(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
Radio rbEstDecede = (Radio) hmIdentite.get("rbEstDecedee");
hmIdentite.getDateField("dfDateDeces").setValue(personne.getDate("deces_date"));
hmIdentite.getTextField("tfLieuDeces").setValue(personne.get("deces_lieu"));
Radio rbEstDecede = hmIdentite.getRadio("rbEstDecedee");
rbEstDecede.setValue(true);
}
((ChampMultiValeurs) hmIdentite.get("telephones")).peupler(personne.getString("truk_telephone"));
hmIdentite.getChampMultiValeurs("telephones").peupler(personne.getString("truk_telephone"));
//Courriel
((ChampMultiValeurs) hmIdentite.get("courriels")).peupler(personne.getCourriel());
hmIdentite.getChampMultiValeurs("courriels").peupler(personne.getCourriel());
//Sites web
((ChampMultiValeurs) hmIdentite.get("sites")).peupler(personne.getString("truk_url"));
hmIdentite.getChampMultiValeurs("sites").peupler(personne.getString("truk_url"));
// Sexe
String strSexe = personne.get("ce_sexe");
ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe");
ComboBox<Valeur> cbSexe = hmIdentite.getComboBoxValeur("cbSexe");
 
if (cbSexe.getStore().findModel("id_valeur", strSexe) != null) {
cbSexe.setValue(cbSexe.getStore().findModel("id_valeur", strSexe));
907,10 → 899,10
cbSexe.setRawValue(strSexe);
}
((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description"));
hmIdentite.getTextArea("taDescription").setRawValue((String) personne.get("description"));
//Logo
((ChampMultiValeurs) hmIdentite.get("logos")).peupler(personne.getString("truk_logo"));
hmIdentite.getChampMultiValeurs("logos").peupler(personne.getString("truk_logo"));
/*--------------------------------------------------
Adresse
1014,8 → 1006,8
public boolean enregistrer() {
boolean success = false;
LinkedList lstMessageErreur = new LinkedList<String>();
ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
ComboBox<Projet> cbProjets = hmIdentite.getComboBox("cbProjets");
Projet projet = cbProjets.getValue();
if (projet == null) {
lstMessageErreur.add("Le projet n'a pas été renseigné");
1023,7 → 1015,7
personneSelectionnee.set("ce_projet", projet.getId());
}
String strTfNom = ((TextField<String>) hmIdentite.get("tfNom")).getValue();
String strTfNom = (String) hmIdentite.getTextField("tfNom").getValue();
if ((strTfNom == null)||(strTfNom.trim().equals(""))) {
lstMessageErreur.add("Le nom n'a pas été saisi");
} else {
1031,15 → 1023,15
personneSelectionnee.set("nom", strTfNom);
}
String strTfPrenom = ((TextField<String>) hmIdentite.get("tfPrenom")).getValue();
String strTfPrenom = (String) hmIdentite.getTextField("tfPrenom").getValue();
personneSelectionnee.set("prenom", UtilString.ucFirst(strTfPrenom));
//Préparer les données
ComboBox combo = (ComboBox) hmIdentite.get("cbSexe");
ComboBox<Valeur> combo = hmIdentite.getComboBoxValeur("cbSexe");
Valeur valeur;
String strValeur = "";
valeur = (Valeur) combo.getValue();
valeur = combo.getValue();
if (valeur!=null) {
personneSelectionnee.set("ce_sexe", valeur.getId());
}
1050,19 → 1042,19
strValeur = obtenirValeurCombo("cbSuffixe");
personneSelectionnee.set("ce_truk_suffix", strValeur);
String nomAutre = ((ChampMultiValeurs) hmIdentite.get("nomAutre")).getValeurs();
String nomAutre = hmIdentite.getChampMultiValeurs("nomAutre").getValeurs();
personneSelectionnee.set("truk_nom_autre", nomAutre);
String abreviationAutre = ((ChampMultiValeurs) hmIdentite.get("abreviationAutre")).getValeurs();
String abreviationAutre = hmIdentite.getChampMultiValeurs("abreviationAutre").getValeurs();
personneSelectionnee.set("truk_abreviation_autre", abreviationAutre);
personneSelectionnee.set("truk_courriel", ((ChampMultiValeurs) hmIdentite.get("courriels")).getValeurs());
personneSelectionnee.set("truk_courriel", hmIdentite.getChampMultiValeurs("courriels").getValeurs());
//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
String strPrefixe = "";
combo = (ComboBox) hmIdentite.get("cbPrefixe");
valeur = (Valeur) combo.getValue();
combo = hmIdentite.getComboBoxValeur("cbPrefixe");
valeur = combo.getValue();
if (valeur != null) {
strPrefixe = valeur.getNom();
} else {
1070,8 → 1062,8
}
String strSuffixe = "";
combo = (ComboBox) hmIdentite.get("cbSuffixe");
valeur = (Valeur) combo.getValue();
combo = hmIdentite.getComboBoxValeur("cbSuffixe");
valeur = combo.getValue();
if (valeur != null) {
strSuffixe = valeur.getNom() + " ";
} else {
1080,14 → 1072,14
personneSelectionnee.setFmtNomComplet(strPrefixe, strSuffixe);
DateField dfDateNaissance = (DateField) hmIdentite.get("dfDateNaissance");
DateField dfDateNaissance = hmIdentite.getDateField("dfDateNaissance");
Date naissanceDate = dfDateNaissance.getValue();
personneSelectionnee.setNaissanceDate(naissanceDate);
Radio rbEstDecedee = (Radio) hmIdentite.get("rbEstDecedee");
Radio rbEstDecedee = hmIdentite.getRadio("rbEstDecedee");
if (rbEstDecedee.getValue() == true) {
DateField dfDecesDate = (DateField) hmIdentite.get("dfDateDeces");
String decesLieu = ((TextField<String>) hmIdentite.get("tfLieuDeces")).getValue();
DateField dfDecesDate = hmIdentite.getDateField("dfDateDeces");
String decesLieu = (String) hmIdentite.getTextField("tfLieuDeces").getValue();
personneSelectionnee.setDeces(dfDecesDate.getValue(), decesLieu);
} else {
personneSelectionnee.setNonDecedee();
1099,12 → 1091,12
strValeur = obtenirValeurCombo("cbRegion");
personneSelectionnee.set("ce_truk_region", strValeur);
personneSelectionnee.set("truk_telephone", ((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).getValeurs());
personneSelectionnee.set("truk_telephone", hmIdentite.getChampMultiValeursMultiTypes("telephones").getValeurs());
String logoUrls = ((ChampMultiValeursImage) hmIdentite.get("logos")).getValeurs();
String logoUrls = hmIdentite.getChampMultiValeursImage("logos").getValeurs();
personneSelectionnee.set("truk_logo", logoUrls);
personneSelectionnee.set("truk_url", ((ChampMultiValeurs) hmIdentite.get("sites")).getValeurs());
personneSelectionnee.set("truk_url", hmIdentite.getChampMultiValeurs("sites").getValeurs());
//Infos Naturalistes
String recolte = ((ChampMultiValeursMultiTypes) hmInfosNat.get("recolte")).getValeurs();
1115,6 → 1107,8
if (lstMessageErreur.size() == 0) {
System.out.println("2." + personne);
mediateur.enregistrerPersonne(this, personneSelectionnee);
success = true;
} else {
1136,12 → 1130,12
String strValeur = "";
Valeur valeur;
ComboBox combo = (ComboBox) hmIdentite.get(strComboName);
ComboBox<Valeur> combo = hmIdentite.getComboBoxValeur(strComboName);
if (combo == null) {
combo = (ComboBox) hmAdresse.get(strComboName);
}
strValeur = combo.getRawValue();
valeur = (Valeur) combo.getStore().findModel(strValeur);
valeur = combo.getStore().findModel(strValeur);
if (valeur != null) {
strValeur = valeur.getId();
}
1167,7 → 1161,7
boolean success = true;
LinkedList<String> lstMessageErreur = new LinkedList<String>();
ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
ComboBox<Projet> cbProjets = hmIdentite.getComboBox("cbProjets");
Projet projet = cbProjets.getValue();
if (projet == null) {
lstMessageErreur.add("Le projet n'a pas été renseigné");
1175,7 → 1169,7
personneSelectionnee.set("ce_projet", projet.getId());
}
String strTfNom = ((TextField<String>) hmIdentite.get("tfNom")).getValue();
String strTfNom = (String) hmIdentite.getTextField("tfNom").getValue();
if ((strTfNom == null)||(strTfNom.trim().equals(""))) {
lstMessageErreur.add("Le nom n'a pas été saisi");
} else {
1183,15 → 1177,15
personneSelectionnee.set("nom", strTfNom);
}
String strTfPrenom = ((TextField<String>) hmIdentite.get("tfPrenom")).getValue();
String strTfPrenom = (String) hmIdentite.getTextField("tfPrenom").getValue();
personneSelectionnee.set("prenom", UtilString.ucFirst(strTfPrenom));
//Préparer les données
ComboBox combo = (ComboBox) hmIdentite.get("cbSexe");
ComboBox<Valeur> combo = hmIdentite.getComboBoxValeur("cbSexe");
Valeur valeur;
String strValeur = "";
valeur = (Valeur) combo.getValue();
valeur = combo.getValue();
if (valeur!=null) {
personneSelectionnee.set("ce_sexe", valeur.getId());
}
1202,19 → 1196,19
strValeur = obtenirValeurCombo("cbSuffixe");
personneSelectionnee.set("ce_truk_suffix", strValeur);
String nomAutre = ((ChampMultiValeurs) hmIdentite.get("nomAutre")).getValeurs();
String nomAutre = hmIdentite.getChampMultiValeurs("nomAutre").getValeurs();
personneSelectionnee.set("truk_nom_autre", nomAutre);
String abreviationAutre = ((ChampMultiValeurs) hmIdentite.get("abreviationAutre")).getValeurs();
String abreviationAutre = hmIdentite.getChampMultiValeurs("abreviationAutre").getValeurs();
personneSelectionnee.set("truk_abreviation_autre", abreviationAutre);
personneSelectionnee.set("truk_courriel", ((ChampMultiValeurs) hmIdentite.get("courriels")).getValeurs());
personneSelectionnee.set("truk_courriel", hmIdentite.getChampMultiValeurs("courriels").getValeurs());
//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
String strPrefixe = "";
combo = (ComboBox) hmIdentite.get("cbPrefixe");
valeur = (Valeur) combo.getValue();
combo = hmIdentite.getComboBoxValeur("cbPrefixe");
valeur = combo.getValue();
if (valeur != null) {
strPrefixe = valeur.getNom();
} else {
1222,8 → 1216,8
}
String strSuffixe = "";
combo = (ComboBox) hmIdentite.get("cbSuffixe");
valeur = (Valeur) combo.getValue();
combo = hmIdentite.getComboBox("cbSuffixe");
valeur = combo.getValue();
if (valeur != null) {
strSuffixe = valeur.getNom() + " ";
} else {
1232,14 → 1226,14
personneSelectionnee.setFmtNomComplet(strPrefixe, strSuffixe);
DateField dfDateNaissance = (DateField) hmIdentite.get("dfDateNaissance");
DateField dfDateNaissance = hmIdentite.getDateField("dfDateNaissance");
Date naissanceDate = dfDateNaissance.getValue();
personneSelectionnee.setNaissanceDate(naissanceDate);
Radio rbEstDecedee = (Radio) hmIdentite.get("rbEstDecedee");
Radio rbEstDecedee = hmIdentite.getRadio("rbEstDecedee");
if (rbEstDecedee.getValue() == true) {
DateField dfDecesDate = (DateField) hmIdentite.get("dfDateDeces");
String decesLieu = ((TextField<String>) hmIdentite.get("tfLieuDeces")).getValue();
DateField dfDecesDate = hmIdentite.getDateField("dfDateDeces");
String decesLieu = (String) hmIdentite.getTextField("tfLieuDeces").getValue();
personneSelectionnee.setDeces(dfDecesDate.getValue(), decesLieu);
} else {
personneSelectionnee.setNonDecedee();
1251,12 → 1245,12
strValeur = obtenirValeurCombo("cbRegion");
personneSelectionnee.set("ce_truk_region", strValeur);
personneSelectionnee.set("truk_telephone", ((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).getValeurs());
personneSelectionnee.set("truk_telephone", hmIdentite.getChampMultiValeursMultiTypes("telephones").getValeurs());
String logoUrls = ((ChampMultiValeursImage) hmIdentite.get("logos")).getValeurs();
String logoUrls = hmIdentite.getChampMultiValeursImage("logos").getValeurs();
personneSelectionnee.set("truk_logo", logoUrls);
personneSelectionnee.set("truk_url", ((ChampMultiValeurs) hmIdentite.get("sites")).getValeurs());
personneSelectionnee.set("truk_url", hmIdentite.getChampMultiValeurs("sites").getValeurs());
//Infos Naturalistes
String recolte = ((ChampMultiValeursMultiTypes) hmInfosNat.get("recolte")).getValeurs();