Subversion Repositories eFlore/Applications.coel

Rev

Rev 1135 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.client.vues.structure;

import java.util.ArrayList;
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.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.InterneValeur;
import org.tela_botanica.client.modeles.InterneValeurListe;
import org.tela_botanica.client.modeles.MenuApplicationId;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.modeles.personne.PersonneListe;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.structure.Structure;
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
import org.tela_botanica.client.modeles.structure.StructureConservation;
import org.tela_botanica.client.modeles.structure.StructureValorisation;
import org.tela_botanica.client.util.UtilArray;
import org.tela_botanica.client.util.UtilString;
import org.tela_botanica.client.vues.Formulaire;

import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.KeyListener;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.Record;
import com.extjs.gxt.ui.client.store.Store;
import com.extjs.gxt.ui.client.store.StoreEvent;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
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.HiddenField;
import com.extjs.gxt.ui.client.widget.form.LabelField;
import com.extjs.gxt.ui.client.widget.form.NumberField;
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.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.Window;

public class StructureForm extends Formulaire implements Rafraichissable {
        
        private static int decompteRafraichissementPersonnel = 0;
        
        private TabPanel onglets = null;
        private TabItem identificationOnglet = null;
        private TabItem personnelOnglet = null;
        private TabItem conservationOnglet = null;
        private TabItem valorisationOnglet = null;

        private HiddenField<String> idStructureChp = null;
        
        // Onglet IDENTIFICATION
        private Structure identification = null;
        private ListStore<Valeur> magazinLstpr = null;
        private ComboBox<Valeur> comboLstpr = null;
        private ListStore<Valeur> magazinLstpu = null;
        private ComboBox<Valeur> comboLstpu = null;
        private ListStore<Valeur> magazinLiStatut = null;
        private ComboBox<Valeur> comboLiStatut = null;
        private ListStore<Valeur> fonctionsMagazin = null;
        private ComboBox<Valeur> fonctionsCombo = null;
        private ComboBox<InterneValeur> comboAcronyme = null;
        private TextField<String> ihChp = null;
        private TextField<String> mnhnChp = null;
        private ComboBox<InterneValeur> comboTypeStructure = null;
        private TextField<String> nomStructureChp = null;
        private DateField dateFondationChp = null;
        private TextArea adrChp = null;
        private TextField<String> cpChp = null;
        private TextField<String> villeChp = null;
        private ComboBox<Valeur> comboRegion = null;
        private TextField<String> telChp = null;
        private TextField<String> faxChp = null;
        private TextField<String> emailChp = null;
        private TextField<String> urlChp = null;
        private ListStore<Valeur> magazinPays = null;
        private ListStore<Valeur> magazinRegion = null;
        private ComboBox<Valeur> comboPays = null;

        // Onglet PERSONNEL
        private StructureAPersonneListe personnel = null;
        private StructureAPersonneListe personnelAjoute = null;
        private StructureAPersonneListe personnelModifie = null;
        private StructureAPersonneListe personnelSupprime = null;
        private NumberField nbreTotalPersonneStructureChp = null;
        private EditorGrid<StructureAPersonne> grillePersonnel = null;
        private ListStore<StructureAPersonne> personnelGrilleMagazin = null;
        
        // Onglet CONSERVATION
        private StructureConservation conservation = null;
        private RadioGroup formationMarkRGrpChp = null;
        private RadioGroup interetFormationMarkRGrpChp = null;
        private RadioGroup collectionCommuneMarkRGrpChp = null;
        private RadioGroup accesControleMarkRGrpChp = null;
        private RadioGroup restaurationMarkRGrpChp = null;
        private RadioGroup traitementMarkRGrpChp = null;
        private RadioGroup collectionAcquisitionMarkRGrpChp = null;
        private RadioGroup echantillonAcquisitionMarkRGrpChp = null;
        private TextField<String> localStockageAutreChp = null;
        private TextField<String> meubleStockageAutreChp = null;
        private TextField<String> parametreStockageAutreChp = null;
        private TextField<String> collectionAutreAutreChp = null;
        private TextField<String> autreCollectionAutreChp = null;
        private TextField<String> opRestauAutreChp = null;
        private TextField<String> autreMaterielAutreChp = null;
        private TextField<String> poisonTraitementAutreChp = null;
        private TextField<String> traitementAutreChp = null;
        private TextField<String> insecteTraitementAutreChp = null;
        private TextField<String> actionAutreChp = null;
        private TextField<String> provenanceRechercheAutreChp = null;
        private TextField<String> typeRechercheAutreChp = null;
        private CheckBoxGroup localStockageTrukCacGrpChp = null;
        private LayoutContainer localStockageTrukCp = null;
        private CheckBoxGroup meubleStockageTrukCacGrpChp = null;
        private LayoutContainer meubleStockageTrukCp = null;
        private CheckBoxGroup parametreStockageTrukCacGrpChp = null;
        private LayoutContainer parametreStockageTrukCp = null;
        private LayoutContainer collectionAutreTrukCp = null;
        private CheckBoxGroup collectionAutreTrukCacGrpChp = null;
        private CheckBoxGroup opRestauTrukCacGrpChp = null;
        private LayoutContainer opRestauTrukCp = null;
        private CheckBoxGroup autreMaterielTrukCacGrpChp = null;
        private LayoutContainer autreMaterielTrukCp = null;
        private LayoutContainer traitementTrukCp = null;
        private CheckBoxGroup traitementTrukCacGrpChp = null;
        private LayoutContainer poisonTraitementTrukCp = null;
        private LayoutContainer insecteTraitementTrukCp = null;
        private CheckBoxGroup insecteTraitementTrukCacGrpChp = null;
        private CheckBoxGroup poisonTraitementTrukCacGrpChp = null;
        private LayoutContainer autreCollectionTrukCp = null;
        private CheckBoxGroup autreCollectionTrukCacGrpChp = null;
        private LayoutContainer provenanceRechercheTrukCp = null;
        private CheckBoxGroup provenanceRechercheTrukCacGrpChp = null;
        private CheckBoxGroup typeRechercheTrukCacGrpChp = null;
        private LayoutContainer typeRechercheTrukCp = null;
        private TextField<String> futureActionChp = null;
        private TextField<String> sansMotifAccesChp = null;
        private TextField<String> avecMotifAccesChp = null;
        private TextField<String> formationChp = null;
        private RadioGroup traitementAcquisitionMarkRGrpChp = null;
        private LabelField traitementAcquisitionMarkLabel = null;
        private RadioGroup materielConservationCeRGrpChp = null;

        // Onglet VALORISATION
        private StructureValorisation valorisation = null;
        private RadioGroup actionMarkRGrpChp = null;
        private LayoutContainer actionTrukCp = null;
        private CheckBoxGroup actionTrukCacGrpChp = null;
        private RadioGroup futureActionMarkRGrpChp = null;
        private RadioGroup rechercheMarkRGrpChp = null;
        private RadioGroup sansMotifAccesMarkRGrpChp = null;
        private RadioGroup avecMotifAccesMarkRGrpChp = null;
        private TextField<String> publicationChp = null;
        private LayoutContainer materielConservationCp = null;
        private ListStore<Personne> personneExistanteMagazin = null;
        private ComboBox<Personne> personneExistanteCombo = null;
        private Button supprimerPersonnelBtn = null;
        private ListStore<Projet> projetsMagazin = null;
        private ComboBox<Projet> projetsCombo = null;
        private CellEditor fonctionEditor = null;
        private List<Valeur> fonctionsListe = null;

