| 935 | jpm | 1 | package org.tela_botanica.client.vues.structure;
 | 
        
           | 69 | jpm | 2 |   | 
        
           | 91 | jpm | 3 | import java.util.ArrayList;
 | 
        
           | 1284 | gduche | 4 | import java.util.Date;
 | 
        
           | 91 | jpm | 5 | import java.util.Iterator;
 | 
        
           | 1513 | jpm | 6 | import java.util.LinkedList;
 | 
        
           | 69 | jpm | 7 | import java.util.List;
 | 
        
           |  |  | 8 |   | 
        
           | 981 | jpm | 9 | import org.tela_botanica.client.ComposantClass;
 | 
        
           | 119 | jpm | 10 | import org.tela_botanica.client.Mediateur;
 | 
        
           | 91 | jpm | 11 | import org.tela_botanica.client.RegistreId;
 | 
        
           | 1329 | cyprien | 12 | import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
 | 
        
           | 1468 | jpm | 13 | import org.tela_botanica.client.composants.GrillePaginable;
 | 
        
           | 1210 | cyprien | 14 | import org.tela_botanica.client.composants.InfoLogger;
 | 
        
           | 1468 | jpm | 15 | import org.tela_botanica.client.composants.pagination.ProxyCollectionAPersonne;
 | 
        
           | 1369 | cyprien | 16 | import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
 | 
        
           | 1468 | jpm | 17 | import org.tela_botanica.client.composants.pagination.ProxyStructureAPersonne;
 | 
        
           | 1329 | cyprien | 18 | import org.tela_botanica.client.composants.pagination.ProxyValeur;
 | 
        
           | 569 | jp_milcent | 19 | import org.tela_botanica.client.images.Images;
 | 
        
           | 69 | jpm | 20 | import org.tela_botanica.client.interfaces.Rafraichissable;
 | 
        
           | 153 | jpm | 21 | import org.tela_botanica.client.modeles.Information;
 | 
        
           | 100 | jpm | 22 | import org.tela_botanica.client.modeles.InterneValeur;
 | 
        
           |  |  | 23 | import org.tela_botanica.client.modeles.InterneValeurListe;
 | 
        
           | 330 | jp_milcent | 24 | import org.tela_botanica.client.modeles.MenuApplicationId;
 | 
        
           | 91 | jpm | 25 | import org.tela_botanica.client.modeles.Valeur;
 | 
        
           |  |  | 26 | import org.tela_botanica.client.modeles.ValeurListe;
 | 
        
           | 1239 | cyprien | 27 | import org.tela_botanica.client.modeles.aDonnee;
 | 
        
           | 1262 | cyprien | 28 | import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
 | 
        
           | 935 | jpm | 29 | import org.tela_botanica.client.modeles.personne.Personne;
 | 
        
           |  |  | 30 | import org.tela_botanica.client.modeles.personne.PersonneListe;
 | 
        
           |  |  | 31 | import org.tela_botanica.client.modeles.structure.Structure;
 | 
        
           |  |  | 32 | import org.tela_botanica.client.modeles.structure.StructureAPersonne;
 | 
        
           |  |  | 33 | import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
 | 
        
           |  |  | 34 | import org.tela_botanica.client.modeles.structure.StructureConservation;
 | 
        
           |  |  | 35 | import org.tela_botanica.client.modeles.structure.StructureValorisation;
 | 
        
           | 1322 | gduche | 36 | import org.tela_botanica.client.synchronisation.Sequenceur;
 | 
        
           | 1210 | cyprien | 37 | import org.tela_botanica.client.util.Debug;
 | 
        
           | 1173 | jpm | 38 | import org.tela_botanica.client.util.Pattern;
 | 
        
           | 243 | jp_milcent | 39 | import org.tela_botanica.client.util.UtilArray;
 | 
        
           | 1043 | gduche | 40 | import org.tela_botanica.client.util.UtilString;
 | 
        
           | 935 | jpm | 41 | import org.tela_botanica.client.vues.Formulaire;
 | 
        
           | 1637 | aurelien | 42 | import org.tela_botanica.client.vues.structure.StructureFormPersonne.EtatPersonnelStructure;
 | 
        
           | 69 | jpm | 43 |   | 
        
           | 1284 | gduche | 44 | import com.extjs.gxt.ui.client.Style.Scroll;
 | 
        
           | 1329 | cyprien | 45 | import com.extjs.gxt.ui.client.data.ModelData;
 | 
        
           |  |  | 46 | import com.extjs.gxt.ui.client.data.ModelType;
 | 
        
           | 491 | gduche | 47 | import com.extjs.gxt.ui.client.event.Events;
 | 
        
           | 91 | jpm | 48 | import com.extjs.gxt.ui.client.Registry;
 | 
        
           | 295 | jp_milcent | 49 | import com.extjs.gxt.ui.client.event.BaseEvent;
 | 
        
           | 491 | gduche | 50 | import com.extjs.gxt.ui.client.event.ButtonEvent;
 | 
        
           | 111 | jpm | 51 | import com.extjs.gxt.ui.client.event.ComponentEvent;
 | 
        
           | 1210 | cyprien | 52 | import com.extjs.gxt.ui.client.event.EventType;
 | 
        
           | 243 | jp_milcent | 53 | import com.extjs.gxt.ui.client.event.KeyListener;
 | 
        
           | 111 | jpm | 54 | import com.extjs.gxt.ui.client.event.Listener;
 | 
        
           | 100 | jpm | 55 | import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
 | 
        
           |  |  | 56 | import com.extjs.gxt.ui.client.event.SelectionChangedListener;
 | 
        
           | 103 | jpm | 57 | import com.extjs.gxt.ui.client.event.SelectionListener;
 | 
        
           | 69 | jpm | 58 | import com.extjs.gxt.ui.client.store.ListStore;
 | 
        
           | 245 | jp_milcent | 59 | import com.extjs.gxt.ui.client.store.Record;
 | 
        
           |  |  | 60 | import com.extjs.gxt.ui.client.store.Store;
 | 
        
           |  |  | 61 | import com.extjs.gxt.ui.client.store.StoreEvent;
 | 
        
           | 111 | jpm | 62 | import com.extjs.gxt.ui.client.widget.Component;
 | 
        
           | 102 | jpm | 63 | import com.extjs.gxt.ui.client.widget.ContentPanel;
 | 
        
           | 569 | jp_milcent | 64 | import com.extjs.gxt.ui.client.widget.Html;
 | 
        
           | 153 | jpm | 65 | import com.extjs.gxt.ui.client.widget.Info;
 | 
        
           | 69 | jpm | 66 | import com.extjs.gxt.ui.client.widget.LayoutContainer;
 | 
        
           | 320 | gduche | 67 | import com.extjs.gxt.ui.client.widget.MessageBox;
 | 
        
           | 100 | jpm | 68 | import com.extjs.gxt.ui.client.widget.TabItem;
 | 
        
           |  |  | 69 | import com.extjs.gxt.ui.client.widget.TabPanel;
 | 
        
           | 69 | jpm | 70 | import com.extjs.gxt.ui.client.widget.button.Button;
 | 
        
           | 108 | jpm | 71 | import com.extjs.gxt.ui.client.widget.form.CheckBox;
 | 
        
           |  |  | 72 | import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
 | 
        
           | 69 | jpm | 73 | import com.extjs.gxt.ui.client.widget.form.ComboBox;
 | 
        
           | 100 | jpm | 74 | import com.extjs.gxt.ui.client.widget.form.DateField;
 | 
        
           | 119 | jpm | 75 | import com.extjs.gxt.ui.client.widget.form.Field;
 | 
        
           | 100 | jpm | 76 | import com.extjs.gxt.ui.client.widget.form.FieldSet;
 | 
        
           | 172 | jp_milcent | 77 | import com.extjs.gxt.ui.client.widget.form.HiddenField;
 | 
        
           | 103 | jpm | 78 | import com.extjs.gxt.ui.client.widget.form.LabelField;
 | 
        
           | 102 | jpm | 79 | import com.extjs.gxt.ui.client.widget.form.NumberField;
 | 
        
           | 109 | jpm | 80 | import com.extjs.gxt.ui.client.widget.form.Radio;
 | 
        
           |  |  | 81 | import com.extjs.gxt.ui.client.widget.form.RadioGroup;
 | 
        
           | 164 | jp_milcent | 82 | import com.extjs.gxt.ui.client.widget.form.TextArea;
 | 
        
           | 69 | jpm | 83 | import com.extjs.gxt.ui.client.widget.form.TextField;
 | 
        
           | 1329 | cyprien | 84 | import com.extjs.gxt.ui.client.widget.form.Validator;
 | 
        
           | 69 | jpm | 85 | import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
 | 
        
           |  |  | 86 | import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
 | 
        
           | 102 | jpm | 87 | import com.extjs.gxt.ui.client.widget.grid.CellEditor;
 | 
        
           |  |  | 88 | import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
 | 
        
           |  |  | 89 | import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
 | 
        
           |  |  | 90 | import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
 | 
        
           |  |  | 91 | import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
 | 
        
           | 231 | jp_milcent | 92 | import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
 | 
        
           | 1468 | jpm | 93 | import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
 | 
        
           | 231 | jp_milcent | 94 | import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
 | 
        
           | 69 | jpm | 95 | import com.extjs.gxt.ui.client.widget.layout.ColumnData;
 | 
        
           |  |  | 96 | import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
 | 
        
           |  |  | 97 | import com.extjs.gxt.ui.client.widget.layout.FitLayout;
 | 
        
           | 100 | jpm | 98 | import com.extjs.gxt.ui.client.widget.layout.FormData;
 | 
        
           | 110 | jpm | 99 | import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
 | 
        
           | 102 | jpm | 100 | import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
 | 
        
           |  |  | 101 | import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
 | 
        
           | 91 | jpm | 102 | import com.google.gwt.core.client.GWT;
 | 
        
           | 100 | jpm | 103 | import com.google.gwt.i18n.client.DateTimeFormat;
 | 
        
           | 102 | jpm | 104 | import com.google.gwt.i18n.client.NumberFormat;
 | 
        
           | 1035 | gduche | 105 | import com.google.gwt.user.client.Window;
 | 
        
           | 69 | jpm | 106 |   | 
        
           | 634 | jp_milcent | 107 | public class StructureForm extends Formulaire implements Rafraichissable {
 | 
        
           | 1637 | aurelien | 108 |   | 
        
           | 775 | jpm | 109 | 	private TabPanel onglets = null;
 | 
        
           | 1637 | aurelien | 110 | 	private StructureFormIdentification identificationOnglet = null;
 | 
        
           |  |  | 111 | 	private StructureFormPersonne personnelOnglet = null;
 | 
        
           |  |  | 112 | 	private StructureFormConservation conservationOnglet = null;
 | 
        
           |  |  | 113 | 	private StructureFormValorisation valorisationOnglet = null;
 | 
        
           | 115 | jpm | 114 |   | 
        
           | 206 | jp_milcent | 115 | 	// Onglet IDENTIFICATION
 | 
        
           | 1637 | aurelien | 116 | 	public Structure identification = null;
 | 
        
           | 192 | jp_milcent | 117 |   | 
        
           | 206 | jp_milcent | 118 | 	// Onglet PERSONNEL
 | 
        
           | 1637 | aurelien | 119 | 	// Vide suite à refactoring
 | 
        
           | 211 | jp_milcent | 120 |   | 
        
           | 206 | jp_milcent | 121 | 	// Onglet CONSERVATION
 | 
        
           | 1637 | aurelien | 122 | 	public StructureConservation conservation = null;
 | 
        
           |  |  | 123 |   | 
        
           | 206 | jp_milcent | 124 | 	// Onglet VALORISATION
 | 
        
           | 1637 | aurelien | 125 | 	public StructureValorisation valorisation = null;
 | 
        
           | 1322 | gduche | 126 |   | 
        
           |  |  | 127 | 	private Sequenceur sequenceur;
 | 
        
           |  |  | 128 |   | 
        
           | 1613 | aurelien | 129 | 	private Structure structure = null;
 | 
        
           |  |  | 130 |   | 
        
           |  |  | 131 | 	public Rafraichissable vueExterneARafraichirApresValidation = null;
 | 
        
           |  |  | 132 |   | 
        
           | 1322 | gduche | 133 | 	public StructureForm(Mediateur mediateurCourrant, String modeDeCreation, Sequenceur sequenceur) {
 | 
        
           | 648 | jp_milcent | 134 | 		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.STRUCTURE);
 | 
        
           | 1322 | gduche | 135 | 		this.sequenceur = sequenceur;
 | 
        
           |  |  | 136 |   | 
        
           | 775 | jpm | 137 | 		// Ajout du titre
 | 
        
           | 1680 | raphael | 138 | 		panneauFormulaire.setHeadingHtml(i18nC.titreAjoutFormStructurePanneau());
 | 
        
           | 775 | jpm | 139 | 		// Création des onglets
 | 
        
           |  |  | 140 | 		onglets = creerOnglets();
 | 
        
           | 1322 | gduche | 141 |   | 
        
           | 775 | jpm | 142 | 		// Ajout des onglets au formulaire général
 | 
        
           |  |  | 143 | 		panneauFormulaire.add(onglets);
 | 
        
           | 609 | jp_milcent | 144 | 	}
 | 
        
           |  |  | 145 |   | 
        
           | 775 | jpm | 146 | 	protected TabPanel creerOnglets() {
 | 
        
           |  |  | 147 | 		TabPanel ongletsStructure = new TabPanel();
 | 
        
           | 110 | jpm | 148 | 		// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner)
 | 
        
           | 775 | jpm | 149 | 		ongletsStructure.setHeight("100%");
 | 
        
           | 69 | jpm | 150 |   | 
        
           | 100 | jpm | 151 | 		// Onlget formulaire IDENTIFICATION
 | 
        
           | 775 | jpm | 152 | 		ongletsStructure.add(creerOngletIdentification());
 | 
        
           | 206 | jp_milcent | 153 |   | 
        
           | 100 | jpm | 154 | 		// Onlget formulaire PERSONNEL
 | 
        
           | 775 | jpm | 155 | 		ongletsStructure.add(creerOngletPersonnel());
 | 
        
           | 91 | jpm | 156 |   | 
        
           | 100 | jpm | 157 | 		// Onlget formulaire CONSERVATION
 | 
        
           | 775 | jpm | 158 | 		ongletsStructure.add(creerOngletConservation());
 | 
        
           | 100 | jpm | 159 |   | 
        
           |  |  | 160 | 		// Onlget formulaire VALORISATION
 | 
        
           | 775 | jpm | 161 | 		ongletsStructure.add(creerOngletValorisation());
 | 
        
           | 100 | jpm | 162 |   | 
        
           | 119 | jpm | 163 | 		// Sélection de l'onglet par défaut
 | 
        
           | 775 | jpm | 164 | 		//ongletsStructure(personnelOnglet);
 | 
        
           | 192 | jp_milcent | 165 |   | 
        
           | 775 | jpm | 166 | 		return ongletsStructure;
 | 
        
           | 609 | jp_milcent | 167 | 	}
 | 
        
           |  |  | 168 |   | 
        
           | 1613 | aurelien | 169 | 	private void repandreRafraichissement() {
 | 
        
           |  |  | 170 | 		if (vueExterneARafraichirApresValidation != null) {
 | 
        
           |  |  | 171 | 			String type = "structure_modifiee";
 | 
        
           |  |  | 172 | 			if (mode.equals(Formulaire.MODE_AJOUTER)) {
 | 
        
           |  |  | 173 | 				type = "structure_ajoutee";
 | 
        
           |  |  | 174 | 			}
 | 
        
           |  |  | 175 | 			Information info = new Information(type);
 | 
        
           |  |  | 176 | 			info.setDonnee(0, structure);
 | 
        
           |  |  | 177 | 			vueExterneARafraichirApresValidation.rafraichir(info);
 | 
        
           |  |  | 178 | 		}
 | 
        
           |  |  | 179 | 	}
 | 
        
           |  |  | 180 |   | 
        
           | 934 | jpm | 181 | 	public boolean soumettreFormulaire() {
 | 
        
           | 1210 | cyprien | 182 |   | 
        
           | 243 | jp_milcent | 183 | 		// Vérification de la validité des champs du formulaire
 | 
        
           | 786 | jpm | 184 | 		boolean fomulaireValide = verifierFormulaire();
 | 
        
           | 1613 | aurelien | 185 |   | 
        
           |  |  | 186 | 		Structure identification = collecterStructureIdentification();
 | 
        
           |  |  | 187 |   | 
        
           |  |  | 188 | 		if(identification != null) {
 | 
        
           |  |  | 189 | 			structure = identification;
 | 
        
           |  |  | 190 | 		} else {
 | 
        
           | 1637 | aurelien | 191 | 			structure = this.identification;
 | 
        
           | 1613 | aurelien | 192 | 		}
 | 
        
           |  |  | 193 |   | 
        
           |  |  | 194 |   | 
        
           |  |  | 195 | 		structure.setConservation(this.conservation);
 | 
        
           |  |  | 196 | 		structure.setValorisation(this.valorisation);
 | 
        
           |  |  | 197 |   | 
        
           | 786 | jpm | 198 | 		if (fomulaireValide) {
 | 
        
           | 243 | jp_milcent | 199 | 			// Collecte des données du formulaire
 | 
        
           |  |  | 200 | 			StructureConservation conservation = collecterStructureConservation();
 | 
        
           |  |  | 201 | 			StructureValorisation valorisation = collecterStructureValorisation();
 | 
        
           | 1613 | aurelien | 202 |   | 
        
           |  |  | 203 | 			if(conservation != null) {
 | 
        
           |  |  | 204 | 				structure.setConservation(conservation);
 | 
        
           |  |  | 205 | 			}
 | 
        
           |  |  | 206 |   | 
        
           |  |  | 207 | 			if(valorisation != null) {
 | 
        
           |  |  | 208 | 				structure.setValorisation(valorisation);
 | 
        
           |  |  | 209 | 			}
 | 
        
           |  |  | 210 |   | 
        
           | 1637 | aurelien | 211 | 			EtatPersonnelStructure etatPersonnel = personnelOnglet.collecter();
 | 
        
           | 243 | jp_milcent | 212 |   | 
        
           | 1637 | aurelien | 213 | 			structure.setPersonnel(etatPersonnel.personnel);
 | 
        
           | 1613 | aurelien | 214 | 			structure.setConservation(conservation);
 | 
        
           |  |  | 215 | 			structure.setValorisation(valorisation);
 | 
        
           |  |  | 216 |   | 
        
           | 634 | jp_milcent | 217 | 			if (mode.equals(MODE_AJOUTER)) {
 | 
        
           | 243 | jp_milcent | 218 | 				// Ajout des informations sur la Structure
 | 
        
           | 782 | jpm | 219 | 				mediateur.ajouterStructure(this, structure, conservation, valorisation);
 | 
        
           | 243 | jp_milcent | 220 | 				// L'ajout des relations StructureAPersonne se fait quand la structure a été ajoutée
 | 
        
           |  |  | 221 | 				// Voir la méthode rafraichir().
 | 
        
           | 634 | jp_milcent | 222 | 			} else if (mode.equals(MODE_MODIFIER)) {
 | 
        
           | 1210 | cyprien | 223 |   | 
        
           | 243 | jp_milcent | 224 | 				// Modification des informations sur la Structure
 | 
        
           | 306 | jp_milcent | 225 | 				if (structure == null && conservation == null && valorisation == null) {
 | 
        
           | 1630 | aurelien | 226 | 					//InfoLogger.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
 | 
        
           | 306 | jp_milcent | 227 | 				} else {
 | 
        
           | 1637 | aurelien | 228 | 					mediateur.modifierStructure(this, structure.getId(), structure, conservation, valorisation);
 | 
        
           | 306 | jp_milcent | 229 | 				}
 | 
        
           | 1210 | cyprien | 230 |   | 
        
           | 1637 | aurelien | 231 | 				if (etatPersonnel.personnelModifie.size() == 0 && etatPersonnel.personnelAjoute.size() == 0 && etatPersonnel.personnelSupprime.size() == 0) {
 | 
        
           | 1630 | aurelien | 232 | 					//InfoLogger.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
 | 
        
           | 306 | jp_milcent | 233 | 				} else {
 | 
        
           | 1637 | aurelien | 234 | 					if (etatPersonnel.personnelModifie.size() != 0) {
 | 
        
           |  |  | 235 | 						personnelOnglet.incrementerDecompteRafraichissementPersonnel();
 | 
        
           |  |  | 236 | 						mediateur.modifierStructureAPersonne(this, etatPersonnel.personnelModifie);
 | 
        
           | 306 | jp_milcent | 237 | 					}
 | 
        
           |  |  | 238 | 					// Ajout des relations StructureAPersonne
 | 
        
           | 1637 | aurelien | 239 | 					if (etatPersonnel.personnelAjoute.size() != 0) {
 | 
        
           |  |  | 240 | 						personnelOnglet.incrementerDecompteRafraichissementPersonnel();
 | 
        
           |  |  | 241 | 						mediateur.ajouterStructureAPersonne(this, structure.getId(), etatPersonnel.personnelAjoute);
 | 
        
           | 306 | jp_milcent | 242 | 					}
 | 
        
           |  |  | 243 | 					// Suppression des relations StructureAPersonne
 | 
        
           | 1637 | aurelien | 244 | 					if (etatPersonnel.personnelSupprime.size() != 0) {
 | 
        
           |  |  | 245 | 						personnelOnglet.incrementerDecompteRafraichissementPersonnel();
 | 
        
           |  |  | 246 | 						mediateur.supprimerStructureAPersonne(this, etatPersonnel.personnelSupprime);
 | 
        
           | 306 | jp_milcent | 247 | 					}
 | 
        
           |  |  | 248 | 				}
 | 
        
           | 243 | jp_milcent | 249 | 			}
 | 
        
           |  |  | 250 | 		}
 | 
        
           | 1210 | cyprien | 251 |   | 
        
           | 786 | jpm | 252 | 		return fomulaireValide;
 | 
        
           | 243 | jp_milcent | 253 | 	}
 | 
        
           |  |  | 254 |   | 
        
           | 934 | jpm | 255 | 	public boolean verifierFormulaire() {
 | 
        
           | 243 | jp_milcent | 256 | 		ArrayList<String> messages = new ArrayList<String>();
 | 
        
           | 1637 | aurelien | 257 | 		messages.addAll(verifierOnglets());
 | 
        
           | 231 | jp_milcent | 258 |   | 
        
           | 243 | jp_milcent | 259 | 		// Affichage des messages d'alerte
 | 
        
           |  |  | 260 | 		if (messages.size() != 0) {
 | 
        
           |  |  | 261 | 			String[] a = {};
 | 
        
           |  |  | 262 | 			a = messages.toArray(a);
 | 
        
           | 320 | gduche | 263 | 			MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
 | 
        
           | 243 | jp_milcent | 264 | 			return false;
 | 
        
           |  |  | 265 | 		}
 | 
        
           | 1284 | gduche | 266 |   | 
        
           | 243 | jp_milcent | 267 | 		return true;
 | 
        
           | 119 | jpm | 268 | 	}
 | 
        
           | 1637 | aurelien | 269 |   | 
        
           |  |  | 270 | 	private ArrayList<String> verifierOnglets() {
 | 
        
           |  |  | 271 | 		ArrayList<String> messages = new ArrayList<String>();
 | 
        
           |  |  | 272 | 		messages.addAll(identificationOnglet.verifier());
 | 
        
           |  |  | 273 | 		messages.addAll(personnelOnglet.verifier());
 | 
        
           |  |  | 274 | 		return messages;
 | 
        
           |  |  | 275 | 	}
 | 
        
           | 119 | jpm | 276 |   | 
        
           | 192 | jp_milcent | 277 | 	private StructureValorisation collecterStructureValorisation() {
 | 
        
           | 1637 | aurelien | 278 | 		return valorisationOnglet.collecter();
 | 
        
           | 192 | jp_milcent | 279 | 	}
 | 
        
           |  |  | 280 |   | 
        
           |  |  | 281 | 	private void peuplerStructureValorisation() {
 | 
        
           | 1637 | aurelien | 282 | 		valorisationOnglet.peupler();
 | 
        
           | 192 | jp_milcent | 283 | 	}
 | 
        
           |  |  | 284 |   | 
        
           |  |  | 285 | 	private StructureConservation collecterStructureConservation() {
 | 
        
           | 1637 | aurelien | 286 | 		return conservationOnglet.collecter();
 | 
        
           | 188 | jp_milcent | 287 | 	}
 | 
        
           |  |  | 288 |   | 
        
           | 192 | jp_milcent | 289 | 	private void peuplerStructureConservation() {
 | 
        
           | 1637 | aurelien | 290 | 		conservationOnglet.peupler();
 | 
        
           | 188 | jp_milcent | 291 | 	}
 | 
        
           |  |  | 292 |   | 
        
           | 192 | jp_milcent | 293 | 	private Structure collecterStructureIdentification() {
 | 
        
           | 1637 | aurelien | 294 | 		Structure structureARetourner = identificationOnglet.collecter();
 | 
        
           | 306 | jp_milcent | 295 | 		return structureARetourner;
 | 
        
           | 119 | jpm | 296 | 	}
 | 
        
           |  |  | 297 |   | 
        
           | 111 | jpm | 298 | 	private TabItem creerOngletValorisation() {
 | 
        
           | 1637 | aurelien | 299 | 		valorisationOnglet = new StructureFormValorisation(mediateur, this, sequenceur);
 | 
        
           | 111 | jpm | 300 | 		return valorisationOnglet;
 | 
        
           |  |  | 301 | 	}
 | 
        
           |  |  | 302 |   | 
        
           | 108 | jpm | 303 | 	private TabItem creerOngletConservation() {
 | 
        
           | 1637 | aurelien | 304 | 		conservationOnglet = new StructureFormConservation(mediateur, this, sequenceur);
 | 
        
           | 108 | jpm | 305 | 		return conservationOnglet;
 | 
        
           |  |  | 306 | 	}
 | 
        
           |  |  | 307 |   | 
        
           | 1637 | aurelien | 308 | 	private EtatPersonnelStructure collecterStructurePersonnel() {
 | 
        
           |  |  | 309 | 		return personnelOnglet.collecter();
 | 
        
           | 231 | jp_milcent | 310 | 	}
 | 
        
           | 211 | jp_milcent | 311 |   | 
        
           | 1637 | aurelien | 312 | 	private void peuplerStructurePersonnel(StructureAPersonneListe personnel) {
 | 
        
           |  |  | 313 | 		personnelOnglet.peupler(personnel);
 | 
        
           | 211 | jp_milcent | 314 | 	}
 | 
        
           |  |  | 315 |   | 
        
           | 103 | jpm | 316 | 	private TabItem creerOngletPersonnel() {
 | 
        
           | 1637 | aurelien | 317 | 		personnelOnglet = new StructureFormPersonne(this, mediateur);
 | 
        
           | 231 | jp_milcent | 318 | 		return personnelOnglet;
 | 
        
           |  |  | 319 | 	}
 | 
        
           | 102 | jpm | 320 |   | 
        
           | 110 | jpm | 321 | 	private TabItem creerOngletIdentification() {
 | 
        
           | 1637 | aurelien | 322 | 		identificationOnglet = new StructureFormIdentification(this);
 | 
        
           | 110 | jpm | 323 | 		return identificationOnglet;
 | 
        
           |  |  | 324 | 	}
 | 
        
           | 1637 | aurelien | 325 |   | 
        
           |  |  | 326 | 	public void peuplerCasesACocher(String donnees, CheckBoxGroup groupeCac, TextField<String> champAutre) {
 | 
        
           | 192 | jp_milcent | 327 | 		String[] valeurs = donnees.split(";;");
 | 
        
           |  |  | 328 | 		for (int i = 0; i < valeurs.length; i++) {
 | 
        
           |  |  | 329 | 			if (valeurs[i].startsWith("AUTRE##")) {
 | 
        
           |  |  | 330 | 				champAutre.setValue(valeurs[i].replaceFirst("^AUTRE##", ""));
 | 
        
           |  |  | 331 | 			} else {
 | 
        
           | 491 | gduche | 332 | 				//TODO : check : List<CheckBox> cases = groupeCac.getAll();
 | 
        
           |  |  | 333 | 				List<Field<?>> cases = groupeCac.getAll();
 | 
        
           | 192 | jp_milcent | 334 | 				for (int j = 0; j < cases.size(); j++) {
 | 
        
           |  |  | 335 | 					if (cases.get(j).getId().equals("val-"+valeurs[i])) {
 | 
        
           | 491 | gduche | 336 | 						((CheckBox) cases.get(j)).setValue(true);
 | 
        
           | 192 | jp_milcent | 337 | 					}
 | 
        
           |  |  | 338 | 				}
 | 
        
           |  |  | 339 | 			}
 | 
        
           |  |  | 340 | 		}
 | 
        
           |  |  | 341 | 	}
 | 
        
           |  |  | 342 |   | 
        
           | 1637 | aurelien | 343 | 	public void peuplerBoutonsRadio(String valeur, RadioGroup groupeBr) {
 | 
        
           | 491 | gduche | 344 | 		//List<Radio> boutons = groupeBr.getAll();
 | 
        
           |  |  | 345 | 		List<Field<?>> boutons = groupeBr.getAll();
 | 
        
           | 192 | jp_milcent | 346 | 		String id = valeur+"_"+groupeBr.getName().replace("_grp", "");
 | 
        
           |  |  | 347 | 		for (int i = 0; i < boutons.size(); i++) {
 | 
        
           |  |  | 348 | 			if (boutons.get(i).getId().equals(id)) {
 | 
        
           | 491 | gduche | 349 | 				((Radio) boutons.get(i)).setValue(true);
 | 
        
           | 192 | jp_milcent | 350 | 			}
 | 
        
           |  |  | 351 | 		}
 | 
        
           |  |  | 352 | 	}
 | 
        
           |  |  | 353 |   | 
        
           | 1637 | aurelien | 354 | 	public String creerChaineDenormalisee(List<CheckBox> liste) {
 | 
        
           | 192 | jp_milcent | 355 | 		String identifiants = "";
 | 
        
           | 306 | jp_milcent | 356 | 		if (liste != null) {
 | 
        
           |  |  | 357 | 			int taille = liste.size();
 | 
        
           |  |  | 358 | 			for (int i = 0; i < taille; i++) {
 | 
        
           |  |  | 359 | 				CheckBox cac = liste.get(i);
 | 
        
           |  |  | 360 | 				if (cac.isEnabled()) {
 | 
        
           |  |  | 361 | 					identifiants = identifiants.concat(";;"+cac.getData("id"));
 | 
        
           |  |  | 362 | 				}
 | 
        
           | 192 | jp_milcent | 363 | 			}
 | 
        
           | 306 | jp_milcent | 364 | 			identifiants.replaceFirst("^;;", "");
 | 
        
           | 192 | jp_milcent | 365 | 		}
 | 
        
           | 306 | jp_milcent | 366 | 		return identifiants;
 | 
        
           | 192 | jp_milcent | 367 | 	}
 | 
        
           |  |  | 368 |   | 
        
           | 1637 | aurelien | 369 | 	public void afficherChampSupplementaire(Radio radioBtn) {
 | 
        
           |  |  | 370 | 		valorisationOnglet.afficherChampSupplementaire(radioBtn) ;
 | 
        
           |  |  | 371 | 		conservationOnglet.afficherChampSupplementaires(radioBtn);
 | 
        
           | 111 | jpm | 372 | 	}
 | 
        
           |  |  | 373 |   | 
        
           | 639 | jp_milcent | 374 | 	public void rafraichir(Object nouvellesDonnees) {
 | 
        
           |  |  | 375 | 		try {
 | 
        
           |  |  | 376 | 			if (nouvellesDonnees instanceof Information) {
 | 
        
           |  |  | 377 | 				Information info = (Information) nouvellesDonnees;
 | 
        
           |  |  | 378 | 				rafraichirInformation(info);
 | 
        
           | 1637 | aurelien | 379 | 				if(!info.getType().equals("selection_structure") && !info.getType().equals("selection_structure")) {
 | 
        
           |  |  | 380 | 					repandreRafraichissement();
 | 
        
           |  |  | 381 | 				}
 | 
        
           | 639 | jp_milcent | 382 | 			} else if (nouvellesDonnees instanceof ValeurListe) {
 | 
        
           |  |  | 383 | 				ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
 | 
        
           |  |  | 384 | 				rafraichirValeurListe(listeValeurs);
 | 
        
           |  |  | 385 | 			} else {
 | 
        
           |  |  | 386 | 				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
 | 
        
           | 295 | jp_milcent | 387 | 			}
 | 
        
           | 639 | jp_milcent | 388 | 		} catch (Exception e) {
 | 
        
           | 875 | jpm | 389 | 			GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), e);
 | 
        
           | 109 | jpm | 390 | 		}
 | 
        
           |  |  | 391 |   | 
        
           | 1239 | cyprien | 392 | 		controlerFermeture();
 | 
        
           | 109 | jpm | 393 | 	}
 | 
        
           |  |  | 394 |   | 
        
           | 1513 | jpm | 395 | 	public void rafraichirInformation(Information info) {
 | 
        
           | 639 | jp_milcent | 396 | 		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
 | 
        
           |  |  | 397 | 			GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
 | 
        
           |  |  | 398 | 		}
 | 
        
           |  |  | 399 |   | 
        
           |  |  | 400 | 		if (info.getType().equals("modif_structure")) {
 | 
        
           | 1210 | cyprien | 401 | 			InfoLogger.display("Modification d'une institution", info.toString());
 | 
        
           | 1673 | raphael | 402 | 			Structure structureMaj = (Structure)(info.getDonnee(0));
 | 
        
           |  |  | 403 | 			if(structureMaj != null) {
 | 
        
           |  |  | 404 | 				// TRUE uniquement si la modification a retourné un objet JSON pour mise à jour
 | 
        
           |  |  | 405 | 				// (contenant les coordonnées générées, cf r1673)
 | 
        
           |  |  | 406 | 				structure.setLatitude(structureMaj.getLatitude());
 | 
        
           |  |  | 407 | 				structure.setLongitude(structureMaj.getLongitude());
 | 
        
           |  |  | 408 | 			}
 | 
        
           |  |  | 409 |   | 
        
           | 1613 | aurelien | 410 | 			controlerFermeture();
 | 
        
           | 639 | jp_milcent | 411 | 		} else if (info.getType().equals("ajout_structure")) {
 | 
        
           | 1708 | raphael | 412 | 			if (info.getDonnee(0) != null && ( info.getDonnee(0) instanceof String || info.getDonnee(0) instanceof Object) ) {
 | 
        
           | 1637 | aurelien | 413 | 				this.mode = MODE_MODIFIER;
 | 
        
           | 1708 | raphael | 414 | 				String structureId;
 | 
        
           |  |  | 415 |   | 
        
           |  |  | 416 | 				if(info.getDonnee(0) instanceof String) {
 | 
        
           |  |  | 417 | 					structureId = (String) info.getDonnee(0);
 | 
        
           |  |  | 418 | 				}
 | 
        
           |  |  | 419 | 				else {
 | 
        
           |  |  | 420 | 					// le backend renvoie un objet si longitude et latitude ont
 | 
        
           |  |  | 421 | 					// été générés
 | 
        
           |  |  | 422 | 					Structure structureMaj = (Structure)(info.getDonnee(0));
 | 
        
           |  |  | 423 | 					// structureMaj == null ? erreur horriblement impensable
 | 
        
           |  |  | 424 | 					structure.setLatitude(structureMaj.getLatitude());
 | 
        
           |  |  | 425 | 					structure.setLongitude(structureMaj.getLongitude());
 | 
        
           |  |  | 426 | 					structureId = structureMaj.getId();
 | 
        
           |  |  | 427 | 				}
 | 
        
           |  |  | 428 |   | 
        
           | 1637 | aurelien | 429 | 				structure.setId(structureId);
 | 
        
           |  |  | 430 | 				identification = structure;
 | 
        
           |  |  | 431 | 				identificationOnglet.rafraichir(info);
 | 
        
           |  |  | 432 | 				personnelOnglet.rafraichir(info);
 | 
        
           |  |  | 433 | 				conservationOnglet.rafraichir(info);
 | 
        
           |  |  | 434 | 				valorisationOnglet.rafraichir(info);
 | 
        
           | 1210 | cyprien | 435 | 				InfoLogger.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
 | 
        
           | 639 | jp_milcent | 436 | 			} else {
 | 
        
           | 1210 | cyprien | 437 | 				InfoLogger.display("Ajout d'une Institution", info.toString());
 | 
        
           | 639 | jp_milcent | 438 | 			}
 | 
        
           |  |  | 439 | 		} else if (info.getType().equals("modif_structure_a_personne")) {
 | 
        
           | 1210 | cyprien | 440 | 			InfoLogger.display("Modification du Personnel", info.toString());
 | 
        
           | 1637 | aurelien | 441 | 			personnelOnglet.rafraichir(info);
 | 
        
           | 639 | jp_milcent | 442 | 		} else if (info.getType().equals("suppression_structure_a_personne")) {
 | 
        
           | 1210 | cyprien | 443 | 			InfoLogger.display("Suppression du Personnel", info.toString());
 | 
        
           | 1637 | aurelien | 444 | 			personnelOnglet.rafraichir(info);
 | 
        
           | 639 | jp_milcent | 445 | 		} else if (info.getType().equals("ajout_structure_a_personne")) {
 | 
        
           | 1210 | cyprien | 446 | 			InfoLogger.display("Ajout du Personnel", info.toString());
 | 
        
           | 1637 | aurelien | 447 | 			personnelOnglet.rafraichir(info);
 | 
        
           | 639 | jp_milcent | 448 | 		} else if (info.getType().equals("selection_structure")) {
 | 
        
           | 1210 | cyprien | 449 | 			InfoLogger.display("Modification d'une institution", info.toString());
 | 
        
           | 639 | jp_milcent | 450 | 			String titre = i18nC.titreModifFormStructurePanneau();
 | 
        
           |  |  | 451 | 			if (info.getDonnee(0) != null) {
 | 
        
           | 1637 | aurelien | 452 | 				identification = (Structure)info.getDonnee(0);
 | 
        
           |  |  | 453 | 				identificationOnglet.rafraichir(info);
 | 
        
           | 639 | jp_milcent | 454 | 				// Composition du titre
 | 
        
           |  |  | 455 | 				titre += " - ID : "+identification.getId();
 | 
        
           |  |  | 456 | 			}
 | 
        
           |  |  | 457 | 			if (info.getDonnee(1) != null) {
 | 
        
           | 1637 | aurelien | 458 | 				conservation = (StructureConservation)info.getDonnee(1);
 | 
        
           |  |  | 459 | 				conservationOnglet.rafraichir(info);
 | 
        
           | 639 | jp_milcent | 460 | 			}
 | 
        
           |  |  | 461 | 			if (info.getDonnee(2) != null) {
 | 
        
           | 1637 | aurelien | 462 | 				valorisation = (StructureValorisation)info.getDonnee(2);
 | 
        
           |  |  | 463 | 				valorisationOnglet.rafraichir(info);
 | 
        
           | 639 | jp_milcent | 464 | 			}
 | 
        
           |  |  | 465 | 		} else if (info.getType().equals("liste_structure_a_personne")) {
 | 
        
           | 1637 | aurelien | 466 | 				personnelOnglet.rafraichir(info);
 | 
        
           | 639 | jp_milcent | 467 | 		}
 | 
        
           |  |  | 468 | 	}
 | 
        
           |  |  | 469 |   | 
        
           |  |  | 470 | 	public void rafraichirValeurListe(ValeurListe listeValeurs) {
 | 
        
           |  |  | 471 | 		List<Valeur> liste = listeValeurs.toList();
 | 
        
           | 407 | jp_milcent | 472 |   | 
        
           | 639 | jp_milcent | 473 | 		// Test pour savoir si la liste contient des éléments
 | 
        
           |  |  | 474 | 		if (liste.size() > 0) {
 | 
        
           | 1637 | aurelien | 475 | 			identificationOnglet.rafraichir(listeValeurs);
 | 
        
           |  |  | 476 | 			personnelOnglet.rafraichir(listeValeurs);
 | 
        
           |  |  | 477 | 			conservationOnglet.rafraichir(listeValeurs);
 | 
        
           |  |  | 478 | 			valorisationOnglet.rafraichir(listeValeurs);
 | 
        
           | 639 | jp_milcent | 479 | 			//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
 | 
        
           |  |  | 480 | 		} else {
 | 
        
           |  |  | 481 | 			GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
 | 
        
           | 91 | jpm | 482 | 		}
 | 
        
           | 639 | jp_milcent | 483 | 	}
 | 
        
           | 1637 | aurelien | 484 |   | 
        
           |  |  | 485 | 	public String getIdIdentification() {
 | 
        
           |  |  | 486 | 		return identification.getId();
 | 
        
           | 609 | jp_milcent | 487 | 	}
 | 
        
           | 1210 | cyprien | 488 | }
 |