        public StructureForm(Mediateur mediateurCourrant, String modeDeCreation) {
                initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.STRUCTURE);
                // Ajout du titre
                panneauFormulaire.setHeading(i18nC.titreAjoutFormStructurePanneau());
                // Création des onglets
                onglets = creerOnglets();
                // Ajout des onglets au formulaire général
                panneauFormulaire.add(onglets);
        }
        
        protected TabPanel creerOnglets() {
                TabPanel ongletsStructure = new TabPanel();
                // NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner) 
                ongletsStructure.setHeight("100%");
                
                // Onlget formulaire IDENTIFICATION
                ongletsStructure.add(creerOngletIdentification());
                
                // Onlget formulaire PERSONNEL
                ongletsStructure.add(creerOngletPersonnel());
                
                // Onlget formulaire CONSERVATION
                ongletsStructure.add(creerOngletConservation());
                
                // Onlget formulaire VALORISATION
                ongletsStructure.add(creerOngletValorisation());
                
                // Sélection de l'onglet par défaut
                //ongletsStructure(personnelOnglet);
                
                return ongletsStructure;
        }
        
        public void reinitialiserFormulaire() {
                if (mode.equals(StructureForm.MODE_MODIFIER)) {
                        mediateur.afficherFormStructure(identification.getId());
                } else {
                        mediateur.afficherFormStructure(null);
                }
        }
        
        public boolean soumettreFormulaire() {
                // Vérification de la validité des champs du formulaire
                boolean fomulaireValide = verifierFormulaire();
                if (fomulaireValide) {
                        // Collecte des données du formulaire
                        Structure structure = collecterStructureIdentification();
                        StructureConservation conservation = collecterStructureConservation();
                        StructureValorisation valorisation = collecterStructureValorisation();
                        collecterStructurePersonnel();
                        
                        if (mode.equals(MODE_AJOUTER)) {
                                // Ajout des informations sur la Structure
                                mediateur.ajouterStructure(this, structure, conservation, valorisation);
                                // L'ajout des relations StructureAPersonne se fait quand la structure a été ajoutée
                                // Voir la méthode rafraichir().
                        } else if (mode.equals(MODE_MODIFIER)) {
                                // Modification des informations sur la Structure
                                if (structure == null && conservation == null && valorisation == null) {
                                        Info.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
                                } else {
                                        mediateur.modifierStructure(this, identification.getId(), structure, conservation, valorisation);
                                }
                                if (personnelModifie.size() == 0 && personnelAjoute.size() == 0 && personnelSupprime.size() == 0) {
                                        Info.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
                                } else {
                                        if (personnelModifie.size() != 0) {
                                                decompteRafraichissementPersonnel++;
                                                mediateur.modifierStructureAPersonne(this, personnelModifie);
                                        }
                                        // Ajout des relations StructureAPersonne
                                        if (personnelAjoute.size() != 0) {
                                                decompteRafraichissementPersonnel++;
                                                mediateur.ajouterStructureAPersonne(this, identification.getId(), personnelAjoute);
                                        }
                                        // Suppression des relations StructureAPersonne
                                        if (personnelSupprime.size() != 0) {
                                                decompteRafraichissementPersonnel++;
                                                mediateur.supprimerStructureAPersonne(this, personnelSupprime);
                                        }
                                }
                        }
                }
                return fomulaireValide;
        }
        
        public boolean verifierFormulaire() {
                ArrayList<String> messages = new ArrayList<String>();
                
                // Vérification des infos sur le nom de la structure
                if (    (identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue() == null) ||
                                (identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue().equals("")) ||
                                (identificationOnglet.getData("acces").equals(false) && identification.getNom().equals(""))) {
                        messages.add("Veuillez indiquez un nom à l'institution.");
                }
                
                // Vérification des infos sur le projet de la structure
                if (    (identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue() == null) ||
                                (identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue().equals("")) ||
                                (identificationOnglet.getData("acces").equals(false) && identification.getIdProjet().equals(""))) {
                        messages.add("Veuillez sélectionner un projet pour l'institution.");
                }
                
                // Vérification du Personnel
                if (personnelOnglet.getData("acces").equals(true)) {
                        String personnelNumero = "";
                        int nbrePersonne = personnelGrilleMagazin.getCount();
                        for (int i = 0; i < nbrePersonne; i++) {
                                StructureAPersonne personne = personnelGrilleMagazin.getAt(i);
                                if (personne.getNom().equals("") || personne.getPrenom().equals("")) {
                                        personnelNumero += (i != 0 ? ", " : "")+(i+1);
                                }
                        }
                        if (!personnelNumero.equals("")) {
                                messages.add("Veuillez indiquez un prénom et un nom au personnel numéro : "+personnelNumero);
                        }
                }

                // Affichage des messages d'alerte
                if (messages.size() != 0) {
                        String[] a = {};
                        a = messages.toArray(a);
                        MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
                        return false;
                }
                return true;
        }
        
        private StructureValorisation collecterStructureValorisation() {
                StructureValorisation valorisationARetourner = null;
                if (valorisationOnglet.getData("acces").equals(true)) {
                        // Création de l'objet
                        StructureValorisation valorisationCollectee = (StructureValorisation) valorisation.cloner(new StructureValorisation());
                        
                        // ACTION
                        if (actionMarkRGrpChp.getValue() != null) {
                                valorisationCollectee.setAction(actionMarkRGrpChp.getValue().getValueAttribute());
                        }
                        
                        // ACTION INFO
                        valorisationCollectee.setActionInfo(creerChaineDenormalisee(actionTrukCacGrpChp.getValues()));
                        valorisationCollectee.setActionInfo("AUTRE", actionAutreChp.getValue());
                        
                        // PUBLICATION
                        valorisationCollectee.setPublication(publicationChp.getValue());
                        
                        // COLLECTION AUTRE
                        valorisationCollectee.setCollectionAutre(creerChaineDenormalisee(autreCollectionTrukCacGrpChp.getValues()));
                        valorisationCollectee.setCollectionAutre("AUTRE", autreCollectionAutreChp.getValue());
                        
                        // ACTION FUTURE
                        if (futureActionMarkRGrpChp.getValue() != null) {
                                valorisationCollectee.setActionFuture(futureActionMarkRGrpChp.getValue().getValueAttribute());
                        }
                        // ACTION FUTURE INFO
                        valorisationCollectee.setActionFutureInfo(futureActionChp.getValue());
                        
                        // RECHERCHE
                        if (rechercheMarkRGrpChp.getValue() != null) {
                                valorisationCollectee.setRecherche(rechercheMarkRGrpChp.getValue().getValueAttribute());

                                // RECHERCHE PROVENANCE
                                valorisationCollectee.setRechercheProvenance(creerChaineDenormalisee(provenanceRechercheTrukCacGrpChp.getValues()));
                                valorisationCollectee.setRechercheProvenance("AUTRE", provenanceRechercheAutreChp.getValue());
                                
                                // RECHERCHE TYPE
                                valorisationCollectee.setRechercheType(creerChaineDenormalisee(typeRechercheTrukCacGrpChp.getValues()));
                                valorisationCollectee.setRechercheType("AUTRE", typeRechercheAutreChp.getValue());
                        }
                        
                        // ACCÈS SANS MOTIF
                        if (sansMotifAccesMarkRGrpChp.getValue() != null) {
                                valorisationCollectee.setAccesSansMotif(sansMotifAccesMarkRGrpChp.getValue().getValueAttribute());
                        }
                        // ACCÈS SANS MOTIF INFO
                        valorisationCollectee.setAccesSansMotifInfo(sansMotifAccesChp.getValue());
                        
                        // VISITE AVEC MOTIF
                        if (avecMotifAccesMarkRGrpChp.getValue() != null) {
                                valorisationCollectee.setVisiteAvecMotif(avecMotifAccesMarkRGrpChp.getValue().getValueAttribute());
                        }
                        // VISITE AVEC MOTIF INFO
                        valorisationCollectee.setVisiteAvecMotifInfo(avecMotifAccesChp.getValue());
                        
                        // Retour de l'objet
                        if (!valorisationCollectee.comparer(valorisation)) {
                                valorisationARetourner = valorisation = valorisationCollectee;
                        }
                }
                return valorisationARetourner;
        }
        
        private void peuplerStructureValorisation() {
                if (mode.equals(MODE_AJOUTER)) {
                        // Indique que l'onglet a pu être modifié pour la méthode collecter...
                        valorisationOnglet.setData("acces", true);
                        // Initialisation de l'objet Structure
                        valorisation = new StructureValorisation();
                }
                if (mode.equals(MODE_MODIFIER) && valorisation != null && valorisationOnglet.getData("acces").equals(false)) {
                        // ACTION : 
                        //TODO : check below:
                        ((Radio) actionMarkRGrpChp.get((valorisation.getAction().equals("1") ? 0 : 1))).setValue(true);
                        
                        // ACTION INFO
                        peuplerCasesACocher(valorisation.getActionInfo(), actionTrukCacGrpChp, actionAutreChp);
                        
                        // PUBLICATION
                        publicationChp.setValue(valorisation.getPublication());
                        
                        // COLLECTION AUTRE
                        peuplerCasesACocher(valorisation.getCollectionAutre(), autreCollectionTrukCacGrpChp, autreCollectionAutreChp);
                        
                        // ACTION FUTURE
                        ((Radio) futureActionMarkRGrpChp.get((valorisation.getActionFuture().equals("1") ? 0 : 1))).setValue(true);
                        
                        // ACTION FUTURE INFO
                        futureActionChp.setValue(valorisation.getActionFutureInfo());
                        
                        // RECHERCHE
                        ((Radio) rechercheMarkRGrpChp.get((valorisation.getRecherche().equals("1") ? 0 : 1))).setValue(true);
                        // RECHERCHE PROVENANCE
                        peuplerCasesACocher(valorisation.getRechercheProvenance(), provenanceRechercheTrukCacGrpChp, provenanceRechercheAutreChp);
                        // RECHERCHE TYPE
                        peuplerCasesACocher(valorisation.getRechercheType(), typeRechercheTrukCacGrpChp, typeRechercheAutreChp);

                        // ACCÈS SANS MOTIF
                        ((Radio) sansMotifAccesMarkRGrpChp.get((valorisation.getAccesSansMotif().equals("1") ? 0 : 1))).setValue(true);
                        // ACCÈS SANS MOTIF INFO
                        sansMotifAccesChp.setValue(valorisation.getAccesSansMotifInfo());
                        
                        // VISITE AVEC MOTIF
                        ((Radio) avecMotifAccesMarkRGrpChp.get((valorisation.getVisiteAvecMotif().equals("1") ? 0 : 1))).setValue(true);
                        // VISITE AVEC MOTIF INFO
                        avecMotifAccesChp.setValue(valorisation.getVisiteAvecMotifInfo());
                        
                        // Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter... 
                        valorisationOnglet.setData("acces", true);
                }
        }
        
        private StructureConservation collecterStructureConservation() {
                StructureConservation conservationARetourner = null;
                if (conservationOnglet.getData("acces").equals(true)) {
                        // Création de l'objet
                        StructureConservation conservationCollectee = (StructureConservation) conservation.cloner(new StructureConservation());
                        
                        // FORMATION
                        if (formationMarkRGrpChp.getValue() != null) {
                                conservationCollectee.setFormation(formationMarkRGrpChp.getValue().getValueAttribute());
                        }
                        // FORMATION INFO
                        conservationCollectee.setFormationInfo(formationChp.getValue());
                        // FORMATION INTERET
                        if (interetFormationMarkRGrpChp.getValue() != null) {
                                conservationCollectee.setFormationInteret(interetFormationMarkRGrpChp.getValue().getValueAttribute());
                        }
                        
                        // STOCKAGE LOCAL
                        conservationCollectee.setStockageLocal(creerChaineDenormalisee(localStockageTrukCacGrpChp.getValues()));
                        conservationCollectee.setStockageLocal("AUTRE", localStockageAutreChp.getValue());
        
                        // STOCKAGE MEUBLE
                        conservationCollectee.setStockageMeuble(creerChaineDenormalisee(meubleStockageTrukCacGrpChp.getValues()));
                        conservationCollectee.setStockageMeuble("AUTRE", meubleStockageAutreChp.getValue());
                        
                        // STOCKAGE PAREMETRE
                        conservationCollectee.setStockageParametre(creerChaineDenormalisee(parametreStockageTrukCacGrpChp.getValues()));
                        conservationCollectee.setStockageParametre("AUTRE", parametreStockageAutreChp.getValue());
                        
                        // COLLECTION COMMUNE
                        if (collectionCommuneMarkRGrpChp.getValue() != null) {
                                conservationCollectee.setCollectionCommune(collectionCommuneMarkRGrpChp.getValue().getValueAttribute());
                        }
                        // COLLECTION AUTRE
                        conservationCollectee.setCollectionAutre(creerChaineDenormalisee(collectionAutreTrukCacGrpChp.getValues()));
                        conservationCollectee.setCollectionAutre("AUTRE", collectionAutreAutreChp.getValue());
                        
                        // ACCÈS CONTROLÉ
                        if (accesControleMarkRGrpChp.getValue() != null) {
                                conservationCollectee.setAccesControle(accesControleMarkRGrpChp.getValue().getValueAttribute());
                        }
                        
                        // RESTAURATION
                        if (restaurationMarkRGrpChp.getValue() != null) {
                                conservationCollectee.setRestauration(restaurationMarkRGrpChp.getValue().getValueAttribute());
                        }
                        // RESTAURATION OPÉRATION
                        conservationCollectee.setRestaurationOperation(creerChaineDenormalisee(opRestauTrukCacGrpChp.getValues()));
                        conservationCollectee.setRestaurationOperation("AUTRE", opRestauAutreChp.getValue());
                        
                        // MATERIEL CONSERVATION
                        if (materielConservationCeRGrpChp.getValue() != null) {
                                conservationCollectee.setMaterielConservation(materielConservationCeRGrpChp.getValue().getValueAttribute());

                                // MATERIEL AUTRE
                                conservationCollectee.setMaterielAutre(creerChaineDenormalisee(autreMaterielTrukCacGrpChp.getValues()));
                                conservationCollectee.setMaterielAutre("AUTRE", autreMaterielAutreChp.getValue());
                        }
                        
                        // TRAITEMENT
                        if (traitementMarkRGrpChp.getValue() != null) {
                                conservationCollectee.setTraitement(traitementMarkRGrpChp.getValue().getValueAttribute());
                        }
                        // TRAIEMENTS
                        conservationCollectee.setTraitements(creerChaineDenormalisee(traitementTrukCacGrpChp.getValues()));
                        conservationCollectee.setTraitements("AUTRE", traitementAutreChp.getValue());
                        
                        
                        // ACQUISITION COLLECTION
                        if (collectionAcquisitionMarkRGrpChp.getValue() != null) {
                                conservationCollectee.setAcquisitionCollection(collectionAcquisitionMarkRGrpChp.getValue().getValueAttribute());
                        }
                        
                        // ACQUISITION ECHANTILLON
                        if (echantillonAcquisitionMarkRGrpChp.getValue() != null) {
                                conservationCollectee.setAcquisitionEchantillon(echantillonAcquisitionMarkRGrpChp.getValue().getValueAttribute());
                        }
                        // ACQUISITION TRAITEMENT
                        if (traitementAcquisitionMarkRGrpChp.getValue() != null) {
                                conservationCollectee.setAcquisitionTraitement(traitementAcquisitionMarkRGrpChp.getValue().getValueAttribute());
                        }
                        // ACQUISITION TRAITEMENT POISON
                        conservationCollectee.setAcquisitionTraitementPoison(creerChaineDenormalisee(poisonTraitementTrukCacGrpChp.getValues()));
                        conservationCollectee.setAcquisitionTraitementPoison("AUTRE", poisonTraitementAutreChp.getValue());
                        // ACQUISITION TRAITEMENT INSECTE
                        conservationCollectee.setAcquisitionTraitementInsecte(creerChaineDenormalisee(insecteTraitementTrukCacGrpChp.getValues()));
                        conservationCollectee.setAcquisitionTraitementInsecte("AUTRE", insecteTraitementAutreChp.getValue());
                        
                        // Retour de l'objet
                        if (!conservationCollectee.comparer(conservation)) {
                                GWT.log("Collecte différent de Retour", null);
                                conservationARetourner = conservation = conservationCollectee;
                        }
                }
                return conservationARetourner;
        }
        
        private void peuplerStructureConservation() {
                if (mode.equals(MODE_AJOUTER)) {
                        // Indique que l'onglet a pu être modifié pour la méthode collecter...
                        conservationOnglet.setData("acces", true);
                        // Initialisation de l'objet Structure
                        conservation = new StructureConservation();
                }
                if (mode.equals(MODE_MODIFIER) && conservation != null && conservationOnglet.getData("acces").equals(false)) {
                        // FORMATION
                        // Bouton oui, à toujours l'index 0 donc on teste en fonction...
                        ((Radio) formationMarkRGrpChp.get((conservation.getFormation().equals("1") ? 0 : 1))).setValue(true);
                        // FORMATION INFO
                        formationChp.setValue(conservation.getFormationInfo());
                        // FORMATION INTERET
                        ((Radio) interetFormationMarkRGrpChp.get((conservation.getFormationInteret().equals("1") ? 0 : 1))).setValue(true);
        
                        // STOCKAGE LOCAL               
                        peuplerCasesACocher(conservation.getStockageLocal(), localStockageTrukCacGrpChp,localStockageAutreChp);
        
                        // STOCKAGE MEUBLE
                        peuplerCasesACocher(conservation.getStockageMeuble(), meubleStockageTrukCacGrpChp, meubleStockageAutreChp);
        
                        // STOCKAGE PAREMETRE
                        peuplerCasesACocher(conservation.getStockageParametre(), parametreStockageTrukCacGrpChp, parametreStockageAutreChp);
                        
                        // COLLECTION COMMUNE
                        ((Radio) collectionCommuneMarkRGrpChp.get((conservation.getCollectionCommune().equals("1") ? 0 : 1))).setValue(true);
                        // COLLECTION AUTRE
                        peuplerCasesACocher(conservation.getCollectionAutre(), collectionAutreTrukCacGrpChp, collectionAutreAutreChp);
                        
                        // ACCÈS CONTROLÉ
                        ((Radio) accesControleMarkRGrpChp.get((conservation.getAccesControle().equals("1") ? 0 : 1))).setValue(true);
                        
                        // RESTAURATION
                        ((Radio) restaurationMarkRGrpChp.get((conservation.getRestauration().equals("1") ? 0 : 1))).setValue(true);
                        // RESTAURATION OPÉRATION
                        peuplerCasesACocher(conservation.getRestaurationOperation(), opRestauTrukCacGrpChp, opRestauAutreChp);
                        
                        // MATERIEL CONSERVATION
                        peuplerBoutonsRadio(conservation.getMaterielConservation(), materielConservationCeRGrpChp);
                        
                        // MATERIEL AUTRE
                        peuplerCasesACocher(conservation.getMaterielAutre(), autreMaterielTrukCacGrpChp, autreMaterielAutreChp);
                        
                        // TRAITEMENT
                        ((Radio) traitementMarkRGrpChp.get((conservation.getTraitement().equals("1") ? 0 : 1))).setValue(true);
                        // TRAITEMENTS
                        peuplerCasesACocher(conservation.getTraitements(), traitementTrukCacGrpChp, traitementAutreChp);
                        
                        // ACQUISITION COLLECTION
                        ((Radio) collectionAcquisitionMarkRGrpChp.get((conservation.getAcquisitionCollection().equals("1") ? 0 : 1))).setValue(true);
                        
                        // ACQUISITION ECHANTILLON
                        ((Radio) echantillonAcquisitionMarkRGrpChp.get((conservation.getAcquisitionEchantillon().equals("1") ? 0 : 1))).setValue(true);
                        
                        // ACQUISITION TRAITEMENT
                        ((Radio) traitementAcquisitionMarkRGrpChp.get((conservation.getAcquisitionTraitement().equals("1") ? 0 : 1))).setValue(true);                   
                        // ACQUISITION TRAITEMENT POISON
                        peuplerCasesACocher(conservation.getAcquisitionTraitementPoison(), poisonTraitementTrukCacGrpChp, poisonTraitementAutreChp);
                        // ACQUISITION TRAITEMENT INSECTE
                        peuplerCasesACocher(conservation.getAcquisitionTraitementInsecte(), insecteTraitementTrukCacGrpChp, insecteTraitementAutreChp);
                        
                        // Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
                        conservationOnglet.setData("acces", true);
                }
        }
        
        private Structure collecterStructureIdentification() {
                Structure structureARetourner = null;
                if (identificationOnglet.getData("acces").equals(true)) {
                        
                        Structure structureCollectee = (Structure) identification.cloner(new Structure());
                        
                        structureCollectee.setId(idStructureChp.getValue());
                        structureCollectee.setNom(nomStructureChp.getValue());
                        // Récupération de l'identifiant du projet
                        if (projetsCombo.getValue() != null) {
                                structureCollectee.setIdProjet(projetsCombo.getValue().getId());
                        }
                        // Récupération de l'acronyme (= identifiant alternatif)
                        structureCollectee.setIdAlternatif(null);
                        if (comboAcronyme.getValue() != null) {
                                String typeAcronyme = comboAcronyme.getValue().getAbr();
                                if (typeAcronyme == "IH") {
                                        structureCollectee.setIdAlternatif(typeAcronyme+"##"+ihChp.getValue());
                                } else if (typeAcronyme == "MNHN") {
                                        structureCollectee.setIdAlternatif(typeAcronyme+"##"+mnhnChp.getValue());
                                }
                        }
                        // Récupération statut de la structure
                        structureCollectee.setTypePublic(null);
                        structureCollectee.setTypePrive(null);
                        if (comboTypeStructure.getValue() != null) {
                                String typeStructure = comboTypeStructure.getValue().getAbr();
                                if (typeStructure == "stpu" && comboLstpu.getValue() != null) {
                                        structureCollectee.setTypePublic(comboLstpu.getValue().getId());
                                } else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
                                        structureCollectee.setTypePrive(comboLstpr.getValue().getId());
                                }
                        }
                        structureCollectee.setDateFondation(dateFondationChp.getValue());
                        
                        structureCollectee.setAdresse(adrChp.getValue());
                        structureCollectee.setCodePostal(cpChp.getValue());
                        structureCollectee.setVille(villeChp.getValue());
                        
                        String strRegion = "";
                        Valeur valeurRegion = comboRegion.getValue();
                        if (valeurRegion == null)       {
                                strRegion = "AUTRE##" + comboRegion.getRawValue();      
                        } else  {
                                strRegion = valeurRegion.getId();
                        }
                        
                        structureCollectee.setRegion(strRegion);
                        structureCollectee.setPays(null);
                        if (comboPays.getValue() != null) {
                                structureCollectee.setPays(comboPays.getValue().getId());
                        } else if (comboPays.getRawValue() != "") {
                                structureCollectee.setPays(comboPays.getRawValue());
                        }
                        
                        structureCollectee.setTelephoneFixe(telChp.getValue());
                        structureCollectee.setFax(faxChp.getValue());
                        structureCollectee.setCourriel(emailChp.getValue());
                        structureCollectee.setUrl(Structure.URL_SITE, urlChp.getValue());
                        
                        if (nbreTotalPersonneStructureChp.getValue() != null) {
                                structureCollectee.setNbrePersonne(nbreTotalPersonneStructureChp.getValue().intValue());
                        }
                        
                        if (!structureCollectee.comparer(identification)) {
                                structureARetourner = identification = structureCollectee;
                        }
                        
                }
                
                
                System.out.println(structureARetourner);
                return structureARetourner;
        }
        
        private void peuplerStructureIdentification() {
                if (mode.equals(MODE_AJOUTER)) {
                        // Indique que l'ongleta pu être modifié pour la méthode collecter...
                        identificationOnglet.setData("acces", true);
                        // Initialisation de l'objet Structure
                        identification = new Structure();
                        // Indication du projet sélectionné par défaut
                        String projetCourantId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getProjetId();
                        if (projetCourantId != null && !projetCourantId.equals("0")) {
                                projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", projetCourantId));
                        }
                }
                if (mode.equals(MODE_MODIFIER) && identification != null && identificationOnglet.getData("acces").equals(false)) {
                        idStructureChp.setValue(identification.getId());
                        nomStructureChp.setValue(identification.getNom());
                        if (!identification.getIdProjet().equals("0")) {
                                projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", identification.getIdProjet()));
                        }
                        
                        if (!identification.getIdAlternatif().isEmpty()) {
                                String[] acronyme = identification.getIdAlternatif().split("##");
                                //#436 : Ne pas afficher "null"
                                if (UtilString.isEmpty(acronyme[1]) || acronyme[1].equals("null"))      {
                                        acronyme[1] = "";
                                }
                                
                                if (acronyme[0].matches("^IH$")) {
                                        comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeIH());
                                        ihChp.setValue(acronyme[1]);
                                } else if (acronyme[0].matches("^MNHN$")) {
                                        comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeMNHN());
                                        mnhnChp.setValue(acronyme[1]);
                                }
                        }
                        if (!identification.getTypePrive().isEmpty()) {
                                if (identification.getTypePrive().matches("^[0-9]+$")) {
                                        comboTypeStructure.setValue(InterneValeurListe.getTypePrivee());
                                        comboLstpr.setValue(comboLstpr.getStore().findModel("id_valeur", identification.getTypePrive()));
                                }
                        } else if (!identification.getTypePublic().isEmpty()) {
                                if (identification.getTypePublic().matches("^[0-9]+$")) {
                                        comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
                                        comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
                                }
                        }
                        dateFondationChp.setValue(identification.getDateFondation());
                        
                        adrChp.setValue(identification.getAdresse());
                        cpChp.setValue(identification.getCodePostal());
                        villeChp.setValue(identification.getVille());
                        mettreAJourRegion();
                        //(identification.getRegion());
                        if (identification.getPays().matches("^[0-9]+$")) {
                                comboPays.setValue(comboPays.getStore().findModel("id_valeur", identification.getPays()));
                        } else {
                                comboPays.setRawValue(identification.getPays());
                        }
                        
                        telChp.setValue(identification.getTelephoneFixe());
                        faxChp.setValue(identification.getFax());
                        emailChp.setValue(identification.getCourriel());
                        urlChp.setValue(identification.getUrl("WEB"));
                        
                        nbreTotalPersonneStructureChp.setValue(identification.getNbrePersonne());
                        
                        // Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
                        identificationOnglet.setData("acces", true);
                }
        }
        
        private TabItem creerOngletValorisation() {
                valorisationOnglet = creerOnglet("Valorisation", "valorisation");
                valorisationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP));
                Listener<ComponentEvent> ecouteurSelection = new Listener<ComponentEvent>() {  
                        public void handleEvent(ComponentEvent be) {  
                                peuplerStructureValorisation();
                                valorisationOnglet.layout();
                        }  
                };
                valorisationOnglet.addListener(Events.Select, ecouteurSelection);
                
                actionMarkRGrpChp = creerChoixUniqueRadioGroupe("action_mark", "ouiNon");
                actionMarkRGrpChp.setFieldLabel("Avez-vous réalisé des actions de valorisation de vos collections botaniques ou avez-vous été sollicités pour la valorisation de ces collections ?");
                valorisationOnglet.add(actionMarkRGrpChp);
                
                
                actionTrukCp = creerChoixMultipleCp();
                actionTrukCp.hide();
                actionTrukCacGrpChp = new CheckBoxGroup();
                actionTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
                valorisationOnglet.add(actionTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "actionValorisation");
                
                publicationChp = new TextArea();
                publicationChp.setFieldLabel("Quelques titres des ouvrages, articles scientifiques, ...");
                valorisationOnglet.add(publicationChp, new FormData(550, 0));
                
                autreCollectionTrukCp = creerChoixMultipleCp();
                autreCollectionTrukCacGrpChp = new CheckBoxGroup();
                autreCollectionTrukCacGrpChp.setFieldLabel("L'organisme dispose-t-il d'autres collections (permettant une valorisation pluridisciplinaire) ?");
                valorisationOnglet.add(autreCollectionTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "autreCollection");
                
                futureActionMarkRGrpChp = creerChoixUniqueRadioGroupe("future_action_mark", "ouiNon");
                futureActionMarkRGrpChp.setFieldLabel("Envisagez vous des actions de valorisation dans le cadre de votre politique culturelle ?");
                valorisationOnglet.add(futureActionMarkRGrpChp);
                
                futureActionChp = new TextArea();
                futureActionChp.setFieldLabel("Si oui, lesquelles ?");
                futureActionChp.hide();
                futureActionChp.addListener(Events.Hide, new Listener<BaseEvent>() {

                        public void handleEvent(BaseEvent be) {
                                ((TextArea) be.getSource()).setValue("");
                        }
                        
                });
                valorisationOnglet.add(futureActionChp, new FormData(550, 0));
                
                rechercheMarkRGrpChp = creerChoixUniqueRadioGroupe("recherche_mark", "ouiNon");
                rechercheMarkRGrpChp.setFieldLabel("Vos collections botaniques sont-elles utilisées pour des recherches scientifiques ?");
                valorisationOnglet.add(rechercheMarkRGrpChp);
                
                provenanceRechercheTrukCp = creerChoixMultipleCp();
                provenanceRechercheTrukCp.hide();
                provenanceRechercheTrukCacGrpChp = new CheckBoxGroup();
                provenanceRechercheTrukCacGrpChp.setFieldLabel("Si oui, par des chercheurs (professionnels ou amateurs) de quelle provenance ?");
                valorisationOnglet.add(provenanceRechercheTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "continentEtFr");
                
                typeRechercheTrukCp = creerChoixMultipleCp();
                typeRechercheTrukCp.hide();
                typeRechercheTrukCacGrpChp = new CheckBoxGroup();
                typeRechercheTrukCacGrpChp.setFieldLabel("Et pour quelles recherches ?");
                valorisationOnglet.add(typeRechercheTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "typeRecherche");
                
                sansMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("sans_motif_acces_mark", "ouiNon");
                sansMotifAccesMarkRGrpChp.setFieldLabel("Peut-on consulter vos collections botaniques sans motif de recherches scientifiques ?");
                valorisationOnglet.add(sansMotifAccesMarkRGrpChp);
                
                valorisationOnglet.add(sansMotifAccesChp = new TextArea(), new FormData(550, 0));
                sansMotifAccesChp.hide();
                sansMotifAccesChp.addListener(Events.Hide, new Listener<BaseEvent>() {

                        public void handleEvent(BaseEvent be) {
                                ((TextArea) be.getSource()).setValue("");
                        }
                        
                });
                sansMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les consulter ?");
                
                avecMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("avec_motif_acces_mark", "ouiNon");
                avecMotifAccesMarkRGrpChp.setFieldLabel("Peut-on visiter vos collections botaniques avec des objectifs de recherches scientifiques ?");
                valorisationOnglet.add(avecMotifAccesMarkRGrpChp);
                
                valorisationOnglet.add(avecMotifAccesChp = new TextArea(), new FormData(550, 0));
                avecMotifAccesChp.hide();
                avecMotifAccesChp.addListener(Events.Hide, new Listener<BaseEvent>() {

                        public void handleEvent(BaseEvent be) {
                                ((TextArea) be.getSource()).setValue("");
                        }
                        
                });
                avecMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les visiter ?");
                
                return valorisationOnglet;
        }
        
        private TabItem creerOngletConservation() {
                conservationOnglet = creerOnglet("Conservation", "conservation");
                conservationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP));
                Listener<ComponentEvent> ecouteurSelection = new Listener<ComponentEvent>() {  
                        public void handleEvent(ComponentEvent be) {  
                                peuplerStructureConservation();
                                conservationOnglet.layout();
                        }  
                };
                conservationOnglet.addListener(Events.Select, ecouteurSelection);
                
                formationMarkRGrpChp = creerChoixUniqueRadioGroupe("formation_mark", "ouiNon");
                formationMarkRGrpChp.setFieldLabel("Le personnel s'occupant des collections a-t-il suivi des formations en conservations ?");
                conservationOnglet.add(formationMarkRGrpChp);
                
                formationChp = new TextArea();
                formationChp.hide();
                formationChp.addListener(Events.Hide, new Listener<BaseEvent>() {

                        public void handleEvent(BaseEvent be) {
                                ((TextArea) be.getSource()).setValue("");
                        }
                        
                });
                formationChp.setFieldLabel("Si oui, lesquelles ?");
                conservationOnglet.add(formationChp);
                
                interetFormationMarkRGrpChp = creerChoixUniqueRadioGroupe("interet_formation_mark", "ouiNon");
                interetFormationMarkRGrpChp.setFieldLabel("Seriez vous intéressé par une formation à la conservation et à la restauration d'herbier ?");
                conservationOnglet.add(interetFormationMarkRGrpChp);
                
                localStockageTrukCacGrpChp = new CheckBoxGroup();
                localStockageTrukCacGrpChp.setFieldLabel("Avez vous des locaux spécifiques de stockage des collections botaniques ?");
                localStockageTrukCp = creerChoixMultipleCp();
                conservationOnglet.add(localStockageTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "localStockage");
                
                meubleStockageTrukCp = creerChoixMultipleCp();
                meubleStockageTrukCacGrpChp = new CheckBoxGroup();
                meubleStockageTrukCacGrpChp.setFieldLabel("Avez vous des meubles spécifiques au stockage des collections botaniques ?");
                conservationOnglet.add(meubleStockageTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "meubleStockage");
                
                parametreStockageTrukCp = creerChoixMultipleCp();
                parametreStockageTrukCacGrpChp = new CheckBoxGroup();
                parametreStockageTrukCacGrpChp.setFieldLabel("Quels paramètres maîtrisez vous ?");
                conservationOnglet.add(parametreStockageTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "parametreStockage");
                
                collectionCommuneMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_commune_mark", "ouiNon");
                collectionCommuneMarkRGrpChp.setFieldLabel("Les collections botaniques sont-elles conservées avec d'autres collections  dans les mêmes locaux (problème de conservation en commun) ?");
                conservationOnglet.add(collectionCommuneMarkRGrpChp);
                
                collectionAutreTrukCp = creerChoixMultipleCp();
                collectionAutreTrukCacGrpChp = new CheckBoxGroup();
                collectionAutreTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
                collectionAutreTrukCp.hide();
                conservationOnglet.add(collectionAutreTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "autreCollection");
                
                accesControleMarkRGrpChp = creerChoixUniqueRadioGroupe("mark_acces_controle", "ouiNon");
                accesControleMarkRGrpChp.setFieldLabel("L'accès à vos collections botanique est-il contrôlé (ex. : manipulation réservées à des personnes compétentes) ?");
                conservationOnglet.add(accesControleMarkRGrpChp);
                
                restaurationMarkRGrpChp = creerChoixUniqueRadioGroupe("restauration_mark", "ouiNon");
                restaurationMarkRGrpChp.setFieldLabel("Effectuez vous des opérations de restauration ou de remise en état de vos collections botaniques ?");
                conservationOnglet.add(restaurationMarkRGrpChp);
                
                opRestauTrukCp = creerChoixMultipleCp();
                opRestauTrukCacGrpChp = new CheckBoxGroup();
                opRestauTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
                opRestauTrukCp.hide();
                conservationOnglet.add(opRestauTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "opRestau");
                
                // Création d'un ContentPanel vide et du groupe de bouton radio
                // Le groupe de bouton radio recevra les boutons au moment de la réception des données (rafraichir()) et ser à ce moment là ajouter au ContenetPanel
                materielConservationCp = creerChoixMultipleCp();
                conservationOnglet.add(materielConservationCp);
                materielConservationCeRGrpChp = creerChoixUniqueRadioGroupe("materiel_conservation_ce", "onep");
                materielConservationCeRGrpChp.setFieldLabel("Utilisez vous du matériel de conservation ?");
                materielConservationCeRGrpChp.setToolTip(new ToolTipConfig("Matériel de conservation", "matériel spécialisé pour la conservation des archives ou du patrimoine fragile. Ce matériel possède des propriétés mécaniques et chimiques qui font qu'il résiste dans le temps et que sa dégradation n'entraîne pas de dommages sur le matériel qu'il aide à conserver. Exemples : papier neutre, papier gommé, etc..."));
                mediateur.obtenirListeValeurEtRafraichir(this, "onep");
                
                autreMaterielTrukCp = creerChoixMultipleCp();
                autreMaterielTrukCacGrpChp = new CheckBoxGroup();
                autreMaterielTrukCacGrpChp.setFieldLabel("Si non, qu'utilisez vous comme matériel ?");
                autreMaterielTrukCp.hide();
                conservationOnglet.add(autreMaterielTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "autreMateriel");
                
                traitementMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_mark", "ouiNon");
                traitementMarkRGrpChp.setFieldLabel("Réalisez vous actuellement des traitements globaux contre les insectes ?");
                conservationOnglet.add(traitementMarkRGrpChp);
                
                traitementTrukCp = creerChoixMultipleCp();
                traitementTrukCp.hide();
                traitementTrukCacGrpChp = new CheckBoxGroup();
                traitementTrukCacGrpChp.setFieldLabel("Si oui, lesquels ?");
                conservationOnglet.add(traitementTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "insecteTraitement");
                
                collectionAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_acquisition_mark", "ouiNon");
                collectionAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, vos collections botaniques s'accroissent-elles de nouvelles acquisitions ?");
                conservationOnglet.add(collectionAcquisitionMarkRGrpChp);
                
                echantillonAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("echantillon_acquisition_mark", "ouiNon");
                echantillonAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, mettez vous en herbier de nouveaux échantillons ?");
                conservationOnglet.add(echantillonAcquisitionMarkRGrpChp);

                traitementAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_acquisition_mark", "ouiNon");
                traitementAcquisitionMarkRGrpChp.hide();
                traitementAcquisitionMarkRGrpChp.setFieldLabel("Si oui, faites-vous un traitement contre les insectes avant l'intégration dans vos collections ?");
                conservationOnglet.add(traitementAcquisitionMarkRGrpChp);
                
                traitementAcquisitionMarkLabel = new LabelField();
                traitementAcquisitionMarkLabel.hide();
                traitementAcquisitionMarkLabel.setFieldLabel("Si oui, lesquels ?");
                conservationOnglet.add(traitementAcquisitionMarkLabel);
                
                poisonTraitementTrukCp = creerChoixMultipleCp();
                poisonTraitementTrukCp.hide();
                poisonTraitementTrukCacGrpChp = new CheckBoxGroup();
                poisonTraitementTrukCacGrpChp.setFieldLabel("Empoisonnement");
                poisonTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
                poisonTraitementTrukCacGrpChp.setLabelSeparator("");
                conservationOnglet.add(poisonTraitementTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "poisonTraitement");
                
                insecteTraitementTrukCp = creerChoixMultipleCp();
                insecteTraitementTrukCp.hide();
                insecteTraitementTrukCacGrpChp = new CheckBoxGroup();
                insecteTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
                insecteTraitementTrukCacGrpChp.setLabelSeparator("");
                insecteTraitementTrukCacGrpChp.setFieldLabel("Désinsectisation");
                conservationOnglet.add(insecteTraitementTrukCp);
                mediateur.obtenirListeValeurEtRafraichir(this, "insecteTraitement");
                
                conservationOnglet.add(new Html("<br />"));
                return conservationOnglet;
        }
        
        private void collecterStructurePersonnel() {
                if (personnelOnglet.getData("acces").equals(true)) {
                        personnelGrilleMagazin.commitChanges();
                        int nbrePersonne = personnelGrilleMagazin.getCount();
                        for (int i = 0; i < nbrePersonne; i++) {
                                StructureAPersonne personne = personnelGrilleMagazin.getAt(i);

                                // Seules les lignes ajoutées ou modifiées sont prises en compte.
                                Record record = personnelGrilleMagazin.getRecord(personne);
                                if (personnelGrilleMagazin.getModifiedRecords().contains(record) == true 
                                                || (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE) )) {
                                        
                                        // Gestion de l'id de la structure
                                        if (mode.equals("MODIF")) {
                                                personne.setIdStructure(identification.getId());
                                        }
                                        
                                        // Récupération de l'id du projet de la structure qui servira aussi pour les Personnes crées dans ce formulaire
                                        if (personne.getIdPersonne().equals("") && projetsCombo.getValue() != null) {
                                                personne.setIdProjetPersonne(projetsCombo.getValue().getId());
                                        }
                                        
                                        // Gestion de la fonction
                                        String fonction = personne.get("fonction");
                                        if (fonction != null && !fonction.equals("")) {
                                                Valeur valeurRecherche = fonctionsCombo.getStore().findModel("nom", fonction);
                                                if (valeurRecherche != null) {
                                                        personne.setFonction(valeurRecherche.getId());
                                                } else {
                                                        personne.setFonction("AUTRE", fonction);
                                                }
                                        } else {
                                                personne.setFonction("");
                                        }
                                        
                                        // Gestion de la notion de "contact"
                                        personne.setContact(false);
                                        if (personne.get("contact").equals(true)) {
                                                personne.setContact(true);
                                        }
                                        
                                        // Gestion du statut
                                        String statut = personne.get("statut");
                                        if (statut != null && !statut.equals("")) {
                                                Valeur valeurRecherche = comboLiStatut.getStore().findModel("nom", statut);
                                                if (valeurRecherche != null) {
                                                        personne.setStatut(valeurRecherche.getId());
                                                } else {
                                                        personne.setStatut("AUTRE", statut);
                                                }
                                        } else {
                                                personne.setStatut("");
                                        }
                                        
                                        // Gestion du temps de travail
                                        personne.setBotaTravailHebdoTps(personne.get("travail").toString());
                                        
                                        // Gestion du téléphone
                                        String telephoneFixe = personne.get("tel_fix");
                                        personne.setTelephoneFixe(telephoneFixe);
                                        
                                        // Gestion du fax
                                        String fax = personne.get("tel_fax");
                                        personne.setFax(fax);
                                                                        
                                        // Gestion du courriel
                                        String courriel = personne.get("courriel");
                                        personne.setCourriel(courriel);
                                        
                                        // Gestion de la spécialité
                                        String specialite = personne.get("specialite");
                                        personne.setSpecialite(specialite);
                                        
                                        // Ajout de la personne dans la liste correspondant à son état (ajouté ou modifié)
                                        if (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE)) {// Une personne ajoutée
                                                personnelAjoute.put(""+i, personne);
                                        } else {// Une personne modifiée
                                                personnelModifie.put(personne.getId(), personne);
                                        }
                                } else {
                                        GWT.log("Personne non modifiées : "+personne.getPrenom()+" "+personne.getNom(), null);
                                }
                        }
                }
        }
        
        private void peuplerStructurePersonnel() {
                if (mode.equals(MODE_MODIFIER) && personnel != null) {
                        ArrayList<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
                        for (Iterator<String> it = personnel.keySet().iterator(); it.hasNext();) {
                                String index = it.next();
                                
                                // Gestion de la fonction
                                if (fonctionsMagazin != null && !((String) personnel.get(index).getFonction()).startsWith("AUTRE##")) {
                                        if (fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()) != null) {
                                                personnel.get(index).set("fonction", fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()).getNom());
                                        }
                                } else {
                                        personnel.get(index).set("fonction", personnel.get(index).getFonction().replaceFirst("AUTRE##", ""));
                                }
                                
                                // Gestion de la notion de "contact"
                                personnel.get(index).set("contact", (personnel.get(index).getContact().equals("1") ? true : false));
                                
                                // Gestion du statut
                                if (magazinLiStatut != null && ((String) personnel.get(index).getStatut()).matches("^[0-9]+$")) {
                                        personnel.get(index).set("statut", magazinLiStatut.findModel("id_valeur", personnel.get(index).getStatut()).getNom());
                                } else {
                                        personnel.get(index).set("statut", personnel.get(index).getStatut().replaceFirst("AUTRE##", ""));
                                }
                                
                                // Gestion du temps de travail
                                String tps = personnel.get(index).getBotaTravailHebdoTps();
                                personnel.get(index).set("travail", (tps.matches("^[0-9]+$")  ? Integer.parseInt(tps) : 0));
                                
                                personnes.add(personnel.get(index));
                        }
                        personnelGrilleMagazin.removeAll();
                        personnelGrilleMagazin.add(personnes);
                        
                        // Nous vidons la variable personnel une fois qu'elle a remplie la grille
                        personnel = null;
                }
        }
        
        private TabItem creerOngletPersonnel() {
                // Création des objets contenant les manipulations de la grille
                personnelModifie = new StructureAPersonneListe();
                personnelAjoute = new StructureAPersonneListe();
                personnelSupprime = new StructureAPersonneListe();
                
                personnelOnglet = creerOnglet("Personnel", "personnel");
                personnelOnglet.setLayout(creerFormLayout(400, LabelAlign.LEFT));
                personnelOnglet.setStyleAttribute("padding", "0");
                personnelOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
                        public void handleEvent(ComponentEvent be) {  
                                // Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
                                personnelOnglet.setData("acces", true);

                                // Rafraichissement du contenu de la grille du personnel
                                if (mode.equals(MODE_AJOUTER)) {
                                        rafraichirPersonnel();
                                }
                        }
                });
                
                ContentPanel cp = new ContentPanel();
                cp.setHeading("Personnes travaillant sur les collections");
                cp.setIcon(Images.ICONES.table());
                //cp.setScrollMode(Scroll.AUTO);
                cp.setLayout(new FitLayout());
                //cp.setWidth(1250);
                //cp.setHeight("100%");
                cp.setFrame(true);
                
                personnelGrilleMagazin = new ListStore<StructureAPersonne>();
                personnelGrilleMagazin.addListener(Store.Add, new Listener<StoreEvent<StructureAPersonne>>() {

                        public void handleEvent(StoreEvent<StructureAPersonne> ce) {
                                // Activation du bouton supprimer si la grille contient un élément
                                if (grillePersonnel.getStore().getCount() > 0) {  
                                        supprimerPersonnelBtn.enable();
                                }
                                
                        }
                });
                
                RowNumberer r = new RowNumberer();
                
                List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

                GridSelectionModel<StructureAPersonne> sm = new GridSelectionModel<StructureAPersonne>();
                configs.add(r);
                
                ColumnConfig column = new ColumnConfig("fonction", "Fonction", 150);
                fonctionsMagazin = new ListStore<Valeur>();
                
                fonctionsCombo = new ComboBox<Valeur>();  
                fonctionsCombo.setTriggerAction(TriggerAction.ALL);  
                fonctionsCombo.setEditable(true);
                fonctionsCombo.setDisplayField("nom");
                fonctionsCombo.setStore(fonctionsMagazin);
                mediateur.obtenirListeValeurEtRafraichir(this, "fonction");
                
                fonctionEditor = new CellEditor(fonctionsCombo) {  
                        @Override  
                        public Object preProcessValue(Object valeur) {  
                                Valeur retour = null;
                                
                                if (valeur != null) {
                                        String chaineTransmise = (String) valeur;
                                        if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
                                                fonctionsMagazin.add(fonctionsListe);
                                        }
                                        if (fonctionsMagazin.findModel("id_valeur", chaineTransmise) != null) {
                                                retour = fonctionsMagazin.findModel("id_valeur", chaineTransmise);
                                        } else if (fonctionsMagazin.findModel("nom", chaineTransmise) != null) {
                                                retour = fonctionsMagazin.findModel("nom", chaineTransmise);
                                        } else {
                                                retour = new Valeur("", chaineTransmise, "", "");
                                        }
                                }
                                
                                return retour;
                        }  
                        
                        @Override  
                        public Object postProcessValue(Object valeur) {  
                                String retour = "";
                                Valeur fonctionTrouvee = null; 
                                if (valeur == null) {
                                        String valeurBrute = this.getField().getRawValue();
                                        if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
                                                fonctionsMagazin.add(fonctionsListe);
                                        }
                                        if (valeurBrute.matches("^[0-9]+$") && fonctionsMagazin.findModel("id_valeur", valeurBrute) != null) {
                                                fonctionTrouvee = fonctionsMagazin.findModel("id_valeur", valeurBrute);
                                        } else {
                                                retour = valeurBrute;
                                        }
                                } else if (valeur instanceof Valeur) {
                                        fonctionTrouvee = (Valeur) valeur;
                                }
                                
                                if (fonctionTrouvee != null) {
                                        retour = fonctionTrouvee.getNom();
                                }
                                
                                return retour;                          
                        }
                };
                column.setEditor(fonctionEditor);
                configs.add(column);
                
                column = new ColumnConfig("prenom", "Prénom", 100);  
                TextField<String> prenomChp = new TextField<String>();  
                prenomChp.setAllowBlank(false);
                prenomChp.getMessages().setBlankText("Ce champ est obligatoire.");
                prenomChp.setAutoValidate(true);
                prenomChp.addStyleName(ComposantClass.OBLIGATOIRE);
                prenomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
                column.setEditor(new CellEditor(prenomChp));
                configs.add(column);  
                
                column = new ColumnConfig("nom", "Nom", 100);
                TextField<String> nomChp = new TextField<String>();  
                nomChp.setAllowBlank(false);
                nomChp.getMessages().setBlankText("Ce champ est obligatoire.");
                nomChp.setAutoValidate(true);
                nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
                nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
                column.setEditor(new CellEditor(nomChp));
                configs.add(column);  

                column = new ColumnConfig("tel_fix", "Téléphone fixe", 100);
                TextField<String> telChp = new TextField<String>();  
                column.setEditor(new CellEditor(telChp));
                configs.add(column);

                column = new ColumnConfig("tel_fax", "Fax", 100);
                TextField<String> faxChp = new TextField<String>();  
                column.setEditor(new CellEditor(faxChp));
                configs.add(column);
                
                column = new ColumnConfig("courriel", "Courriel principal", 200);
                TextField<String> emailChp = new TextField<String>();  
                column.setEditor(new CellEditor(emailChp));
                configs.add(column);
                
                magazinLiStatut = new ListStore<Valeur>();
                magazinLiStatut.add(new ArrayList<Valeur>());
                
                comboLiStatut = new ComboBox<Valeur>();  
                comboLiStatut.setTriggerAction(TriggerAction.ALL);  
                comboLiStatut.setEditable(false);
                comboLiStatut.disableTextSelection(true);
                comboLiStatut.setDisplayField("nom");
                comboLiStatut.setStore(magazinLiStatut);
                mediateur.obtenirListeValeurEtRafraichir(this, "statut");
                
                CellEditor statutEditor = new CellEditor(comboLiStatut) {  
                        @Override  
                        public Object preProcessValue(Object value) {  
                                if (value == null) {  
                                        return value;  
                                }
                                return comboLiStatut.getStore().findModel("nom", (String) value);  
                        }  
                        
                        @Override  
                        public Object postProcessValue(Object value) {  
                                if (value == null) {  
                                        return value;  
                                }
                                return ((Valeur) value).get("nom");  
                        }  
                };
                column = new ColumnConfig("statut", "Statut", 100);
                column.setEditor(statutEditor);
                configs.add(column);
                
                column = new ColumnConfig("travail", "Temps travail", 100);
                column.setNumberFormat(NumberFormat.getFormat("##"));
                NumberField tpsWChp = new NumberField();
                tpsWChp.setFormat(NumberFormat.getFormat("##"));
                tpsWChp.setToolTip("Ce champ doit contenir un nombre");
                column.setEditor(new CellEditor(tpsWChp));
                configs.add(column);
                
                column = new ColumnConfig("specialite", "Spécialité principale", 150);
                TextField<String> speChp = new TextField<String>();  
                column.setEditor(new CellEditor(speChp));
                configs.add(column);
                
                CheckColumnConfig checkColumn = new CheckColumnConfig("contact", "Contact ?", 60);
                configs.add(checkColumn);
                
                ToolBar toolBar = new ToolBar();  
                
                Button ajouterPersonnelBtn = new Button("Ajouter");
                ajouterPersonnelBtn.setIcon(Images.ICONES.vcardAjouter());
                ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {  
                        @Override  
                        public void componentSelected(ButtonEvent ce) {  
                                StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
                                ajouterMembreAGrillePersonnel(membreDuPersonnel);
                        }  
                });
                toolBar.add(ajouterPersonnelBtn);
                
                toolBar.add(new SeparatorToolItem());
                
                supprimerPersonnelBtn = new Button("Supprimer");
                supprimerPersonnelBtn.setIcon(Images.ICONES.vcardSupprimer());
                supprimerPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {  
                        @Override
                        public void componentSelected(ButtonEvent ce) {
                                StructureAPersonne personne = grillePersonnel.getSelectionModel().getSelectedItem();
                                if (personne != null) {
                                        // Ajout de la personne supprimée à la liste
                                        if (personne.getIdPersonne() != null && !personne.getIdPersonne().equals("")) {
                                                personnelSupprime.put(personne.getId(), personne);
                                        }
        
                                        // Suppression de l'enregistrement de la grille
                                        grillePersonnel.getStore().remove(personne);
                                        
                                        // Désactivation du bouton supprimer si la grille contient plus d'élément
                                        if (grillePersonnel.getStore().getCount() == 0) {  
                                                //TODO : check : Item -> component
                                                ce.getComponent().disable();  
                                        }
                                }
                        }   
                });
                toolBar.add(supprimerPersonnelBtn);
                
                toolBar.add(new SeparatorToolItem());
                
                Button rafraichirPersonnelBtn = new Button("Rafraichir");
                rafraichirPersonnelBtn.setIcon(Images.ICONES.rafraichir());
                rafraichirPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {  
                        @Override
                        public void componentSelected(ButtonEvent ce) {
                                rafraichirPersonnel();
                        }   
                });
                toolBar.add(rafraichirPersonnelBtn);
                
                toolBar.add(new SeparatorToolItem());
                
                personneExistanteMagazin = new ListStore<Personne>();
                personneExistanteMagazin.add(new ArrayList<Personne>());
                
                personneExistanteCombo = new ComboBox<Personne>();
                personneExistanteCombo.setWidth(200);
                personneExistanteCombo.setEmptyText("Chercher une personne existante...");
                personneExistanteCombo.setTriggerAction(TriggerAction.ALL);  
                personneExistanteCombo.setEditable(true);
                personneExistanteCombo.setDisplayField("fmt_nom_complet");
                personneExistanteCombo.setStore(personneExistanteMagazin);
                personneExistanteCombo.addKeyListener(new KeyListener() {
                        
                        public void componentKeyUp(ComponentEvent ce) {
                                if (!ce.isNavKeyPress() && personneExistanteCombo.getRawValue() != null && personneExistanteCombo.getRawValue().length() > 0) {
                                        rafraichirPersonneExistante(personneExistanteCombo.getRawValue());
                                }
                        }
                        
                });

                // TODO : dans GXT 2.0 plus besoin de l'adaptateur, on peut ajouter la combobox directement sur la toolbar
                        //> CHECK
                toolBar.add(personneExistanteCombo);
                
                Button ajouterPersonneExistanteBtn = new Button("Ajouter");
                ajouterPersonneExistanteBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {  
                        @Override  
                        public void componentSelected(ButtonEvent ce) {  
                                Personne personneExistante = personneExistanteCombo.getValue();
                                
                                if (personneExistante != null) {
                                        StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
                                        membreDuPersonnel.setIdPersonne(personneExistante.getId());
                                        membreDuPersonnel.setIdProjetPersonne(personneExistante.getIdProjet());
                                        membreDuPersonnel.setNom(personneExistante.getNom());
                                        membreDuPersonnel.setPrenom(personneExistante.getPrenom());
                                        membreDuPersonnel.setTelephone(personneExistante.getTelephone());
                                        membreDuPersonnel.setCourriel(personneExistante.selectionnerCourriel(1));
                                        membreDuPersonnel.setSpecialite(personneExistante.afficherSpecialite());
                                        
                                        ajouterMembreAGrillePersonnel(membreDuPersonnel);
                                }
                        }  
                });
                toolBar.add(ajouterPersonneExistanteBtn);
                
                cp.setTopComponent(toolBar);  

                ColumnModel cm = new ColumnModel(configs);
                
                grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
                grillePersonnel.setHeight("100%");
                grillePersonnel.setBorders(true);
                grillePersonnel.setSelectionModel(sm);
                grillePersonnel.addPlugin(checkColumn);
                grillePersonnel.addPlugin(r);
                grillePersonnel.getView().setForceFit(true);
                grillePersonnel.setAutoExpandColumn("specialite");
                grillePersonnel.setStripeRows(true);
                grillePersonnel.setTrackMouseOver(true);
                cp.add(grillePersonnel);
                personnelOnglet.add(cp);
                
                return personnelOnglet;
        }
        
        private TabItem creerOngletIdentification() {
                //+-----------------------------------------------------------------------------------------------------------+
                // Onlget formulaire IDENTIFICATION
                identificationOnglet = creerOnglet("Identification", "identification");
                identificationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
                        public void handleEvent(ComponentEvent be) {  
                                peuplerStructureIdentification();
                                identificationOnglet.layout();
                        }  
                });
                
                //+-----------------------------------------------------------------------------------------------------------+
                // Champs cachés
                idStructureChp = new HiddenField<String>();
                
                //+-----------------------------------------------------------------------------------------------------------+
                // Fieldset IDENTITÉ
                FieldSet fieldSetIdentite = new FieldSet();
                fieldSetIdentite.setHeading("Identité");
                fieldSetIdentite.setCollapsible(true);
                fieldSetIdentite.setLayout(creerFormLayout(120, LabelAlign.LEFT));
                
                nomStructureChp = new TextField<String>();
                nomStructureChp.setTabIndex(tabIndex++);
                nomStructureChp.setFieldLabel("Nom de la structure");
                nomStructureChp.setAllowBlank(false);
                nomStructureChp.getMessages().setBlankText("Ce champ est obligatoire.");
                nomStructureChp.addStyleName(ComposantClass.OBLIGATOIRE);
                nomStructureChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
                fieldSetIdentite.add(nomStructureChp, new FormData(450, 0));
                
                
                projetsMagazin = new ListStore<Projet>();
                mediateur.selectionnerProjet(this, null);
                projetsCombo = new ComboBox<Projet>();
                projetsCombo.setTabIndex(tabIndex++);
                projetsCombo.setFieldLabel("Projet");
                projetsCombo.setLabelSeparator("");
                projetsCombo.setDisplayField("nom");
                projetsCombo.setEditable(false);
                projetsCombo.setTriggerAction(TriggerAction.ALL);
                projetsCombo.setStore(projetsMagazin);
                projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
                projetsCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
                fieldSetIdentite.add(projetsCombo, new FormData(450, 0));
                
                // Création du sous-formulaire : Acronyme
                LayoutContainer ligne = new LayoutContainer();  
                ligne.setLayout(new ColumnLayout());
                ligne.setSize(600, -1);
                
                LayoutContainer gauche = new LayoutContainer();
                gauche.setLayout(creerFormLayout(120, LabelAlign.LEFT));
                LayoutContainer droite = new LayoutContainer();
                droite.setLayout(creerFormLayout(10, LabelAlign.LEFT));
                
                ListStore<InterneValeur> acronymes = new ListStore<InterneValeur>();  
                acronymes.add(InterneValeurListe.getTypeAcronyme()); 
                
                comboAcronyme = new ComboBox<InterneValeur>();
                comboAcronyme.setTabIndex(tabIndex++);
                comboAcronyme.setEmptyText("Sélectioner un type d'acronyme...");
                comboAcronyme.setFieldLabel("Type d'acronyme");
                comboAcronyme.setDisplayField("nom");
                comboAcronyme.setStore(acronymes);
                comboAcronyme.setEditable(false);
                comboAcronyme.setTypeAhead(true);  
                comboAcronyme.setTriggerAction(TriggerAction.ALL);
                comboAcronyme.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
                        @Override
                        public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
                                String acronymeAbr = se.getSelectedItem().getAbr();
                                if (acronymeAbr.equals("IH")) {
                                        mnhnChp.hide();
                                        ihChp.show();
                                } else if (acronymeAbr.equals("MNHN")) {
                                        ihChp.hide();
                                        mnhnChp.show();
                                } else if (acronymeAbr.equals("")) {
                                        ihChp.hide();
                                        mnhnChp.hide();
                                        comboAcronyme.clearSelections();
                                }
                        }
        });
                gauche.add(comboAcronyme, new FormData("95%"));
                
                ihChp = new TextField<String>();  
                ihChp.setTabIndex(tabIndex++);
                ihChp.setLabelSeparator("");
                ihChp.setToolTip("Index Herbariorum : herbier de plus de 5000 échantillons");
                ihChp.hide();
                droite.add(ihChp, new FormData("95%"));
                
                mnhnChp = new TextField<String>();
                mnhnChp.setTabIndex(tabIndex++);
                mnhnChp.setLabelSeparator("");
                mnhnChp.setToolTip("Acronyme MNHN : herbier de moins de 5000 échantillons");
                mnhnChp.hide();
                droite.add(mnhnChp, new FormData("95%"));
                
                ligne.add(gauche, new ColumnData(.5));  
                ligne.add(droite, new ColumnData(.5));
                fieldSetIdentite.add(ligne);
                
                // Création du sous-formulaire : Type de Structure
                LayoutContainer ligneTs = new LayoutContainer();  
                ligneTs.setLayout(new ColumnLayout());
                ligneTs.setSize(600, -1);
                
                LayoutContainer gaucheTs = new LayoutContainer();
                gaucheTs.setLayout(creerFormLayout(120, LabelAlign.LEFT));
                
                LayoutContainer droiteTs = new LayoutContainer();
                droiteTs.setLayout(creerFormLayout(10, LabelAlign.LEFT));
                
                ListStore<InterneValeur> typesStructure = new ListStore<InterneValeur>();  
                typesStructure.add(InterneValeurListe.getTypeStructure());
                
                comboTypeStructure = new ComboBox<InterneValeur>();
                comboTypeStructure.setTabIndex(tabIndex++);
                comboTypeStructure.setEmptyText("Sélectioner un type de structure...");
                comboTypeStructure.setFieldLabel("Statut des structures");
                comboTypeStructure.setDisplayField("nom");
                comboTypeStructure.setStore(typesStructure);
                comboTypeStructure.setEditable(false);
                comboTypeStructure.setTypeAhead(true);  
                comboTypeStructure.setTriggerAction(TriggerAction.ALL);
                comboTypeStructure.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
                        @Override
                        public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
                                String typeAbr = se.getSelectedItem().getAbr();
                                if (typeAbr.equals("stpu")) {
                                        comboLstpr.hide();
                                        comboLstpu.show();
                                } else if (typeAbr.equals("stpr")) {
                                        comboLstpu.hide();
                                        comboLstpr.show();
                                } else if (typeAbr.equals("")) {
                                        comboLstpr.hide();
                                        comboLstpu.hide();
                                        comboTypeStructure.clearSelections();
                                }
                        }
        });
                gaucheTs.add(comboTypeStructure, new FormData("95%"));
                
                magazinLstpu = new ListStore<Valeur>();
                comboLstpu = new ComboBox<Valeur>();
                comboLstpu.setTabIndex(tabIndex++);
                //comboLstpu.setFieldLabel("Statut des structures publiques");
                comboLstpu.setLabelSeparator("");
                comboLstpu.setDisplayField("nom");
                comboLstpu.setEditable(false);
                comboLstpu.setTriggerAction(TriggerAction.ALL);
                comboLstpu.setStore(magazinLstpu);
                comboLstpu.hide();
                droiteTs.add(comboLstpu, new FormData("95%"));
                mediateur.obtenirListeValeurEtRafraichir(this, "stpu");
                
                magazinLstpr = new ListStore<Valeur>();
                comboLstpr = new ComboBox<Valeur>();
                comboLstpr.setTabIndex(tabIndex++);
                //comboLstpr.setFieldLabel("Statut des structures privées");
                comboLstpr.setLabelSeparator("");
                comboLstpr.setDisplayField("nom");
                comboLstpr.setEditable(false);
                comboLstpr.setTriggerAction(TriggerAction.ALL);
                comboLstpr.setStore(magazinLstpr);
                comboLstpr.hide();
                droiteTs.add(comboLstpr, new FormData("95%"));
                mediateur.obtenirListeValeurEtRafraichir(this, "stpr");
                
                ligneTs.add(gaucheTs, new ColumnData(0.5));  
                ligneTs.add(droiteTs, new ColumnData(0.5));
                fieldSetIdentite.add(ligneTs);
                
                dateFondationChp = new DateField();
                dateFondationChp.setTabIndex(tabIndex++);
                dateFondationChp.setFieldLabel("Date de fondation");
                dateFondationChp.getPropertyEditor().getFormat();
                dateFondationChp.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
                dateFondationChp.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
                fieldSetIdentite.add(dateFondationChp);
                
                nbreTotalPersonneStructureChp = new NumberField(); 
                nbreTotalPersonneStructureChp.setFieldLabel("Nombre de personne travaillant dans l'institution");
                nbreTotalPersonneStructureChp.setFormat(NumberFormat.getFormat("#"));
                nbreTotalPersonneStructureChp.setToolTip(i18nC.champNumerique());
                fieldSetIdentite.add(nbreTotalPersonneStructureChp);

                identificationOnglet.add(fieldSetIdentite);
                
                //+-----------------------------------------------------------------------------------------------------------+         
                // Fieldset ADRESSE
                LayoutContainer principalFdAdresse = new LayoutContainer();  
                principalFdAdresse.setLayout(new ColumnLayout());
                principalFdAdresse.setSize(600, -1);
                
                LayoutContainer gaucheFdAdresse = new LayoutContainer();
                gaucheFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
                
                LayoutContainer droiteFdAdresse = new LayoutContainer();
                droiteFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
                
                FieldSet fieldSetAdresse = new FieldSet();
                fieldSetAdresse.setHeading("Adresse");
                fieldSetAdresse.setCollapsible(true);
                
                fieldSetAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
                
                adrChp = new TextArea();
                adrChp.setTabIndex(tabIndex++);
                adrChp.setFieldLabel("Adresse");
                fieldSetAdresse.add(adrChp, new FormData(550, 0));
                
                cpChp = new TextField<String>();
                cpChp.setTabIndex(tabIndex++);
                cpChp.setFieldLabel("Code postal");
                gaucheFdAdresse.add(cpChp, new FormData("95%"));
                
                villeChp = new TextField<String>();
                villeChp.setTabIndex(tabIndex++);
                villeChp.setFieldLabel("Ville");
                gaucheFdAdresse.add(villeChp, new FormData("95%"));
                
                magazinPays = new ListStore<Valeur>(); 
                comboPays = new ComboBox<Valeur>();
                comboPays.setTabIndex(tabIndex++);
                comboPays.setFieldLabel("Pays");
                comboPays.setEmptyText("Sélectionner un pays...");
                comboPays.setEditable(true);
                comboPays.setLabelSeparator("");
                comboPays.setDisplayField("nom");
                comboPays.setTemplate(getTemplatePays());
                comboPays.setTypeAhead(true);
                comboPays.setTriggerAction(TriggerAction.ALL);
                comboPays.setStore(magazinPays);
                
                SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
                        public void selectionChanged(SelectionChangedEvent se) {
                                // Rafraichir avec le pays sélectionné
                                obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
                        }
                };
                
                comboPays.addSelectionChangedListener(selectionChange);
                
                
                droiteFdAdresse.add(comboPays, new FormData("95%"));
                mediateur.obtenirListeValeurEtRafraichir(this, "pays");
                
                magazinRegion = new ListStore<Valeur>();
                comboRegion = new ComboBox<Valeur>();
                comboRegion.setTabIndex(tabIndex++);
                comboRegion.setFieldLabel("Région");
                comboRegion.setEmptyText("Sélectionner une région...");
                comboRegion.setDisplayField("nom");
                comboRegion.setTypeAhead(true);
                comboRegion.setTriggerAction(TriggerAction.ALL);
                comboRegion.setStore(magazinRegion);
                
                droiteFdAdresse.add(comboRegion, new FormData("95%"));
                
                
                principalFdAdresse.add(gaucheFdAdresse, new ColumnData(.5));
                principalFdAdresse.add(droiteFdAdresse, new ColumnData(.5));
                fieldSetAdresse.add(principalFdAdresse);
                
                identificationOnglet.add(fieldSetAdresse);
                
                //+-----------------------------------------------------------------------------------------------------------+
                // Fieldset TÉLÉPHONE et EMAIL
                LayoutContainer principalFdTelMail = new LayoutContainer();  
                principalFdTelMail.setLayout(new ColumnLayout());
                principalFdTelMail.setSize(700, -1);
                
                LayoutContainer gaucheFdTelMail = new LayoutContainer();
                gaucheFdTelMail.setLayout(creerFormLayout(60, LabelAlign.LEFT));
                
                LayoutContainer droiteFdTelMail = new LayoutContainer();
                droiteFdTelMail.setLayout(creerFormLayout(60, LabelAlign.LEFT));
                
                FieldSet fieldSetTelMail = new FieldSet();
                fieldSetTelMail.setHeading("Communication");
                fieldSetTelMail.setCollapsible(true);
                
                fieldSetTelMail.setLayout(creerFormLayout(null, LabelAlign.LEFT));
                                
                telChp = new TextField<String>();
                telChp.setTabIndex(tabIndex++);
                telChp.setFieldLabel("Téléphone fixe");
                gaucheFdTelMail.add(telChp, new FormData("95%"));
                
                faxChp = new TextField<String>();
                faxChp.setTabIndex(tabIndex++);
                faxChp.setFieldLabel("Fax");
                droiteFdTelMail.add(faxChp, new FormData("95%"));
                
                emailChp = new TextField<String>();
                emailChp.setTabIndex(tabIndex++);
                emailChp.setFieldLabel("Courriel");
                emailChp.setToolTip("Saisir le courriel de l'organisation, pas de courriel individuel. Ex. : accueil@organisation.org");
                gaucheFdTelMail.add(emailChp, new FormData("95%"));
                
                urlChp = new TextField<String>();
                urlChp.setTabIndex(tabIndex++);
                urlChp.setFieldLabel("Site web");
                droiteFdTelMail.add(urlChp, new FormData("95%"));
                
                principalFdTelMail.add(gaucheFdTelMail, new ColumnData(.5));
                principalFdTelMail.add(droiteFdTelMail, new ColumnData(.5));
                fieldSetTelMail.add(principalFdTelMail);
                
                identificationOnglet.add(fieldSetTelMail);
                
                return identificationOnglet;
        }
        
        public void obtenirListeRegionParPays(String strPays)   {
                mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
        }
        
        private void mettreAJourRegion()        {
                //Met à jour la combo box en sélectionnant la valeur enregistrée pour la personne
                if (identification.get("ce_truk_region") != null && comboRegion.getStore().getCount() > 0)      {
                        Valeur valeurRegion = comboRegion.getStore().findModel("id_valeur", identification.get("ce_truk_region"));
                        if (valeurRegion!=null) {
                                comboRegion.setValue(valeurRegion);
                        } else if (identification.get("ce_truk_region").toString().startsWith("AUTRE##")) {
                                comboRegion.setRawValue(identification.get("ce_truk_region").toString().replaceFirst("^AUTRE##", ""));
                        }
                }
        }
        
        private native String getTemplatePays() /*-{ 
                return  [ 
                '<tpl for=".">', 
                '<div class="x-combo-list-item">{nom} ({abreviation})</div>', 
                '</tpl>' 
                ].join(""); 
                }-*/;
        
        private void peuplerCasesACocher(String donnees, CheckBoxGroup groupeCac, TextField<String> champAutre) {
                String[] valeurs = donnees.split(";;");
                for (int i = 0; i < valeurs.length; i++) {
                        if (valeurs[i].startsWith("AUTRE##")) {
                                champAutre.setValue(valeurs[i].replaceFirst("^AUTRE##", ""));
                        } else {
                                //TODO : check : List<CheckBox> cases = groupeCac.getAll();
                                List<Field<?>> cases = groupeCac.getAll();
                                for (int j = 0; j < cases.size(); j++) {
                                        if (cases.get(j).getId().equals("val-"+valeurs[i])) {
                                                ((CheckBox) cases.get(j)).setValue(true);
                                        }
                                }
                        }
                }
        }
        
        private void peuplerBoutonsRadio(String valeur, RadioGroup groupeBr) {
                //List<Radio> boutons = groupeBr.getAll();
                List<Field<?>> boutons = groupeBr.getAll();
                String id = valeur+"_"+groupeBr.getName().replace("_grp", "");
                for (int i = 0; i < boutons.size(); i++) {
                        if (boutons.get(i).getId().equals(id)) {
                                ((Radio) boutons.get(i)).setValue(true);
                        }
                }
        }
        
        private String creerChaineDenormalisee(List<CheckBox> liste) {
                String identifiants = "";
                if (liste != null) {
                        int taille = liste.size();
                        for (int i = 0; i < taille; i++) {
                                CheckBox cac = liste.get(i);
                                if (cac.isEnabled()) {
                                        identifiants = identifiants.concat(";;"+cac.getData("id"));
                                }
                        }
                        identifiants.replaceFirst("^;;", "");
                }
                return identifiants;
        }
        
        public void afficherChampSupplementaire(Radio radioBtn) {
                //GWT.log("Nom btn : "+radioBtn.getName()+" - Nom group : "+radioBtn.getGroup().getName(), null);
                // Valeur du bouton radio déclenchant l'affichage des composants cachés
                String valeurPourAfficher = "oui";
                
                // Construction de la liste des composants à afficher/cacher
                String radioGroupeNom = radioBtn.getGroup().getName();
                ArrayList<Object> composants = new ArrayList<Object>();         
                if (radioGroupeNom.equals("action_mark_grp")) {
                        composants.add(actionTrukCp);
                } else if (radioGroupeNom.equals("future_action_mark_grp")) {
                        composants.add(futureActionChp);
                } else if (radioGroupeNom.equals("sans_motif_acces_mark_grp")) {
                        composants.add(sansMotifAccesChp);
                } else if (radioGroupeNom.equals("avec_motif_acces_mark_grp")) {
                        composants.add(avecMotifAccesChp);
                } else if (radioGroupeNom.equals("recherche_mark_grp")) {
                        composants.add(provenanceRechercheTrukCp);
                        composants.add(typeRechercheTrukCp);
                } else if (radioGroupeNom.equals("formation_mark_grp")) {
                        composants.add(formationChp);
                } else if (radioGroupeNom.equals("collection_commune_mark_grp")) {
                        composants.add(collectionAutreTrukCp);
                } else if (radioGroupeNom.equals("restauration_mark_grp")) {
                        composants.add(opRestauTrukCp);
                } else if (radioGroupeNom.equals("traitement_mark_grp")) {
                        composants.add(traitementTrukCp);
                } else if (radioGroupeNom.equals("echantillon_acquisition_mark_grp")) {
                        composants.add(traitementAcquisitionMarkRGrpChp);
                } else if (radioGroupeNom.equals("traitement_acquisition_mark_grp")) {
                        composants.add(traitementAcquisitionMarkLabel);
                        composants.add(poisonTraitementTrukCp);
                        composants.add(insecteTraitementTrukCp);
                } else if (radioGroupeNom.equals("materiel_conservation_ce_grp")) {
                        composants.add(autreMaterielTrukCp);
                        valeurPourAfficher = "non";
                }
                
                // Nous affichons/cachons les composant de la liste
                final int nbreComposants = composants.size();
                //GWT.log("Id : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax, null);
                //Window.alert("Radio grp nom : "+radioGroupeNom+" - Id btn : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax);
                for (int i = 0; i < nbreComposants; i++) {
                        // En fonction du type de bouton cliquer, on affiche ou cache les champs
                        String type = radioBtn.getBoxLabel().toLowerCase();
                        //GWT.log(type, null);
                        if (radioBtn.getValue() == true) {
                                if (type.equals(valeurPourAfficher)) {
                                        ((Component) composants.get(i)).show();
                                } else {
                                        ((Component) composants.get(i)).hide();
                                }
                        }
                        // Si on a à faire à un ContentPanel, on l'actualise pour déclencher l'affichage
                        if (composants.get(i) instanceof ContentPanel) {
                                ((ContentPanel) composants.get(i)).layout();
                        }
                }
                
        }
        
        public void rafraichir(Object nouvellesDonnees) {
                try {
                        if (nouvellesDonnees instanceof Information) {
                                Information info = (Information) nouvellesDonnees;
                                rafraichirInformation(info);
                        } else if (nouvellesDonnees instanceof ValeurListe) {
                                ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
                                rafraichirValeurListe(listeValeurs);
                        } else if (nouvellesDonnees instanceof ProjetListe) {
                                ProjetListe projets = (ProjetListe) nouvellesDonnees;
                                rafraichirProjetListe(projets);
                        } else {
                                GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
                        }
                } catch (Exception e) {
                        GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), e);
                }
                
                controlerFermetureApresRafraichissement();
        }
        
        public void rafraichirInformation(Information info) {
                if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
                        GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
                }
                
                if (info.getType().equals("modif_structure")) {
                        Info.display("Modification d'une institution", info.toString());
                } else if (info.getType().equals("ajout_structure")) {
                        if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
                                String structureId = (String) info.getDonnee(0);
                                Info.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
                        
                                // Suite à la récupération de l'id de l'institution nouvellement ajoutée nous ajoutons le personnel
                                mediateur.ajouterStructureAPersonne(this, structureId, personnelAjoute);
                        } else {
                                Info.display("Ajout d'une Institution", info.toString());
                        }
                } else if (info.getType().equals("modif_structure_a_personne")) {
                        Info.display("Modification du Personnel", info.toString());
                        GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
                        testerLancementRafraichirPersonnel();
                } else if (info.getType().equals("suppression_structure_a_personne")) {
                        Info.display("Suppression du Personnel", info.toString());
                        GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
                        testerLancementRafraichirPersonnel();
                } else if (info.getType().equals("ajout_structure_a_personne")) {
                        Info.display("Ajout du Personnel", info.toString());
                        GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
                        testerLancementRafraichirPersonnel();
                } else if (info.getType().equals("selection_structure")) {
                        Info.display("Modification d'une institution", info.toString());
                        String titre = i18nC.titreModifFormStructurePanneau();
                        if (info.getDonnee(0) != null) {
                                identification = (Structure) info.getDonnee(0);
                                if (onglets.getSelectedItem().equals(identificationOnglet)) {
                                        peuplerStructureIdentification();
                                }
                                // Composition du titre
                                titre += " - ID : "+identification.getId();
                        }
                        if (info.getDonnee(1) != null) {
                                conservation = (StructureConservation) info.getDonnee(1);
                                if (onglets.getSelectedItem().equals(conservationOnglet)) {
                                        peuplerStructureConservation();
                                }
                        }
                        if (info.getDonnee(2) != null) {
                                valorisation = (StructureValorisation) info.getDonnee(2);
                                if (valorisation != null) {
                                        if (onglets.getSelectedItem().equals(valorisationOnglet)) {
                                                peuplerStructureValorisation();
                                        }
                                }
                        }
                        panneauFormulaire.setHeading(titre);
                } else if (info.getType().equals("liste_structure_a_personne")) {
                        if (info.getDonnee(0) != null) {
                                personnel = (StructureAPersonneListe) info.getDonnee(0);

                                peuplerStructurePersonnel();
                                personnelOnglet.layout();
                                Info.display("Chargement du Personnel", "ok");

                                // Remise à zéro des modification dans la liste du personnel
                                personnelModifie = new StructureAPersonneListe();
                                personnelAjoute = new StructureAPersonneListe();
                                personnelSupprime = new StructureAPersonneListe();
                        }
                } else if (info.getType().equals("liste_personne")) {
                        if (info.getDonnee(0) != null) {
                                PersonneListe personnes = (PersonneListe) info.getDonnee(0);
                                List<Personne> liste = personnes.toList();
                                
                                personneExistanteMagazin.removeAll();
                                personneExistanteMagazin.add(liste);
                                personneExistanteCombo.setStore(personneExistanteMagazin);
                                personneExistanteCombo.expand();
                        }
                }
        }
        
        public void rafraichirValeurListe(ValeurListe listeValeurs) {
                List<Valeur> liste = listeValeurs.toList();

                // Test pour savoir si la liste contient des éléments
                if (liste.size() > 0) {
                        if (listeValeurs.getId().equals(config.getListeId("stpr"))) {
                                magazinLstpr.removeAll();
                                magazinLstpr.add(liste);
                                comboLstpr.setStore(magazinLstpr);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
                                magazinLstpu.removeAll();
                                magazinLstpu.add(liste);
                                comboLstpu.setStore(magazinLstpu);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("statut"))) {
                                magazinLiStatut.removeAll();
                                magazinLiStatut.add(liste);
                                comboLiStatut.setStore(magazinLiStatut);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("fonction"))) {
                                // FIXME : le store ne contient pas tout le temps les données, chose étrange.
                                // On stocke donc les données dans une variables de la classe pour recharger le store si besoin.
                                fonctionsListe = liste;
                                fonctionsMagazin.removeAll();
                                fonctionsMagazin.add(liste);
                                fonctionsCombo.setStore(fonctionsMagazin);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("pays"))) {
                                magazinPays.removeAll();
                                magazinPays.add(liste);
                                comboPays.setStore(magazinPays);
                        }
                        
                        if (listeValeurs.getId().equals(config.getListeId("region"))) {
                                magazinRegion.removeAll();
                                magazinRegion.add(liste);
                                comboRegion.setStore(magazinRegion);
                                
                                mettreAJourRegion();
                        }
                        
                        
                        if (listeValeurs.getId().equals(config.getListeId("localStockage"))) {
                                localStockageAutreChp = new TextField<String>();
                                creerChoixMultipleCac(localStockageTrukCp, localStockageTrukCacGrpChp, listeValeurs, localStockageAutreChp);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("meubleStockage"))) {
                                meubleStockageAutreChp = new TextField<String>();
                                creerChoixMultipleCac(meubleStockageTrukCp, meubleStockageTrukCacGrpChp, listeValeurs, meubleStockageAutreChp);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("parametreStockage"))) {
                                parametreStockageAutreChp = new TextField<String>();
                                creerChoixMultipleCac(parametreStockageTrukCp, parametreStockageTrukCacGrpChp, listeValeurs, parametreStockageAutreChp);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("autreCollection"))) {
                                if (collectionAutreTrukCp != null && collectionAutreTrukCp.getItemByItemId("collectionAutreTrukCacGrpChp") == null) {
                                        collectionAutreTrukCacGrpChp.setId("collectionAutreTrukCacGrpChp");
                                        collectionAutreAutreChp = new TextField<String>();
                                        creerChoixMultipleCac(collectionAutreTrukCp, collectionAutreTrukCacGrpChp, listeValeurs, collectionAutreAutreChp);
                                }
                                if (autreCollectionTrukCp != null && autreCollectionTrukCp.getItemByItemId("autreCollectionTrukCacGrpChp") == null) {
                                        autreCollectionTrukCacGrpChp.setId("autreCollectionTrukCacGrpChp");
                                        autreCollectionAutreChp = new TextField<String>();
                                        creerChoixMultipleCac(autreCollectionTrukCp, autreCollectionTrukCacGrpChp, listeValeurs, autreCollectionAutreChp);
                                }
                        }
                        if (listeValeurs.getId().equals(config.getListeId("opRestau"))) {
                                opRestauAutreChp = new TextField<String>();
                                creerChoixMultipleCac(opRestauTrukCp, opRestauTrukCacGrpChp, listeValeurs, opRestauAutreChp);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("onep"))) {
                                creerChoixUniqueBoutonRadio(materielConservationCeRGrpChp, listeValeurs);
                                materielConservationCp.add(materielConservationCeRGrpChp);
                                materielConservationCp.layout();
                        }
                        if (listeValeurs.getId().equals(config.getListeId("autreMateriel"))) {
                                autreMaterielAutreChp = new TextField<String>();
                                creerChoixMultipleCac(autreMaterielTrukCp, autreMaterielTrukCacGrpChp, listeValeurs, autreMaterielAutreChp);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("poisonTraitement"))) {
                                poisonTraitementAutreChp = new TextField<String>();
                                creerChoixMultipleCac(poisonTraitementTrukCp, poisonTraitementTrukCacGrpChp, listeValeurs, poisonTraitementAutreChp);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("insecteTraitement"))) {
                                if (traitementTrukCp != null && traitementTrukCp.getItemByItemId("traitementTrukCacGrpChp") == null) {
                                        traitementTrukCacGrpChp.setId("traitementTrukCacGrpChp");
                                        traitementAutreChp = new TextField<String>();
                                        creerChoixMultipleCac(traitementTrukCp, traitementTrukCacGrpChp, listeValeurs, traitementAutreChp);
                                }
                                if (insecteTraitementTrukCp != null && insecteTraitementTrukCp.getItemByItemId("insecteTraitementTrukCacGrpChp") == null) {
                                        insecteTraitementTrukCacGrpChp.setId("insecteTraitementTrukCacGrpChp");
                                        insecteTraitementAutreChp = new TextField<String>();
                                        creerChoixMultipleCac(insecteTraitementTrukCp, insecteTraitementTrukCacGrpChp, listeValeurs, insecteTraitementAutreChp);
                                }
                        }
                        if (listeValeurs.getId().equals(config.getListeId("actionValorisation"))) {
                                actionAutreChp = new TextField<String>();
                                creerChoixMultipleCac(actionTrukCp, actionTrukCacGrpChp, listeValeurs, actionAutreChp);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("continentEtFr"))) {
                                provenanceRechercheAutreChp = new TextField<String>();
                                creerChoixMultipleCac(provenanceRechercheTrukCp, provenanceRechercheTrukCacGrpChp, listeValeurs, provenanceRechercheAutreChp);
                        }
                        if (listeValeurs.getId().equals(config.getListeId("typeRecherche"))) {
                                typeRechercheAutreChp = new TextField<String>();
                                creerChoixMultipleCac(typeRechercheTrukCp, typeRechercheTrukCacGrpChp, listeValeurs, typeRechercheAutreChp);
                        }
                        //GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
                } else {
                        GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
                }
        }
        
        private void rafraichirProjetListe(ProjetListe projets) {
                List<Projet> liste = projets.toList();
                projetsMagazin.removeAll();
                projetsMagazin.add(liste);
                projetsCombo.setStore(projetsMagazin);
        }
        
        private void testerLancementRafraichirPersonnel() {
                decompteRafraichissementPersonnel--;
                if (decompteRafraichissementPersonnel == 0) {
                        // Nous rechargeons la liste du Personnel
                        rafraichirPersonnel();
                }
        }
        
        private void rafraichirPersonnel() {
                decompteRafraichissementPersonnel = 0;
                if (mode.equals(MODE_MODIFIER)) {
                        initialiserGrillePersonnelEnModification();
                } else if (mode.equals(MODE_AJOUTER)) {
                        initialiserGrillePersonnelEnAjout();
                }
        }
        
        private void rafraichirPersonneExistante(String nom) {
                mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%"); 
        }
        
        private void ajouterMembreAGrillePersonnel(StructureAPersonne personnel) {
                grillePersonnel.stopEditing();
                personnelGrilleMagazin.insert(personnel, 0);
                grillePersonnel.startEditing(0, 0);
        }
        
        private void initialiserGrillePersonnelEnAjout() {
                personnelGrilleMagazin.removeAll();
                StructureAPersonne conservateurDesCollections = new StructureAPersonne(StructureAPersonne.FONCTION_CONSERVATEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
                ajouterMembreAGrillePersonnel(conservateurDesCollections);
                StructureAPersonne directeurDuPersonnel = new StructureAPersonne(StructureAPersonne.FONCTION_DIRECTEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
                ajouterMembreAGrillePersonnel(directeurDuPersonnel);
                personnelOnglet.layout();
        }
        
        private void initialiserGrillePersonnelEnModification() {
                mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE);
        }
}