Subversion Repositories eFlore/Applications.coel

Rev

Rev 775 | Rev 782 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
69 jpm 1
package org.tela_botanica.client.vues;
2
 
91 jpm 3
import java.util.ArrayList;
4
import java.util.Iterator;
69 jpm 5
import java.util.List;
6
 
119 jpm 7
import org.tela_botanica.client.Mediateur;
91 jpm 8
import org.tela_botanica.client.RegistreId;
569 jp_milcent 9
import org.tela_botanica.client.images.Images;
69 jpm 10
import org.tela_botanica.client.interfaces.Rafraichissable;
91 jpm 11
import org.tela_botanica.client.modeles.Configuration;
153 jpm 12
import org.tela_botanica.client.modeles.Information;
100 jpm 13
import org.tela_botanica.client.modeles.InterneValeur;
14
import org.tela_botanica.client.modeles.InterneValeurListe;
330 jp_milcent 15
import org.tela_botanica.client.modeles.MenuApplicationId;
102 jpm 16
import org.tela_botanica.client.modeles.Personne;
243 jp_milcent 17
import org.tela_botanica.client.modeles.PersonneListe;
277 jp_milcent 18
import org.tela_botanica.client.modeles.Projet;
19
import org.tela_botanica.client.modeles.ProjetListe;
119 jpm 20
import org.tela_botanica.client.modeles.Structure;
211 jp_milcent 21
import org.tela_botanica.client.modeles.StructureAPersonne;
22
import org.tela_botanica.client.modeles.StructureAPersonneListe;
188 jp_milcent 23
import org.tela_botanica.client.modeles.StructureConservation;
192 jp_milcent 24
import org.tela_botanica.client.modeles.StructureValorisation;
91 jpm 25
import org.tela_botanica.client.modeles.Valeur;
26
import org.tela_botanica.client.modeles.ValeurListe;
243 jp_milcent 27
import org.tela_botanica.client.util.UtilArray;
69 jpm 28
 
491 gduche 29
import com.extjs.gxt.ui.client.event.Events;
91 jpm 30
import com.extjs.gxt.ui.client.Registry;
295 jp_milcent 31
import com.extjs.gxt.ui.client.event.BaseEvent;
491 gduche 32
import com.extjs.gxt.ui.client.event.ButtonEvent;
111 jpm 33
import com.extjs.gxt.ui.client.event.ComponentEvent;
214 jp_milcent 34
import com.extjs.gxt.ui.client.event.GridEvent;
243 jp_milcent 35
import com.extjs.gxt.ui.client.event.KeyListener;
111 jpm 36
import com.extjs.gxt.ui.client.event.Listener;
100 jpm 37
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
38
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
103 jpm 39
import com.extjs.gxt.ui.client.event.SelectionListener;
69 jpm 40
import com.extjs.gxt.ui.client.store.ListStore;
245 jp_milcent 41
import com.extjs.gxt.ui.client.store.Record;
42
import com.extjs.gxt.ui.client.store.Store;
43
import com.extjs.gxt.ui.client.store.StoreEvent;
111 jpm 44
import com.extjs.gxt.ui.client.widget.Component;
102 jpm 45
import com.extjs.gxt.ui.client.widget.ContentPanel;
569 jp_milcent 46
import com.extjs.gxt.ui.client.widget.Html;
153 jpm 47
import com.extjs.gxt.ui.client.widget.Info;
69 jpm 48
import com.extjs.gxt.ui.client.widget.LayoutContainer;
320 gduche 49
import com.extjs.gxt.ui.client.widget.MessageBox;
100 jpm 50
import com.extjs.gxt.ui.client.widget.TabItem;
51
import com.extjs.gxt.ui.client.widget.TabPanel;
69 jpm 52
import com.extjs.gxt.ui.client.widget.button.Button;
108 jpm 53
import com.extjs.gxt.ui.client.widget.form.CheckBox;
54
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
69 jpm 55
import com.extjs.gxt.ui.client.widget.form.ComboBox;
100 jpm 56
import com.extjs.gxt.ui.client.widget.form.DateField;
119 jpm 57
import com.extjs.gxt.ui.client.widget.form.Field;
100 jpm 58
import com.extjs.gxt.ui.client.widget.form.FieldSet;
172 jp_milcent 59
import com.extjs.gxt.ui.client.widget.form.HiddenField;
103 jpm 60
import com.extjs.gxt.ui.client.widget.form.LabelField;
102 jpm 61
import com.extjs.gxt.ui.client.widget.form.NumberField;
109 jpm 62
import com.extjs.gxt.ui.client.widget.form.Radio;
63
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
164 jp_milcent 64
import com.extjs.gxt.ui.client.widget.form.TextArea;
69 jpm 65
import com.extjs.gxt.ui.client.widget.form.TextField;
66
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
67
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
102 jpm 68
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
69
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
70
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
71
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
72
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
231 jp_milcent 73
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
74
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
69 jpm 75
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
76
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
77
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
100 jpm 78
import com.extjs.gxt.ui.client.widget.layout.FormData;
110 jpm 79
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
102 jpm 80
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
81
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
91 jpm 82
import com.google.gwt.core.client.GWT;
100 jpm 83
import com.google.gwt.i18n.client.DateTimeFormat;
102 jpm 84
import com.google.gwt.i18n.client.NumberFormat;
69 jpm 85
 
634 jp_milcent 86
public class StructureForm extends Formulaire implements Rafraichissable {
115 jpm 87
 
615 jp_milcent 88
	private static int decompteRafraichissementPersonnel = 0;
634 jp_milcent 89
 
775 jpm 90
	private TabPanel onglets = null;
206 jp_milcent 91
	private TabItem identificationOnglet = null;
192 jp_milcent 92
	private TabItem personnelOnglet = null;
93
	private TabItem conservationOnglet = null;
94
	private TabItem valorisationOnglet = null;
206 jp_milcent 95
 
96
	private HiddenField<String> idStructureChp = null;
115 jpm 97
 
206 jp_milcent 98
	// Onglet IDENTIFICATION
602 jp_milcent 99
	private Structure identification = null;
91 jpm 100
	private ListStore<Valeur> magazinLstpr = null;
101
	private ComboBox<Valeur> comboLstpr = null;
102
	private ListStore<Valeur> magazinLstpu = null;
103
	private ComboBox<Valeur> comboLstpu = null;
103 jpm 104
	private ListStore<Valeur> magazinLiStatut = null;
105
	private ComboBox<Valeur> comboLiStatut = null;
295 jp_milcent 106
	private ListStore<Valeur> fonctionsMagazin = null;
107
	private ComboBox<Valeur> fonctionsCombo = null;
100 jpm 108
	private ComboBox<InterneValeur> comboAcronyme = null;
109
	private TextField<String> ihChp = null;
110
	private TextField<String> mnhnChp = null;
111
	private ComboBox<InterneValeur> comboTypeStructure = null;
602 jp_milcent 112
	private TextField<String> nomStructureChp = null;
113
	private DateField dateFondationChp = null;
114
	private TextArea adrChp = null;
115
	private TextField<String> cpChp = null;
116
	private TextField<String> villeChp = null;
117
	private TextField<String> regionChp = null;
118
	private TextField<String> telChp = null;
119
	private TextField<String> faxChp = null;
120
	private TextField<String> emailChp = null;
121
	private TextField<String> urlChp = null;
122
	private ListStore<Valeur> magazinPays = null;
123
	private ComboBox<Valeur> comboPays = null;
192 jp_milcent 124
 
206 jp_milcent 125
	// Onglet PERSONNEL
602 jp_milcent 126
	private StructureAPersonneListe personnel = null;
231 jp_milcent 127
	private StructureAPersonneListe personnelAjoute = null;
128
	private StructureAPersonneListe personnelModifie = null;
129
	private StructureAPersonneListe personnelSupprime = null;
211 jp_milcent 130
	private NumberField nbreTotalPersonneStructureChp = null;
131
	private EditorGrid<StructureAPersonne> grillePersonnel = null;
132
	private ListStore<StructureAPersonne> personnelGrilleMagazin = null;
133
 
206 jp_milcent 134
	// Onglet CONSERVATION
211 jp_milcent 135
	private StructureConservation conservation = null;
602 jp_milcent 136
	private RadioGroup formationMarkRGrpChp = null;
137
	private RadioGroup interetFormationMarkRGrpChp = null;
138
	private RadioGroup collectionCommuneMarkRGrpChp = null;
139
	private RadioGroup accesControleMarkRGrpChp = null;
140
	private RadioGroup restaurationMarkRGrpChp = null;
141
	private RadioGroup traitementMarkRGrpChp = null;
142
	private RadioGroup collectionAcquisitionMarkRGrpChp = null;
143
	private RadioGroup echantillonAcquisitionMarkRGrpChp = null;
144
	private TextField<String> localStockageAutreChp = null;
145
	private TextField<String> meubleStockageAutreChp = null;
146
	private TextField<String> parametreStockageAutreChp = null;
147
	private TextField<String> collectionAutreAutreChp = null;
148
	private TextField<String> autreCollectionAutreChp = null;
149
	private TextField<String> opRestauAutreChp = null;
150
	private TextField<String> autreMaterielAutreChp = null;
151
	private TextField<String> poisonTraitementAutreChp = null;
152
	private TextField<String> traitementAutreChp = null;
153
	private TextField<String> insecteTraitementAutreChp = null;
154
	private TextField<String> actionAutreChp = null;
155
	private TextField<String> provenanceRechercheAutreChp = null;
156
	private TextField<String> typeRechercheAutreChp = null;
115 jpm 157
	private CheckBoxGroup localStockageTrukCacGrpChp = null;
569 jp_milcent 158
	private LayoutContainer localStockageTrukCp = null;
115 jpm 159
	private CheckBoxGroup meubleStockageTrukCacGrpChp = null;
569 jp_milcent 160
	private LayoutContainer meubleStockageTrukCp = null;
115 jpm 161
	private CheckBoxGroup parametreStockageTrukCacGrpChp = null;
569 jp_milcent 162
	private LayoutContainer parametreStockageTrukCp = null;
163
	private LayoutContainer collectionAutreTrukCp = null;
111 jpm 164
	private CheckBoxGroup collectionAutreTrukCacGrpChp = null;
115 jpm 165
	private CheckBoxGroup opRestauTrukCacGrpChp = null;
569 jp_milcent 166
	private LayoutContainer opRestauTrukCp = null;
115 jpm 167
	private CheckBoxGroup autreMaterielTrukCacGrpChp = null;
569 jp_milcent 168
	private LayoutContainer autreMaterielTrukCp = null;
169
	private LayoutContainer traitementTrukCp = null;
111 jpm 170
	private CheckBoxGroup traitementTrukCacGrpChp = null;
569 jp_milcent 171
	private LayoutContainer poisonTraitementTrukCp = null;
172
	private LayoutContainer insecteTraitementTrukCp = null;
111 jpm 173
	private CheckBoxGroup insecteTraitementTrukCacGrpChp = null;
115 jpm 174
	private CheckBoxGroup poisonTraitementTrukCacGrpChp = null;
569 jp_milcent 175
	private LayoutContainer autreCollectionTrukCp = null;
119 jpm 176
	private CheckBoxGroup autreCollectionTrukCacGrpChp = null;
569 jp_milcent 177
	private LayoutContainer provenanceRechercheTrukCp = null;
115 jpm 178
	private CheckBoxGroup provenanceRechercheTrukCacGrpChp = null;
179
	private CheckBoxGroup typeRechercheTrukCacGrpChp = null;
569 jp_milcent 180
	private LayoutContainer typeRechercheTrukCp = null;
115 jpm 181
	private TextField<String> futureActionChp = null;
182
	private TextField<String> sansMotifAccesChp = null;
183
	private TextField<String> avecMotifAccesChp = null;
184
	private TextField<String> formationChp = null;
185
	private RadioGroup traitementAcquisitionMarkRGrpChp = null;
186
	private LabelField traitementAcquisitionMarkLabel = null;
187
	private RadioGroup materielConservationCeRGrpChp = null;
119 jpm 188
 
206 jp_milcent 189
	// Onglet VALORISATION
211 jp_milcent 190
	private StructureValorisation valorisation = null;
206 jp_milcent 191
	private RadioGroup actionMarkRGrpChp = null;
569 jp_milcent 192
	private LayoutContainer actionTrukCp = null;
206 jp_milcent 193
	private CheckBoxGroup actionTrukCacGrpChp = null;
602 jp_milcent 194
	private RadioGroup futureActionMarkRGrpChp = null;
195
	private RadioGroup rechercheMarkRGrpChp = null;
196
	private RadioGroup sansMotifAccesMarkRGrpChp = null;
197
	private RadioGroup avecMotifAccesMarkRGrpChp = null;
198
	private TextField<String> publicationChp = null;
199
	private LayoutContainer materielConservationCp = null;
200
	private ListStore<Personne> personneExistanteMagazin = null;
201
	private ComboBox<Personne> personneExistanteCombo = null;
202
	private Button supprimerPersonnelBtn = null;
203
	private ListStore<Projet> projetsMagazin = null;
204
	private ComboBox<Projet> projetsCombo = null;
205
	private CellEditor fonctionEditor = null;
206
	private List<Valeur> fonctionsListe = null;
192 jp_milcent 207
 
444 jp_milcent 208
	public StructureForm(Mediateur mediateurCourrant, String modeDeCreation) {
648 jp_milcent 209
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.STRUCTURE);
775 jpm 210
		// Ajout du titre
211
		panneauFormulaire.setHeading(i18nC.titreAjoutFormStructurePanneau());
212
		// Création des onglets
213
		onglets = creerOnglets();
214
		// Ajout des onglets au formulaire général
215
		panneauFormulaire.add(onglets);
609 jp_milcent 216
	}
217
 
775 jpm 218
	protected TabPanel creerOnglets() {
219
		TabPanel ongletsStructure = new TabPanel();
110 jpm 220
		// 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 221
		ongletsStructure.setHeight("100%");
69 jpm 222
 
100 jpm 223
		// Onlget formulaire IDENTIFICATION
775 jpm 224
		ongletsStructure.add(creerOngletIdentification());
206 jp_milcent 225
 
100 jpm 226
		// Onlget formulaire PERSONNEL
775 jpm 227
		ongletsStructure.add(creerOngletPersonnel());
91 jpm 228
 
100 jpm 229
		// Onlget formulaire CONSERVATION
775 jpm 230
		ongletsStructure.add(creerOngletConservation());
100 jpm 231
 
232
		// Onlget formulaire VALORISATION
775 jpm 233
		ongletsStructure.add(creerOngletValorisation());
100 jpm 234
 
119 jpm 235
		// Sélection de l'onglet par défaut
775 jpm 236
		//ongletsStructure(personnelOnglet);
192 jp_milcent 237
 
775 jpm 238
		return ongletsStructure;
609 jp_milcent 239
	}
240
 
775 jpm 241
	protected SelectionListener<ButtonEvent> creerEcouteurValidation() {
634 jp_milcent 242
		SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
119 jpm 243
			@Override
491 gduche 244
			public void componentSelected(ButtonEvent ce) {
775 jpm 245
				String code = ((Button) ce.getComponent()).getData("code");
246
				if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
781 jpm 247
					soumettreFormulaire(renvoyerStructureForm());
609 jp_milcent 248
					clicBoutonvalidation = true;
775 jpm 249
				} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
781 jpm 250
					soumettreFormulaire(renvoyerStructureForm());
775 jpm 251
				} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
639 jp_milcent 252
					mediateur.clicMenu(menuIdCourant);
775 jpm 253
				} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
609 jp_milcent 254
					if (mode.equals(StructureForm.MODE_MODIFIER)) {
255
						mediateur.afficherFormStructure(identification.getId());
256
					} else {
257
						mediateur.afficherFormStructure(null);
258
					}
259
				}
119 jpm 260
			}
609 jp_milcent 261
		};
69 jpm 262
 
634 jp_milcent 263
		return ecouteur;
69 jpm 264
	}
781 jpm 265
 
266
	private StructureForm renvoyerStructureForm() {
267
		return this;
268
	}
269
 
270
	protected void soumettreFormulaire(Rafraichissable vueARafraichir) {
243 jp_milcent 271
		// Vérification de la validité des champs du formulaire
272
		if (verifierFormulaire()) {
273
			// Collecte des données du formulaire
274
			Structure structure = collecterStructureIdentification();
275
			StructureConservation conservation = collecterStructureConservation();
276
			StructureValorisation valorisation = collecterStructureValorisation();
277
			collecterStructurePersonnel();
278
 
634 jp_milcent 279
			if (mode.equals(MODE_AJOUTER)) {
243 jp_milcent 280
				// Ajout des informations sur la Structure
781 jpm 281
				mediateur.ajouterStructure(vueARafraichir, structure, conservation, valorisation);
243 jp_milcent 282
				// L'ajout des relations StructureAPersonne se fait quand la structure a été ajoutée
283
				// Voir la méthode rafraichir().
634 jp_milcent 284
			} else if (mode.equals(MODE_MODIFIER)) {
243 jp_milcent 285
				// Modification des informations sur la Structure
306 jp_milcent 286
				if (structure == null && conservation == null && valorisation == null) {
287
					Info.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
288
				} else {
289
					mediateur.modifierStructure(this, identification.getId(), structure, conservation, valorisation);
290
				}
291
				if (personnelModifie.size() == 0 && personnelAjoute.size() == 0 && personnelSupprime.size() == 0) {
292
					Info.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
293
				} else {
294
					if (personnelModifie.size() != 0) {
609 jp_milcent 295
						decompteRafraichissementPersonnel++;
781 jpm 296
						mediateur.modifierStructureAPersonne(vueARafraichir, personnelModifie);
306 jp_milcent 297
					}
298
					// Ajout des relations StructureAPersonne
299
					if (personnelAjoute.size() != 0) {
609 jp_milcent 300
						decompteRafraichissementPersonnel++;
781 jpm 301
						mediateur.ajouterStructureAPersonne(vueARafraichir, identification.getId(), personnelAjoute);
306 jp_milcent 302
					}
303
					// Suppression des relations StructureAPersonne
304
					if (personnelSupprime.size() != 0) {
609 jp_milcent 305
						decompteRafraichissementPersonnel++;
781 jpm 306
						mediateur.supprimerStructureAPersonne(vueARafraichir, personnelSupprime);
306 jp_milcent 307
					}
308
				}
243 jp_milcent 309
			}
310
		}
311
	}
312
 
313
	private Boolean verifierFormulaire() {
314
		ArrayList<String> messages = new ArrayList<String>();
231 jp_milcent 315
 
295 jp_milcent 316
		// Vérification des infos sur le nom de la structure
263 jp_milcent 317
		if (	(identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue() == null) ||
318
				(identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue().equals("")) ||
243 jp_milcent 319
				(identificationOnglet.getData("acces").equals(false) && identification.getNom().equals(""))) {
320
			messages.add("Veuillez indiquez un nom à l'institution.");
156 jp_milcent 321
		}
243 jp_milcent 322
 
295 jp_milcent 323
		// Vérification des infos sur le projet de la structure
324
		if (	(identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue() == null) ||
325
				(identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue().equals("")) ||
326
				(identificationOnglet.getData("acces").equals(false) && identification.getIdProjet().equals(""))) {
327
			messages.add("Veuillez sélectionner un projet pour l'institution.");
328
		}
329
 
243 jp_milcent 330
		// Vérification du Personnel
331
		if (personnelOnglet.getData("acces").equals(true)) {
332
			String personnelNumero = "";
333
			int nbrePersonne = personnelGrilleMagazin.getCount();
334
			for (int i = 0; i < nbrePersonne; i++) {
335
				StructureAPersonne personne = personnelGrilleMagazin.getAt(i);
336
				if (personne.getNom().equals("") || personne.getPrenom().equals("")) {
337
					personnelNumero += (i != 0 ? ", " : "")+(i+1);
338
				}
339
			}
340
			if (!personnelNumero.equals("")) {
341
				messages.add("Veuillez indiquez un prénom et un nom au personnel numéro : "+personnelNumero);
342
			}
343
		}
344
 
345
		// Affichage des messages d'alerte
346
		if (messages.size() != 0) {
347
			String[] a = {};
348
			a = messages.toArray(a);
320 gduche 349
			MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
243 jp_milcent 350
			return false;
351
		}
352
		return true;
119 jpm 353
	}
354
 
192 jp_milcent 355
	private StructureValorisation collecterStructureValorisation() {
306 jp_milcent 356
		StructureValorisation valorisationARetourner = null;
357
		if (valorisationOnglet.getData("acces").equals(true)) {
206 jp_milcent 358
			// Création de l'objet
306 jp_milcent 359
			StructureValorisation valorisationCollectee = (StructureValorisation) valorisation.cloner(new StructureValorisation());
206 jp_milcent 360
 
361
			// ACTION
362
			if (actionMarkRGrpChp.getValue() != null) {
306 jp_milcent 363
				valorisationCollectee.setAction(actionMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 364
			}
365
 
366
			// ACTION INFO
306 jp_milcent 367
			valorisationCollectee.setActionInfo(creerChaineDenormalisee(actionTrukCacGrpChp.getValues()));
368
			valorisationCollectee.setActionInfo("AUTRE", actionAutreChp.getValue());
206 jp_milcent 369
 
370
			// PUBLICATION
306 jp_milcent 371
			valorisationCollectee.setPublication(publicationChp.getValue());
206 jp_milcent 372
 
373
			// COLLECTION AUTRE
306 jp_milcent 374
			valorisationCollectee.setCollectionAutre(creerChaineDenormalisee(autreCollectionTrukCacGrpChp.getValues()));
375
			valorisationCollectee.setCollectionAutre("AUTRE", autreCollectionAutreChp.getValue());
206 jp_milcent 376
 
377
			// ACTION FUTURE
378
			if (futureActionMarkRGrpChp.getValue() != null) {
306 jp_milcent 379
				valorisationCollectee.setActionFuture(futureActionMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 380
			}
381
			// ACTION FUTURE INFO
306 jp_milcent 382
			valorisationCollectee.setActionFutureInfo(futureActionChp.getValue());
206 jp_milcent 383
 
384
			// RECHERCHE
385
			if (rechercheMarkRGrpChp.getValue() != null) {
306 jp_milcent 386
				valorisationCollectee.setRecherche(rechercheMarkRGrpChp.getValue().getValueAttribute());
602 jp_milcent 387
 
388
				// RECHERCHE PROVENANCE
389
				valorisationCollectee.setRechercheProvenance(creerChaineDenormalisee(provenanceRechercheTrukCacGrpChp.getValues()));
390
				valorisationCollectee.setRechercheProvenance("AUTRE", provenanceRechercheAutreChp.getValue());
391
 
392
				// RECHERCHE TYPE
393
				valorisationCollectee.setRechercheType(creerChaineDenormalisee(typeRechercheTrukCacGrpChp.getValues()));
394
				valorisationCollectee.setRechercheType("AUTRE", typeRechercheAutreChp.getValue());
206 jp_milcent 395
			}
396
 
397
			// ACCÈS SANS MOTIF
398
			if (sansMotifAccesMarkRGrpChp.getValue() != null) {
306 jp_milcent 399
				valorisationCollectee.setAccesSansMotif(sansMotifAccesMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 400
			}
401
			// ACCÈS SANS MOTIF INFO
306 jp_milcent 402
			valorisationCollectee.setAccesSansMotifInfo(sansMotifAccesChp.getValue());
206 jp_milcent 403
 
404
			// VISITE AVEC MOTIF
405
			if (avecMotifAccesMarkRGrpChp.getValue() != null) {
306 jp_milcent 406
				valorisationCollectee.setVisiteAvecMotif(avecMotifAccesMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 407
			}
408
			// VISITE AVEC MOTIF INFO
306 jp_milcent 409
			valorisationCollectee.setVisiteAvecMotifInfo(avecMotifAccesChp.getValue());
206 jp_milcent 410
 
306 jp_milcent 411
			// Retour de l'objet
412
			if (!valorisationCollectee.comparer(valorisation)) {
413
				valorisationARetourner = valorisation = valorisationCollectee;
414
			}
192 jp_milcent 415
		}
306 jp_milcent 416
		return valorisationARetourner;
192 jp_milcent 417
	}
418
 
419
	private void peuplerStructureValorisation() {
605 jp_milcent 420
		if (mode.equals(MODE_AJOUTER)) {
421
			// Indique que l'onglet a pu être modifié pour la méthode collecter...
422
			valorisationOnglet.setData("acces", true);
423
			// Initialisation de l'objet Structure
424
			valorisation = new StructureValorisation();
425
		}
426
		if (mode.equals(MODE_MODIFIER) && valorisation != null && valorisationOnglet.getData("acces").equals(false)) {
491 gduche 427
			// ACTION :
428
			//TODO : check below:
429
			((Radio) actionMarkRGrpChp.get((valorisation.getAction().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 430
 
431
			// ACTION INFO
432
			peuplerCasesACocher(valorisation.getActionInfo(), actionTrukCacGrpChp, actionAutreChp);
433
 
434
			// PUBLICATION
435
			publicationChp.setValue(valorisation.getPublication());
436
 
437
			// COLLECTION AUTRE
438
			peuplerCasesACocher(valorisation.getCollectionAutre(), autreCollectionTrukCacGrpChp, autreCollectionAutreChp);
439
 
440
			// ACTION FUTURE
491 gduche 441
			((Radio) futureActionMarkRGrpChp.get((valorisation.getActionFuture().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 442
 
443
			// ACTION FUTURE INFO
444
			futureActionChp.setValue(valorisation.getActionFutureInfo());
445
 
446
			// RECHERCHE
491 gduche 447
			((Radio) rechercheMarkRGrpChp.get((valorisation.getRecherche().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 448
			// RECHERCHE PROVENANCE
449
			peuplerCasesACocher(valorisation.getRechercheProvenance(), provenanceRechercheTrukCacGrpChp, provenanceRechercheAutreChp);
450
			// RECHERCHE TYPE
451
			peuplerCasesACocher(valorisation.getRechercheType(), typeRechercheTrukCacGrpChp, typeRechercheAutreChp);
452
 
453
			// ACCÈS SANS MOTIF
491 gduche 454
			((Radio) sansMotifAccesMarkRGrpChp.get((valorisation.getAccesSansMotif().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 455
			// ACCÈS SANS MOTIF INFO
456
			sansMotifAccesChp.setValue(valorisation.getAccesSansMotifInfo());
457
 
458
			// VISITE AVEC MOTIF
491 gduche 459
			((Radio) avecMotifAccesMarkRGrpChp.get((valorisation.getVisiteAvecMotif().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 460
			// VISITE AVEC MOTIF INFO
461
			avecMotifAccesChp.setValue(valorisation.getVisiteAvecMotifInfo());
211 jp_milcent 462
 
243 jp_milcent 463
			// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
464
			valorisationOnglet.setData("acces", true);
206 jp_milcent 465
		}
192 jp_milcent 466
	}
467
 
468
	private StructureConservation collecterStructureConservation() {
306 jp_milcent 469
		StructureConservation conservationARetourner = null;
470
		if (conservationOnglet.getData("acces").equals(true)) {
605 jp_milcent 471
			GWT.log("Début récupé", null);
206 jp_milcent 472
			// Création de l'objet
306 jp_milcent 473
			StructureConservation conservationCollectee = (StructureConservation) conservation.cloner(new StructureConservation());
192 jp_milcent 474
 
206 jp_milcent 475
			// FORMATION
476
			if (formationMarkRGrpChp.getValue() != null) {
306 jp_milcent 477
				conservationCollectee.setFormation(formationMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 478
			}
479
			// FORMATION INFO
306 jp_milcent 480
			conservationCollectee.setFormationInfo(formationChp.getValue());
206 jp_milcent 481
			// FORMATION INTERET
482
			if (interetFormationMarkRGrpChp.getValue() != null) {
306 jp_milcent 483
				conservationCollectee.setFormationInteret(interetFormationMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 484
			}
485
 
486
			// STOCKAGE LOCAL
306 jp_milcent 487
			conservationCollectee.setStockageLocal(creerChaineDenormalisee(localStockageTrukCacGrpChp.getValues()));
488
			conservationCollectee.setStockageLocal("AUTRE", localStockageAutreChp.getValue());
206 jp_milcent 489
 
490
			// STOCKAGE MEUBLE
306 jp_milcent 491
			conservationCollectee.setStockageMeuble(creerChaineDenormalisee(meubleStockageTrukCacGrpChp.getValues()));
492
			conservationCollectee.setStockageMeuble("AUTRE", meubleStockageAutreChp.getValue());
206 jp_milcent 493
 
494
			// STOCKAGE PAREMETRE
306 jp_milcent 495
			conservationCollectee.setStockageParametre(creerChaineDenormalisee(parametreStockageTrukCacGrpChp.getValues()));
496
			conservationCollectee.setStockageParametre("AUTRE", parametreStockageAutreChp.getValue());
206 jp_milcent 497
 
498
			// COLLECTION COMMUNE
499
			if (collectionCommuneMarkRGrpChp.getValue() != null) {
306 jp_milcent 500
				conservationCollectee.setCollectionCommune(collectionCommuneMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 501
			}
502
			// COLLECTION AUTRE
306 jp_milcent 503
			conservationCollectee.setCollectionAutre(creerChaineDenormalisee(collectionAutreTrukCacGrpChp.getValues()));
504
			conservationCollectee.setCollectionAutre("AUTRE", collectionAutreAutreChp.getValue());
206 jp_milcent 505
 
506
			// ACCÈS CONTROLÉ
507
			if (accesControleMarkRGrpChp.getValue() != null) {
306 jp_milcent 508
				conservationCollectee.setAccesControle(accesControleMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 509
			}
510
 
511
			// RESTAURATION
512
			if (restaurationMarkRGrpChp.getValue() != null) {
306 jp_milcent 513
				conservationCollectee.setRestauration(restaurationMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 514
			}
515
			// RESTAURATION OPÉRATION
306 jp_milcent 516
			conservationCollectee.setRestaurationOperation(creerChaineDenormalisee(opRestauTrukCacGrpChp.getValues()));
517
			conservationCollectee.setRestaurationOperation("AUTRE", opRestauAutreChp.getValue());
206 jp_milcent 518
 
519
			// MATERIEL CONSERVATION
520
			if (materielConservationCeRGrpChp.getValue() != null) {
306 jp_milcent 521
				conservationCollectee.setMaterielConservation(materielConservationCeRGrpChp.getValue().getValueAttribute());
428 jp_milcent 522
 
523
				// MATERIEL AUTRE
524
				conservationCollectee.setMaterielAutre(creerChaineDenormalisee(autreMaterielTrukCacGrpChp.getValues()));
525
				conservationCollectee.setMaterielAutre("AUTRE", autreMaterielAutreChp.getValue());
206 jp_milcent 526
			}
527
 
528
			// TRAITEMENT
529
			if (traitementMarkRGrpChp.getValue() != null) {
306 jp_milcent 530
				conservationCollectee.setTraitement(traitementMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 531
			}
532
			// TRAIEMENTS
306 jp_milcent 533
			conservationCollectee.setTraitements(creerChaineDenormalisee(traitementTrukCacGrpChp.getValues()));
534
			conservationCollectee.setTraitements("AUTRE", traitementAutreChp.getValue());
206 jp_milcent 535
 
536
 
537
			// ACQUISITION COLLECTION
538
			if (collectionAcquisitionMarkRGrpChp.getValue() != null) {
306 jp_milcent 539
				conservationCollectee.setAcquisitionCollection(collectionAcquisitionMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 540
			}
541
 
542
			// ACQUISITION ECHANTILLON
543
			if (echantillonAcquisitionMarkRGrpChp.getValue() != null) {
306 jp_milcent 544
				conservationCollectee.setAcquisitionEchantillon(echantillonAcquisitionMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 545
			}
546
			// ACQUISITION TRAITEMENT
547
			if (traitementAcquisitionMarkRGrpChp.getValue() != null) {
306 jp_milcent 548
				conservationCollectee.setAcquisitionTraitement(traitementAcquisitionMarkRGrpChp.getValue().getValueAttribute());
206 jp_milcent 549
			}
550
			// ACQUISITION TRAITEMENT POISON
306 jp_milcent 551
			conservationCollectee.setAcquisitionTraitementPoison(creerChaineDenormalisee(poisonTraitementTrukCacGrpChp.getValues()));
552
			conservationCollectee.setAcquisitionTraitementPoison("AUTRE", poisonTraitementAutreChp.getValue());
206 jp_milcent 553
			// ACQUISITION TRAITEMENT INSECTE
306 jp_milcent 554
			conservationCollectee.setAcquisitionTraitementInsecte(creerChaineDenormalisee(insecteTraitementTrukCacGrpChp.getValues()));
555
			conservationCollectee.setAcquisitionTraitementInsecte("AUTRE", insecteTraitementAutreChp.getValue());
206 jp_milcent 556
 
557
			// Retour de l'objet
306 jp_milcent 558
			if (!conservationCollectee.comparer(conservation)) {
605 jp_milcent 559
				GWT.log("Collecte différent de Retour", null);
306 jp_milcent 560
				conservationARetourner = conservation = conservationCollectee;
561
			}
192 jp_milcent 562
		}
306 jp_milcent 563
		return conservationARetourner;
188 jp_milcent 564
	}
565
 
192 jp_milcent 566
	private void peuplerStructureConservation() {
605 jp_milcent 567
		if (mode.equals(MODE_AJOUTER)) {
568
			// Indique que l'onglet a pu être modifié pour la méthode collecter...
569
			conservationOnglet.setData("acces", true);
570
			// Initialisation de l'objet Structure
571
			conservation = new StructureConservation();
572
		}
573
		if (mode.equals(MODE_MODIFIER) && conservation != null && conservationOnglet.getData("acces").equals(false)) {
206 jp_milcent 574
			// FORMATION
575
			// Bouton oui, à toujours l'index 0 donc on teste en fonction...
491 gduche 576
			((Radio) formationMarkRGrpChp.get((conservation.getFormation().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 577
			// FORMATION INFO
578
			formationChp.setValue(conservation.getFormationInfo());
579
			// FORMATION INTERET
491 gduche 580
			((Radio) interetFormationMarkRGrpChp.get((conservation.getFormationInteret().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 581
 
582
			// STOCKAGE LOCAL
583
			peuplerCasesACocher(conservation.getStockageLocal(), localStockageTrukCacGrpChp,localStockageAutreChp);
584
 
585
			// STOCKAGE MEUBLE
586
			peuplerCasesACocher(conservation.getStockageMeuble(), meubleStockageTrukCacGrpChp, meubleStockageAutreChp);
587
 
588
			// STOCKAGE PAREMETRE
589
			peuplerCasesACocher(conservation.getStockageParametre(), parametreStockageTrukCacGrpChp, parametreStockageAutreChp);
590
 
591
			// COLLECTION COMMUNE
491 gduche 592
			((Radio) collectionCommuneMarkRGrpChp.get((conservation.getCollectionCommune().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 593
			// COLLECTION AUTRE
594
			peuplerCasesACocher(conservation.getCollectionAutre(), collectionAutreTrukCacGrpChp, collectionAutreAutreChp);
595
 
596
			// ACCÈS CONTROLÉ
491 gduche 597
			((Radio) accesControleMarkRGrpChp.get((conservation.getAccesControle().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 598
 
599
			// RESTAURATION
491 gduche 600
			((Radio) restaurationMarkRGrpChp.get((conservation.getRestauration().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 601
			// RESTAURATION OPÉRATION
602
			peuplerCasesACocher(conservation.getRestaurationOperation(), opRestauTrukCacGrpChp, opRestauAutreChp);
603
 
604
			// MATERIEL CONSERVATION
605
			peuplerBoutonsRadio(conservation.getMaterielConservation(), materielConservationCeRGrpChp);
606
 
607
			// MATERIEL AUTRE
608
			peuplerCasesACocher(conservation.getMaterielAutre(), autreMaterielTrukCacGrpChp, autreMaterielAutreChp);
609
 
610
			// TRAITEMENT
491 gduche 611
			((Radio) traitementMarkRGrpChp.get((conservation.getTraitement().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 612
			// TRAITEMENTS
613
			peuplerCasesACocher(conservation.getTraitements(), traitementTrukCacGrpChp, traitementAutreChp);
614
 
615
			// ACQUISITION COLLECTION
491 gduche 616
			((Radio) collectionAcquisitionMarkRGrpChp.get((conservation.getAcquisitionCollection().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 617
 
618
			// ACQUISITION ECHANTILLON
491 gduche 619
			((Radio) echantillonAcquisitionMarkRGrpChp.get((conservation.getAcquisitionEchantillon().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 620
 
621
			// ACQUISITION TRAITEMENT
491 gduche 622
			((Radio) traitementAcquisitionMarkRGrpChp.get((conservation.getAcquisitionTraitement().equals("1") ? 0 : 1))).setValue(true);
206 jp_milcent 623
			// ACQUISITION TRAITEMENT POISON
624
			peuplerCasesACocher(conservation.getAcquisitionTraitementPoison(), poisonTraitementTrukCacGrpChp, poisonTraitementAutreChp);
625
			// ACQUISITION TRAITEMENT INSECTE
626
			peuplerCasesACocher(conservation.getAcquisitionTraitementInsecte(), insecteTraitementTrukCacGrpChp, insecteTraitementAutreChp);
211 jp_milcent 627
 
243 jp_milcent 628
			// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
629
			conservationOnglet.setData("acces", true);
206 jp_milcent 630
		}
188 jp_milcent 631
	}
632
 
192 jp_milcent 633
	private Structure collecterStructureIdentification() {
306 jp_milcent 634
		Structure structureARetourner = null;
635
		if (identificationOnglet.getData("acces").equals(true)) {
636
 
637
			Structure structureCollectee = (Structure) identification.cloner(new Structure());
638
 
639
			structureCollectee.setId(idStructureChp.getValue());
640
			structureCollectee.setNom(nomStructureChp.getValue());
277 jp_milcent 641
			// Récupération de l'identifiant du projet
642
			if (projetsCombo.getValue() != null) {
306 jp_milcent 643
				structureCollectee.setIdProjet(projetsCombo.getValue().getId());
277 jp_milcent 644
			}
211 jp_milcent 645
			// Récupération de l'acronyme (= identifiant alternatif)
306 jp_milcent 646
			structureCollectee.setIdAlternatif(null);
211 jp_milcent 647
			if (comboAcronyme.getValue() != null) {
648
				String typeAcronyme = comboAcronyme.getValue().getAbr();
649
				if (typeAcronyme == "IH") {
306 jp_milcent 650
					structureCollectee.setIdAlternatif(typeAcronyme+"##"+ihChp.getValue());
211 jp_milcent 651
				} else if (typeAcronyme == "MNHN") {
306 jp_milcent 652
					structureCollectee.setIdAlternatif(typeAcronyme+"##"+mnhnChp.getValue());
211 jp_milcent 653
				}
164 jp_milcent 654
			}
211 jp_milcent 655
			// Récupération statut de la structure
306 jp_milcent 656
			structureCollectee.setTypePublic(null);
657
			structureCollectee.setTypePrive(null);
211 jp_milcent 658
			if (comboTypeStructure.getValue() != null) {
659
				String typeStructure = comboTypeStructure.getValue().getAbr();
660
				if (typeStructure == "stpu" && comboLstpu.getValue() != null) {
306 jp_milcent 661
					structureCollectee.setTypePublic(comboLstpu.getValue().getId());
211 jp_milcent 662
				} else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
306 jp_milcent 663
					structureCollectee.setTypePrive(comboLstpr.getValue().getId());
211 jp_milcent 664
				}
164 jp_milcent 665
			}
306 jp_milcent 666
			structureCollectee.setDateFondation(dateFondationChp.getValue());
211 jp_milcent 667
 
306 jp_milcent 668
			structureCollectee.setAdresse(adrChp.getValue());
669
			structureCollectee.setCodePostal(cpChp.getValue());
670
			structureCollectee.setVille(villeChp.getValue());
671
			structureCollectee.setRegion(regionChp.getValue());
672
			structureCollectee.setPays(null);
211 jp_milcent 673
			if (comboPays.getValue() != null) {
419 jp_milcent 674
				structureCollectee.setPays(comboPays.getValue().getId());
211 jp_milcent 675
			} else if (comboPays.getRawValue() != "") {
306 jp_milcent 676
				structureCollectee.setPays(comboPays.getRawValue());
211 jp_milcent 677
			}
678
 
602 jp_milcent 679
			structureCollectee.setTelephoneFixe(telChp.getValue());
306 jp_milcent 680
			structureCollectee.setFax(faxChp.getValue());
681
			structureCollectee.setCourriel(emailChp.getValue());
682
			structureCollectee.setUrl(Structure.URL_SITE, urlChp.getValue());
211 jp_milcent 683
 
263 jp_milcent 684
			if (nbreTotalPersonneStructureChp.getValue() != null) {
306 jp_milcent 685
				structureCollectee.setNbrePersonne(nbreTotalPersonneStructureChp.getValue().intValue());
263 jp_milcent 686
			}
231 jp_milcent 687
 
306 jp_milcent 688
			if (!structureCollectee.comparer(identification)) {
689
				structureARetourner = identification = structureCollectee;
690
			}
691
 
164 jp_milcent 692
		}
306 jp_milcent 693
		return structureARetourner;
119 jpm 694
	}
695
 
211 jp_milcent 696
	private void peuplerStructureIdentification() {
295 jp_milcent 697
		if (mode.equals(MODE_AJOUTER)) {
263 jp_milcent 698
			// Indique que l'ongleta pu être modifié pour la méthode collecter...
699
			identificationOnglet.setData("acces", true);
306 jp_milcent 700
			// Initialisation de l'objet Structure
701
			identification = new Structure();
279 jp_milcent 702
			// Indication du projet sélectionné par défaut
703
			String projetCourantId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getProjetId();
295 jp_milcent 704
			if (projetCourantId != null && !projetCourantId.equals("0")) {
279 jp_milcent 705
				projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", projetCourantId));
706
			}
263 jp_milcent 707
		}
295 jp_milcent 708
		if (mode.equals(MODE_MODIFIER) && identification != null && identificationOnglet.getData("acces").equals(false)) {
211 jp_milcent 709
			idStructureChp.setValue(identification.getId());
710
			nomStructureChp.setValue(identification.getNom());
277 jp_milcent 711
			if (!identification.getIdProjet().equals("0")) {
712
				projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", identification.getIdProjet()));
713
			}
714
 
211 jp_milcent 715
			if (!identification.getIdAlternatif().isEmpty()) {
716
				String[] acronyme = identification.getIdAlternatif().split("##");
717
				if (acronyme[0].matches("^IH$")) {
718
					comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeIH());
719
					ihChp.setValue(acronyme[1]);
720
				} else if (acronyme[0].matches("^MNHN$")) {
721
					comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeMNHN());
722
					mnhnChp.setValue(acronyme[1]);
723
				}
188 jp_milcent 724
			}
211 jp_milcent 725
			if (!identification.getTypePrive().isEmpty()) {
726
				if (identification.getTypePrive().matches("^[0-9]+$")) {
727
					comboTypeStructure.setValue(InterneValeurListe.getTypePrivee());
728
					comboLstpr.setValue(comboLstpr.getStore().findModel("id_valeur", identification.getTypePrive()));
729
				}
730
			} else if (!identification.getTypePublic().isEmpty()) {
731
				if (identification.getTypePublic().matches("^[0-9]+$")) {
732
					comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
733
					comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
734
				}
172 jp_milcent 735
			}
211 jp_milcent 736
			dateFondationChp.setValue(identification.getDateFondation());
737
 
738
			adrChp.setValue(identification.getAdresse());
739
			cpChp.setValue(identification.getCodePostal());
740
			villeChp.setValue(identification.getVille());
741
			regionChp.setValue(identification.getRegion());
419 jp_milcent 742
			if (identification.getPays().matches("^[0-9]+$")) {
743
				comboPays.setValue(comboPays.getStore().findModel("id_valeur", identification.getPays()));
211 jp_milcent 744
			} else {
745
				comboPays.setRawValue(identification.getPays());
172 jp_milcent 746
			}
211 jp_milcent 747
 
602 jp_milcent 748
			telChp.setValue(identification.getTelephoneFixe());
211 jp_milcent 749
			faxChp.setValue(identification.getFax());
750
			emailChp.setValue(identification.getCourriel());
751
			urlChp.setValue(identification.getUrl("WEB"));
752
 
231 jp_milcent 753
			nbreTotalPersonneStructureChp.setValue(identification.getNbrePersonne());
754
 
243 jp_milcent 755
			// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
756
			identificationOnglet.setData("acces", true);
172 jp_milcent 757
		}
156 jp_milcent 758
	}
759
 
111 jpm 760
	private TabItem creerOngletValorisation() {
634 jp_milcent 761
		valorisationOnglet = creerOnglet("Valorisation", "valorisation");
569 jp_milcent 762
		valorisationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP));
634 jp_milcent 763
		Listener<ComponentEvent> ecouteurSelection = new Listener<ComponentEvent>() {
764
			public void handleEvent(ComponentEvent be) {
192 jp_milcent 765
				peuplerStructureValorisation();
634 jp_milcent 766
				valorisationOnglet.layout();
767
			}
768
		};
769
		valorisationOnglet.addListener(Events.Select, ecouteurSelection);
111 jpm 770
 
119 jpm 771
		actionMarkRGrpChp = creerChoixUniqueRadioGroupe("action_mark", "ouiNon");
111 jpm 772
		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 ?");
773
		valorisationOnglet.add(actionMarkRGrpChp);
774
 
119 jpm 775
 
569 jp_milcent 776
		actionTrukCp = creerChoixMultipleCp();
111 jpm 777
		actionTrukCp.hide();
115 jpm 778
		actionTrukCacGrpChp = new CheckBoxGroup();
779
		actionTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
111 jpm 780
		valorisationOnglet.add(actionTrukCp);
569 jp_milcent 781
		mediateur.obtenirListeValeurEtRafraichir(this, "actionValorisation");
111 jpm 782
 
206 jp_milcent 783
		publicationChp = new TextArea();
111 jpm 784
		publicationChp.setFieldLabel("Quelques titres des ouvrages, articles scientifiques, ...");
206 jp_milcent 785
		valorisationOnglet.add(publicationChp, new FormData(550, 0));
111 jpm 786
 
569 jp_milcent 787
		autreCollectionTrukCp = creerChoixMultipleCp();
119 jpm 788
		autreCollectionTrukCacGrpChp = new CheckBoxGroup();
789
		autreCollectionTrukCacGrpChp.setFieldLabel("L'organisme dispose-t-il d'autres collections (permettant une valorisation pluridisciplinaire) ?");
111 jpm 790
		valorisationOnglet.add(autreCollectionTrukCp);
569 jp_milcent 791
		mediateur.obtenirListeValeurEtRafraichir(this, "autreCollection");
111 jpm 792
 
188 jp_milcent 793
		futureActionMarkRGrpChp = creerChoixUniqueRadioGroupe("future_action_mark", "ouiNon");
111 jpm 794
		futureActionMarkRGrpChp.setFieldLabel("Envisagez vous des actions de valorisation dans le cadre de votre politique culturelle ?");
795
		valorisationOnglet.add(futureActionMarkRGrpChp);
796
 
206 jp_milcent 797
		futureActionChp = new TextArea();
111 jpm 798
		futureActionChp.setFieldLabel("Si oui, lesquelles ?");
799
		futureActionChp.hide();
306 jp_milcent 800
		futureActionChp.addListener(Events.Hide, new Listener<BaseEvent>() {
801
 
802
			public void handleEvent(BaseEvent be) {
491 gduche 803
				((TextArea) be.getSource()).setValue("");
306 jp_milcent 804
			}
805
 
806
		});
206 jp_milcent 807
		valorisationOnglet.add(futureActionChp, new FormData(550, 0));
111 jpm 808
 
188 jp_milcent 809
		rechercheMarkRGrpChp = creerChoixUniqueRadioGroupe("recherche_mark", "ouiNon");
111 jpm 810
		rechercheMarkRGrpChp.setFieldLabel("Vos collections botaniques sont-elles utilisées pour des recherches scientifiques ?");
811
		valorisationOnglet.add(rechercheMarkRGrpChp);
812
 
569 jp_milcent 813
		provenanceRechercheTrukCp = creerChoixMultipleCp();
111 jpm 814
		provenanceRechercheTrukCp.hide();
115 jpm 815
		provenanceRechercheTrukCacGrpChp = new CheckBoxGroup();
816
		provenanceRechercheTrukCacGrpChp.setFieldLabel("Si oui, par des chercheurs (professionnels ou amateurs) de quelle provenance ?");
111 jpm 817
		valorisationOnglet.add(provenanceRechercheTrukCp);
614 jp_milcent 818
		mediateur.obtenirListeValeurEtRafraichir(this, "continentEtFr");
111 jpm 819
 
569 jp_milcent 820
		typeRechercheTrukCp = creerChoixMultipleCp();
119 jpm 821
		typeRechercheTrukCp.hide();
115 jpm 822
		typeRechercheTrukCacGrpChp = new CheckBoxGroup();
823
		typeRechercheTrukCacGrpChp.setFieldLabel("Et pour quelles recherches ?");
119 jpm 824
		valorisationOnglet.add(typeRechercheTrukCp);
569 jp_milcent 825
		mediateur.obtenirListeValeurEtRafraichir(this, "typeRecherche");
111 jpm 826
 
188 jp_milcent 827
		sansMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("sans_motif_acces_mark", "ouiNon");
111 jpm 828
		sansMotifAccesMarkRGrpChp.setFieldLabel("Peut-on consulter vos collections botaniques sans motif de recherches scientifiques ?");
829
		valorisationOnglet.add(sansMotifAccesMarkRGrpChp);
830
 
206 jp_milcent 831
		valorisationOnglet.add(sansMotifAccesChp = new TextArea(), new FormData(550, 0));
111 jpm 832
		sansMotifAccesChp.hide();
306 jp_milcent 833
		sansMotifAccesChp.addListener(Events.Hide, new Listener<BaseEvent>() {
834
 
835
			public void handleEvent(BaseEvent be) {
491 gduche 836
				((TextArea) be.getSource()).setValue("");
306 jp_milcent 837
			}
838
 
839
		});
111 jpm 840
		sansMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les consulter ?");
841
 
188 jp_milcent 842
		avecMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("avec_motif_acces_mark", "ouiNon");
111 jpm 843
		avecMotifAccesMarkRGrpChp.setFieldLabel("Peut-on visiter vos collections botaniques avec des objectifs de recherches scientifiques ?");
844
		valorisationOnglet.add(avecMotifAccesMarkRGrpChp);
845
 
206 jp_milcent 846
		valorisationOnglet.add(avecMotifAccesChp = new TextArea(), new FormData(550, 0));
111 jpm 847
		avecMotifAccesChp.hide();
306 jp_milcent 848
		avecMotifAccesChp.addListener(Events.Hide, new Listener<BaseEvent>() {
849
 
850
			public void handleEvent(BaseEvent be) {
491 gduche 851
				((TextArea) be.getSource()).setValue("");
306 jp_milcent 852
			}
853
 
854
		});
111 jpm 855
		avecMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les visiter ?");
856
 
857
		return valorisationOnglet;
858
	}
859
 
108 jpm 860
	private TabItem creerOngletConservation() {
634 jp_milcent 861
		conservationOnglet = creerOnglet("Conservation", "conservation");
569 jp_milcent 862
		conservationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP));
634 jp_milcent 863
		Listener<ComponentEvent> ecouteurSelection = new Listener<ComponentEvent>() {
864
			public void handleEvent(ComponentEvent be) {
206 jp_milcent 865
				peuplerStructureConservation();
279 jp_milcent 866
				conservationOnglet.layout();
192 jp_milcent 867
			}
634 jp_milcent 868
		};
869
		conservationOnglet.addListener(Events.Select, ecouteurSelection);
108 jpm 870
 
188 jp_milcent 871
		formationMarkRGrpChp = creerChoixUniqueRadioGroupe("formation_mark", "ouiNon");
872
		formationMarkRGrpChp.setFieldLabel("Le personnel s'occupant des collections a-t-il suivi des formations en conservations ?");
873
		conservationOnglet.add(formationMarkRGrpChp);
108 jpm 874
 
401 jp_milcent 875
		formationChp = new TextArea();
111 jpm 876
		formationChp.hide();
306 jp_milcent 877
		formationChp.addListener(Events.Hide, new Listener<BaseEvent>() {
878
 
879
			public void handleEvent(BaseEvent be) {
491 gduche 880
				((TextArea) be.getSource()).setValue("");
306 jp_milcent 881
			}
882
 
883
		});
111 jpm 884
		formationChp.setFieldLabel("Si oui, lesquelles ?");
108 jpm 885
		conservationOnglet.add(formationChp);
886
 
188 jp_milcent 887
		interetFormationMarkRGrpChp = creerChoixUniqueRadioGroupe("interet_formation_mark", "ouiNon");
888
		interetFormationMarkRGrpChp.setFieldLabel("Seriez vous intéressé par une formation à la conservation et à la restauration d'herbier ?");
889
		conservationOnglet.add(interetFormationMarkRGrpChp);
108 jpm 890
 
115 jpm 891
		localStockageTrukCacGrpChp = new CheckBoxGroup();
892
		localStockageTrukCacGrpChp.setFieldLabel("Avez vous des locaux spécifiques de stockage des collections botaniques ?");
569 jp_milcent 893
		localStockageTrukCp = creerChoixMultipleCp();
115 jpm 894
		conservationOnglet.add(localStockageTrukCp);
569 jp_milcent 895
		mediateur.obtenirListeValeurEtRafraichir(this, "localStockage");
108 jpm 896
 
569 jp_milcent 897
		meubleStockageTrukCp = creerChoixMultipleCp();
115 jpm 898
		meubleStockageTrukCacGrpChp = new CheckBoxGroup();
899
		meubleStockageTrukCacGrpChp.setFieldLabel("Avez vous des meubles spécifiques au stockage des collections botaniques ?");
900
		conservationOnglet.add(meubleStockageTrukCp);
569 jp_milcent 901
		mediateur.obtenirListeValeurEtRafraichir(this, "meubleStockage");
108 jpm 902
 
569 jp_milcent 903
		parametreStockageTrukCp = creerChoixMultipleCp();
115 jpm 904
		parametreStockageTrukCacGrpChp = new CheckBoxGroup();
905
		parametreStockageTrukCacGrpChp.setFieldLabel("Quels paramètres maîtrisez vous ?");
906
		conservationOnglet.add(parametreStockageTrukCp);
569 jp_milcent 907
		mediateur.obtenirListeValeurEtRafraichir(this, "parametreStockage");
109 jpm 908
 
188 jp_milcent 909
		collectionCommuneMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_commune_mark", "ouiNon");
111 jpm 910
		collectionCommuneMarkRGrpChp.setFieldLabel("Les collections botaniques sont-elles conservées avec d'autres collections  dans les mêmes locaux (problème de conservation en commun) ?");
911
		conservationOnglet.add(collectionCommuneMarkRGrpChp);
109 jpm 912
 
569 jp_milcent 913
		collectionAutreTrukCp = creerChoixMultipleCp();
115 jpm 914
		collectionAutreTrukCacGrpChp = new CheckBoxGroup();
915
		collectionAutreTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
111 jpm 916
		collectionAutreTrukCp.hide();
917
		conservationOnglet.add(collectionAutreTrukCp);
569 jp_milcent 918
		mediateur.obtenirListeValeurEtRafraichir(this, "autreCollection");
110 jpm 919
 
188 jp_milcent 920
		accesControleMarkRGrpChp = creerChoixUniqueRadioGroupe("mark_acces_controle", "ouiNon");
115 jpm 921
		accesControleMarkRGrpChp.setFieldLabel("L'accès à vos collections botanique est-il contrôlé (ex. : manipulation réservées à des personnes compétentes) ?");
922
		conservationOnglet.add(accesControleMarkRGrpChp);
110 jpm 923
 
188 jp_milcent 924
		restaurationMarkRGrpChp = creerChoixUniqueRadioGroupe("restauration_mark", "ouiNon");
115 jpm 925
		restaurationMarkRGrpChp.setFieldLabel("Effectuez vous des opérations de restauration ou de remise en état de vos collections botaniques ?");
926
		conservationOnglet.add(restaurationMarkRGrpChp);
110 jpm 927
 
569 jp_milcent 928
		opRestauTrukCp = creerChoixMultipleCp();
115 jpm 929
		opRestauTrukCacGrpChp = new CheckBoxGroup();
930
		opRestauTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
111 jpm 931
		opRestauTrukCp.hide();
932
		conservationOnglet.add(opRestauTrukCp);
569 jp_milcent 933
		mediateur.obtenirListeValeurEtRafraichir(this, "opRestau");
110 jpm 934
 
188 jp_milcent 935
		// Création d'un ContentPanel vide et du groupe de bouton radio
936
		// 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
569 jp_milcent 937
		materielConservationCp = creerChoixMultipleCp();
188 jp_milcent 938
		conservationOnglet.add(materielConservationCp);
115 jpm 939
		materielConservationCeRGrpChp = creerChoixUniqueRadioGroupe("materiel_conservation_ce", "onep");
940
		materielConservationCeRGrpChp.setFieldLabel("Utilisez vous du matériel de conservation ?");
941
		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..."));
569 jp_milcent 942
		mediateur.obtenirListeValeurEtRafraichir(this, "onep");
110 jpm 943
 
569 jp_milcent 944
		autreMaterielTrukCp = creerChoixMultipleCp();
115 jpm 945
		autreMaterielTrukCacGrpChp = new CheckBoxGroup();
946
		autreMaterielTrukCacGrpChp.setFieldLabel("Si non, qu'utilisez vous comme matériel ?");
428 jp_milcent 947
		autreMaterielTrukCp.hide();
115 jpm 948
		conservationOnglet.add(autreMaterielTrukCp);
569 jp_milcent 949
		mediateur.obtenirListeValeurEtRafraichir(this, "autreMateriel");
110 jpm 950
 
188 jp_milcent 951
		traitementMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_mark", "ouiNon");
952
		traitementMarkRGrpChp.setFieldLabel("Réalisez vous actuellement des traitements globaux contre les insectes ?");
953
		conservationOnglet.add(traitementMarkRGrpChp);
110 jpm 954
 
569 jp_milcent 955
		traitementTrukCp = creerChoixMultipleCp();
115 jpm 956
		traitementTrukCp.hide();
957
		traitementTrukCacGrpChp = new CheckBoxGroup();
958
		traitementTrukCacGrpChp.setFieldLabel("Si oui, lesquels ?");
111 jpm 959
		conservationOnglet.add(traitementTrukCp);
569 jp_milcent 960
		mediateur.obtenirListeValeurEtRafraichir(this, "insecteTraitement");
110 jpm 961
 
188 jp_milcent 962
		collectionAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_acquisition_mark", "ouiNon");
963
		collectionAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, vos collections botaniques s'accroissent-elles de nouvelles acquisitions ?");
964
		conservationOnglet.add(collectionAcquisitionMarkRGrpChp);
110 jpm 965
 
188 jp_milcent 966
		echantillonAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("echantillon_acquisition_mark", "ouiNon");
967
		echantillonAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, mettez vous en herbier de nouveaux échantillons ?");
968
		conservationOnglet.add(echantillonAcquisitionMarkRGrpChp);
110 jpm 969
 
115 jpm 970
		traitementAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_acquisition_mark", "ouiNon");
971
		traitementAcquisitionMarkRGrpChp.hide();
972
		traitementAcquisitionMarkRGrpChp.setFieldLabel("Si oui, faites-vous un traitement contre les insectes avant l'intégration dans vos collections ?");
973
		conservationOnglet.add(traitementAcquisitionMarkRGrpChp);
110 jpm 974
 
115 jpm 975
		traitementAcquisitionMarkLabel = new LabelField();
976
		traitementAcquisitionMarkLabel.hide();
977
		traitementAcquisitionMarkLabel.setFieldLabel("Si oui, lesquels ?");
978
		conservationOnglet.add(traitementAcquisitionMarkLabel);
110 jpm 979
 
569 jp_milcent 980
		poisonTraitementTrukCp = creerChoixMultipleCp();
115 jpm 981
		poisonTraitementTrukCp.hide();
982
		poisonTraitementTrukCacGrpChp = new CheckBoxGroup();
983
		poisonTraitementTrukCacGrpChp.setFieldLabel("Empoisonnement");
984
		poisonTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
985
		poisonTraitementTrukCacGrpChp.setLabelSeparator("");
986
		conservationOnglet.add(poisonTraitementTrukCp);
569 jp_milcent 987
		mediateur.obtenirListeValeurEtRafraichir(this, "poisonTraitement");
110 jpm 988
 
569 jp_milcent 989
		insecteTraitementTrukCp = creerChoixMultipleCp();
115 jpm 990
		insecteTraitementTrukCp.hide();
991
		insecteTraitementTrukCacGrpChp = new CheckBoxGroup();
992
		insecteTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
993
		insecteTraitementTrukCacGrpChp.setLabelSeparator("");
994
		insecteTraitementTrukCacGrpChp.setFieldLabel("Désinsectisation");
111 jpm 995
		conservationOnglet.add(insecteTraitementTrukCp);
569 jp_milcent 996
		mediateur.obtenirListeValeurEtRafraichir(this, "insecteTraitement");
110 jpm 997
 
579 jp_milcent 998
		conservationOnglet.add(new Html("<br />"));
108 jpm 999
		return conservationOnglet;
1000
	}
1001
 
231 jp_milcent 1002
	private void collecterStructurePersonnel() {
1003
		if (personnelOnglet.getData("acces").equals(true)) {
771 jpm 1004
			personnelGrilleMagazin.commitChanges();
231 jp_milcent 1005
			int nbrePersonne = personnelGrilleMagazin.getCount();
1006
			for (int i = 0; i < nbrePersonne; i++) {
1007
				StructureAPersonne personne = personnelGrilleMagazin.getAt(i);
771 jpm 1008
 
231 jp_milcent 1009
				// Seules les lignes ajoutées ou modifiées sont prises en compte.
771 jpm 1010
				Record record = personnelGrilleMagazin.getRecord(personne);
1011
				if (personnelGrilleMagazin.getModifiedRecords().contains(record) == true
1012
						|| (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE) )) {
245 jp_milcent 1013
 
1014
					// Gestion de l'id de la structure
1015
					if (mode.equals("MODIF")) {
1016
						personne.setIdStructure(identification.getId());
1017
					}
609 jp_milcent 1018
 
1019
					// Récupération de l'id du projet de la structure qui servira aussi pour les Personnes crées dans ce formulaire
1020
					if (personne.getIdPersonne().equals("") && projetsCombo.getValue() != null) {
1021
						personne.setIdProjetPersonne(projetsCombo.getValue().getId());
1022
					}
1023
 
231 jp_milcent 1024
					// Gestion de la fonction
1025
					String fonction = personne.get("fonction");
1026
					if (fonction != null && !fonction.equals("")) {
295 jp_milcent 1027
						Valeur valeurRecherche = fonctionsCombo.getStore().findModel("nom", fonction);
231 jp_milcent 1028
						if (valeurRecherche != null) {
1029
							personne.setFonction(valeurRecherche.getId());
1030
						} else {
1031
							personne.setFonction("AUTRE", fonction);
1032
						}
602 jp_milcent 1033
					} else {
1034
						personne.setFonction("");
231 jp_milcent 1035
					}
1036
 
1037
					// Gestion de la notion de "contact"
1038
					personne.setContact(false);
1039
					if (personne.get("contact").equals(true)) {
1040
						personne.setContact(true);
1041
					}
1042
 
1043
					// Gestion du statut
1044
					String statut = personne.get("statut");
1045
					if (statut != null && !statut.equals("")) {
1046
						Valeur valeurRecherche = comboLiStatut.getStore().findModel("nom", statut);
1047
						if (valeurRecherche != null) {
1048
							personne.setStatut(valeurRecherche.getId());
1049
						} else {
1050
							personne.setStatut("AUTRE", statut);
1051
						}
602 jp_milcent 1052
					} else {
1053
						personne.setStatut("");
231 jp_milcent 1054
					}
1055
 
1056
					// Gestion du temps de travail
602 jp_milcent 1057
					personne.setBotaTravailHebdoTps(personne.get("travail").toString());
231 jp_milcent 1058
 
1059
					// Gestion du téléphone
602 jp_milcent 1060
					String telephoneFixe = personne.get("tel_fix");
1061
					personne.setTelephoneFixe(telephoneFixe);
231 jp_milcent 1062
 
1063
					// Gestion du fax
602 jp_milcent 1064
					String fax = personne.get("tel_fax");
1065
					personne.setFax(fax);
1066
 
231 jp_milcent 1067
					// Gestion du courriel
1068
					String courriel = personne.get("courriel");
602 jp_milcent 1069
					personne.setCourriel(courriel);
231 jp_milcent 1070
 
602 jp_milcent 1071
					// Gestion de la spécialité
231 jp_milcent 1072
					String specialite = personne.get("specialite");
602 jp_milcent 1073
					personne.setSpecialite(specialite);
231 jp_milcent 1074
 
1075
					// Ajout de la personne dans la liste correspondant à son état (ajouté ou modifié)
771 jpm 1076
					if (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE)) {// Une personne ajoutée
231 jp_milcent 1077
						personnelAjoute.put(""+i, personne);
1078
					} else {// Une personne modifiée
1079
						personnelModifie.put(personne.getId(), personne);
1080
					}
245 jp_milcent 1081
				} else {
1082
					GWT.log("Personne non modifiées : "+personne.getPrenom()+" "+personne.getNom(), null);
231 jp_milcent 1083
				}
1084
			}
1085
		}
1086
	}
211 jp_milcent 1087
 
1088
	private void peuplerStructurePersonnel() {
295 jp_milcent 1089
		if (mode.equals(MODE_MODIFIER) && personnel != null) {
213 jp_milcent 1090
			ArrayList<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
1091
			for (Iterator<String> it = personnel.keySet().iterator(); it.hasNext();) {
1092
				String index = it.next();
231 jp_milcent 1093
 
1094
				// Gestion de la fonction
295 jp_milcent 1095
				if (fonctionsMagazin != null && !((String) personnel.get(index).getFonction()).startsWith("AUTRE##")) {
1096
					if (fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()) != null) {
1097
						personnel.get(index).set("fonction", fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()).getNom());
243 jp_milcent 1098
					}
213 jp_milcent 1099
				} else {
214 jp_milcent 1100
					personnel.get(index).set("fonction", personnel.get(index).getFonction().replaceFirst("AUTRE##", ""));
213 jp_milcent 1101
				}
231 jp_milcent 1102
 
1103
				// Gestion de la notion de "contact"
1104
				personnel.get(index).set("contact", (personnel.get(index).getContact().equals("1") ? true : false));
1105
 
1106
				// Gestion du statut
1107
				if (magazinLiStatut != null && ((String) personnel.get(index).getStatut()).matches("^[0-9]+$")) {
1108
					personnel.get(index).set("statut", magazinLiStatut.findModel("id_valeur", personnel.get(index).getStatut()).getNom());
1109
				} else {
1110
					personnel.get(index).set("statut", personnel.get(index).getStatut().replaceFirst("AUTRE##", ""));
1111
				}
1112
 
1113
				// Gestion du temps de travail
1114
				String tps = personnel.get(index).getBotaTravailHebdoTps();
1115
				personnel.get(index).set("travail", (tps.matches("^[0-9]+$")  ? Integer.parseInt(tps) : 0));
1116
 
213 jp_milcent 1117
				personnes.add(personnel.get(index));
1118
			}
211 jp_milcent 1119
			personnelGrilleMagazin.removeAll();
213 jp_milcent 1120
			personnelGrilleMagazin.add(personnes);
231 jp_milcent 1121
 
214 jp_milcent 1122
			// Nous vidons la variable personnel une fois qu'elle a remplie la grille
1123
			personnel = null;
211 jp_milcent 1124
		}
1125
	}
1126
 
103 jpm 1127
	private TabItem creerOngletPersonnel() {
306 jp_milcent 1128
		// Création des objets contenant les manipulations de la grille
1129
		personnelModifie = new StructureAPersonneListe();
1130
		personnelAjoute = new StructureAPersonneListe();
1131
		personnelSupprime = new StructureAPersonneListe();
1132
 
634 jp_milcent 1133
		personnelOnglet = creerOnglet("Personnel", "personnel");
569 jp_milcent 1134
		personnelOnglet.setLayout(creerFormLayout(400, LabelAlign.LEFT));
739 jpm 1135
		personnelOnglet.setStyleAttribute("padding", "0");
634 jp_milcent 1136
		personnelOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
1137
			public void handleEvent(ComponentEvent be) {
211 jp_milcent 1138
				// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
1139
				personnelOnglet.setData("acces", true);
306 jp_milcent 1140
 
609 jp_milcent 1141
				// Rafraichissement du contenu de la grille du personnel
1142
				if (mode.equals(MODE_AJOUTER)) {
1143
					rafraichirPersonnel();
1144
				}
211 jp_milcent 1145
			}
1146
		});
103 jpm 1147
 
211 jp_milcent 1148
		ContentPanel cp = new ContentPanel();
231 jp_milcent 1149
		cp.setHeading("Personnes travaillant sur les collections");
569 jp_milcent 1150
		cp.setIcon(Images.ICONES.table());
231 jp_milcent 1151
		//cp.setScrollMode(Scroll.AUTO);
1152
		cp.setLayout(new FitLayout());
559 jp_milcent 1153
		//cp.setWidth(1250);
1154
		//cp.setHeight("100%");
231 jp_milcent 1155
		cp.setFrame(true);
103 jpm 1156
 
231 jp_milcent 1157
		personnelGrilleMagazin = new ListStore<StructureAPersonne>();
245 jp_milcent 1158
		personnelGrilleMagazin.addListener(Store.Add, new Listener<StoreEvent<StructureAPersonne>>() {
1159
 
1160
			public void handleEvent(StoreEvent<StructureAPersonne> ce) {
1161
				// Activation du bouton supprimer si la grille contient un élément
1162
				if (grillePersonnel.getStore().getCount() > 0) {
1163
					supprimerPersonnelBtn.enable();
1164
				}
1165
 
1166
			}
1167
		});
231 jp_milcent 1168
 
1169
		RowNumberer r = new RowNumberer();
1170
 
102 jpm 1171
		List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
1172
 
231 jp_milcent 1173
		GridSelectionModel<StructureAPersonne> sm = new GridSelectionModel<StructureAPersonne>();
1174
		configs.add(r);
103 jpm 1175
 
214 jp_milcent 1176
		ColumnConfig column = new ColumnConfig("fonction", "Fonction", 150);
295 jp_milcent 1177
		fonctionsMagazin = new ListStore<Valeur>();
103 jpm 1178
 
295 jp_milcent 1179
		fonctionsCombo = new ComboBox<Valeur>();
1180
		fonctionsCombo.setTriggerAction(TriggerAction.ALL);
1181
		fonctionsCombo.setEditable(true);
1182
		fonctionsCombo.setDisplayField("nom");
1183
		fonctionsCombo.setStore(fonctionsMagazin);
569 jp_milcent 1184
		mediateur.obtenirListeValeurEtRafraichir(this, "fonction");
103 jpm 1185
 
295 jp_milcent 1186
		fonctionEditor = new CellEditor(fonctionsCombo) {
103 jpm 1187
			@Override
211 jp_milcent 1188
			public Object preProcessValue(Object valeur) {
295 jp_milcent 1189
				Valeur retour = null;
1190
 
1191
				if (valeur != null) {
1192
					String chaineTransmise = (String) valeur;
1193
					if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
1194
						fonctionsMagazin.add(fonctionsListe);
1195
					}
1196
					if (fonctionsMagazin.findModel("id_valeur", chaineTransmise) != null) {
1197
						retour = fonctionsMagazin.findModel("id_valeur", chaineTransmise);
1198
					} else if (fonctionsMagazin.findModel("nom", chaineTransmise) != null) {
1199
						retour = fonctionsMagazin.findModel("nom", chaineTransmise);
213 jp_milcent 1200
					} else {
295 jp_milcent 1201
						retour = new Valeur("", chaineTransmise, "", "");
213 jp_milcent 1202
					}
211 jp_milcent 1203
				}
213 jp_milcent 1204
 
211 jp_milcent 1205
				return retour;
103 jpm 1206
			}
1207
 
1208
			@Override
211 jp_milcent 1209
			public Object postProcessValue(Object valeur) {
295 jp_milcent 1210
				String retour = "";
1211
				Valeur fonctionTrouvee = null;
211 jp_milcent 1212
				if (valeur == null) {
295 jp_milcent 1213
					String valeurBrute = this.getField().getRawValue();
1214
					if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
1215
						fonctionsMagazin.add(fonctionsListe);
213 jp_milcent 1216
					}
295 jp_milcent 1217
					if (valeurBrute.matches("^[0-9]+$") && fonctionsMagazin.findModel("id_valeur", valeurBrute) != null) {
1218
						fonctionTrouvee = fonctionsMagazin.findModel("id_valeur", valeurBrute);
1219
					} else {
1220
						retour = valeurBrute;
211 jp_milcent 1221
					}
295 jp_milcent 1222
				} else if (valeur instanceof Valeur) {
1223
					fonctionTrouvee = (Valeur) valeur;
103 jpm 1224
				}
295 jp_milcent 1225
 
1226
				if (fonctionTrouvee != null) {
1227
					retour = fonctionTrouvee.getNom();
1228
				}
1229
 
1230
				return retour;
211 jp_milcent 1231
			}
103 jpm 1232
		};
1233
		column.setEditor(fonctionEditor);
102 jpm 1234
		configs.add(column);
1235
 
243 jp_milcent 1236
		column = new ColumnConfig("prenom", "Prénom", 100);
103 jpm 1237
		TextField<String> prenomChp = new TextField<String>();
1238
		prenomChp.setAllowBlank(false);
1239
		prenomChp.getMessages().setBlankText("Ce champ est obligatoire.");
1240
		prenomChp.setAutoValidate(true);
1241
		column.setEditor(new CellEditor(prenomChp));
102 jpm 1242
		configs.add(column);
1243
 
243 jp_milcent 1244
		column = new ColumnConfig("nom", "Nom", 100);
103 jpm 1245
		TextField<String> nomChp = new TextField<String>();
1246
		nomChp.setAllowBlank(false);
1247
		nomChp.getMessages().setBlankText("Ce champ est obligatoire.");
1248
		nomChp.setAutoValidate(true);
1249
		column.setEditor(new CellEditor(nomChp));
102 jpm 1250
		configs.add(column);
1251
 
602 jp_milcent 1252
		column = new ColumnConfig("tel_fix", "Téléphone fixe", 100);
103 jpm 1253
		TextField<String> telChp = new TextField<String>();
1254
		column.setEditor(new CellEditor(telChp));
102 jpm 1255
		configs.add(column);
1256
 
602 jp_milcent 1257
		column = new ColumnConfig("tel_fax", "Fax", 100);
103 jpm 1258
		TextField<String> faxChp = new TextField<String>();
1259
		column.setEditor(new CellEditor(faxChp));
102 jpm 1260
		configs.add(column);
1261
 
214 jp_milcent 1262
		column = new ColumnConfig("courriel", "Courriel principal", 200);
103 jpm 1263
		TextField<String> emailChp = new TextField<String>();
1264
		column.setEditor(new CellEditor(emailChp));
102 jpm 1265
		configs.add(column);
1266
 
103 jpm 1267
		magazinLiStatut = new ListStore<Valeur>();
1268
		magazinLiStatut.add(new ArrayList<Valeur>());
1269
 
1270
		comboLiStatut = new ComboBox<Valeur>();
1271
		comboLiStatut.setTriggerAction(TriggerAction.ALL);
1272
		comboLiStatut.setEditable(false);
214 jp_milcent 1273
		comboLiStatut.disableTextSelection(true);
103 jpm 1274
		comboLiStatut.setDisplayField("nom");
1275
		comboLiStatut.setStore(magazinLiStatut);
569 jp_milcent 1276
		mediateur.obtenirListeValeurEtRafraichir(this, "statut");
103 jpm 1277
 
1278
		CellEditor statutEditor = new CellEditor(comboLiStatut) {
1279
			@Override
1280
			public Object preProcessValue(Object value) {
1281
				if (value == null) {
1282
					return value;
1283
				}
1284
				return comboLiStatut.getStore().findModel("nom", (String) value);
1285
			}
1286
 
1287
			@Override
1288
			public Object postProcessValue(Object value) {
1289
				if (value == null) {
1290
					return value;
1291
				}
1292
				return ((Valeur) value).get("nom");
1293
			}
214 jp_milcent 1294
		};
103 jpm 1295
		column = new ColumnConfig("statut", "Statut", 100);
1296
		column.setEditor(statutEditor);
102 jpm 1297
		configs.add(column);
1298
 
211 jp_milcent 1299
		column = new ColumnConfig("travail", "Temps travail", 100);
103 jpm 1300
		column.setNumberFormat(NumberFormat.getFormat("##"));
1301
		NumberField tpsWChp = new NumberField();
1302
		tpsWChp.setFormat(NumberFormat.getFormat("##"));
1303
		tpsWChp.setToolTip("Ce champ doit contenir un nombre");
1304
		column.setEditor(new CellEditor(tpsWChp));
1305
		configs.add(column);
1306
 
211 jp_milcent 1307
		column = new ColumnConfig("specialite", "Spécialité principale", 150);
103 jpm 1308
		TextField<String> speChp = new TextField<String>();
1309
		column.setEditor(new CellEditor(speChp));
1310
		configs.add(column);
1311
 
211 jp_milcent 1312
		CheckColumnConfig checkColumn = new CheckColumnConfig("contact", "Contact ?", 60);
102 jpm 1313
		configs.add(checkColumn);
1314
 
1315
		ToolBar toolBar = new ToolBar();
103 jpm 1316
 
491 gduche 1317
		Button ajouterPersonnelBtn = new Button("Ajouter");
569 jp_milcent 1318
		ajouterPersonnelBtn.setIcon(Images.ICONES.vcardAjouter());
491 gduche 1319
		ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
103 jpm 1320
			@Override
491 gduche 1321
			public void componentSelected(ButtonEvent ce) {
295 jp_milcent 1322
				StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
1323
				ajouterMembreAGrillePersonnel(membreDuPersonnel);
103 jpm 1324
			}
1325
		});
1326
		toolBar.add(ajouterPersonnelBtn);
243 jp_milcent 1327
 
103 jpm 1328
		toolBar.add(new SeparatorToolItem());
243 jp_milcent 1329
 
491 gduche 1330
		supprimerPersonnelBtn = new Button("Supprimer");
569 jp_milcent 1331
		supprimerPersonnelBtn.setIcon(Images.ICONES.vcardSupprimer());
491 gduche 1332
		supprimerPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
103 jpm 1333
			@Override
491 gduche 1334
			public void componentSelected(ButtonEvent ce) {
231 jp_milcent 1335
				StructureAPersonne personne = grillePersonnel.getSelectionModel().getSelectedItem();
1336
				if (personne != null) {
1337
					// Ajout de la personne supprimée à la liste
243 jp_milcent 1338
					if (personne.getIdPersonne() != null && !personne.getIdPersonne().equals("")) {
231 jp_milcent 1339
						personnelSupprime.put(personne.getId(), personne);
1340
					}
1341
 
1342
					// Suppression de l'enregistrement de la grille
1343
					grillePersonnel.getStore().remove(personne);
1344
 
1345
					// Désactivation du bouton supprimer si la grille contient plus d'élément
1346
					if (grillePersonnel.getStore().getCount() == 0) {
491 gduche 1347
						//TODO : check : Item -> component
1348
						ce.getComponent().disable();
231 jp_milcent 1349
					}
1350
				}
103 jpm 1351
			}
1352
		});
243 jp_milcent 1353
		toolBar.add(supprimerPersonnelBtn);
1354
 
1355
		toolBar.add(new SeparatorToolItem());
1356
 
491 gduche 1357
		Button rafraichirPersonnelBtn = new Button("Rafraichir");
569 jp_milcent 1358
		rafraichirPersonnelBtn.setIcon(Images.ICONES.rafraichir());
491 gduche 1359
		rafraichirPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
243 jp_milcent 1360
			@Override
491 gduche 1361
			public void componentSelected(ButtonEvent ce) {
243 jp_milcent 1362
				rafraichirPersonnel();
1363
			}
1364
		});
1365
		toolBar.add(rafraichirPersonnelBtn);
1366
 
1367
		toolBar.add(new SeparatorToolItem());
1368
 
1369
		personneExistanteMagazin = new ListStore<Personne>();
1370
		personneExistanteMagazin.add(new ArrayList<Personne>());
1371
 
245 jp_milcent 1372
		personneExistanteCombo = new ComboBox<Personne>();
243 jp_milcent 1373
		personneExistanteCombo.setWidth(200);
1374
		personneExistanteCombo.setEmptyText("Chercher une personne existante...");
1375
		personneExistanteCombo.setTriggerAction(TriggerAction.ALL);
1376
		personneExistanteCombo.setEditable(true);
1377
		personneExistanteCombo.setDisplayField("fmt_nom_complet");
1378
		personneExistanteCombo.setStore(personneExistanteMagazin);
1379
		personneExistanteCombo.addKeyListener(new KeyListener() {
1380
 
1381
			public void componentKeyUp(ComponentEvent ce) {
1382
				if (!ce.isNavKeyPress() && personneExistanteCombo.getRawValue() != null && personneExistanteCombo.getRawValue().length() > 0) {
1383
					rafraichirPersonneExistante(personneExistanteCombo.getRawValue());
1384
				}
1385
			}
1386
 
1387
		});
1388
 
1389
		// TODO : dans GXT 2.0 plus besoin de l'adaptateur, on peut ajouter la combobox directement sur la toolbar
491 gduche 1390
			//> CHECK
1391
		toolBar.add(personneExistanteCombo);
243 jp_milcent 1392
 
491 gduche 1393
		Button ajouterPersonneExistanteBtn = new Button("Ajouter");
1394
		ajouterPersonneExistanteBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
243 jp_milcent 1395
			@Override
491 gduche 1396
			public void componentSelected(ButtonEvent ce) {
243 jp_milcent 1397
				Personne personneExistante = personneExistanteCombo.getValue();
1398
 
295 jp_milcent 1399
				if (personneExistante != null) {
1400
					StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
1401
					membreDuPersonnel.setIdPersonne(personneExistante.getId());
609 jp_milcent 1402
					membreDuPersonnel.setIdProjetPersonne(personneExistante.getIdProjet());
295 jp_milcent 1403
					membreDuPersonnel.setNom(personneExistante.getNom());
1404
					membreDuPersonnel.setPrenom(personneExistante.getPrenom());
1405
					membreDuPersonnel.setTelephone(personneExistante.getTelephone());
603 jp_milcent 1406
					membreDuPersonnel.setCourriel(personneExistante.selectionnerCourriel(1));
1407
					membreDuPersonnel.setSpecialite(personneExistante.afficherSpecialite());
295 jp_milcent 1408
 
1409
					ajouterMembreAGrillePersonnel(membreDuPersonnel);
1410
				}
243 jp_milcent 1411
			}
1412
		});
1413
		toolBar.add(ajouterPersonneExistanteBtn);
1414
 
102 jpm 1415
		cp.setTopComponent(toolBar);
1416
 
1417
		ColumnModel cm = new ColumnModel(configs);
1418
 
559 jp_milcent 1419
		grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
1420
		grillePersonnel.setHeight("100%");
103 jpm 1421
		grillePersonnel.setBorders(true);
1422
		grillePersonnel.setSelectionModel(sm);
1423
		grillePersonnel.addPlugin(checkColumn);
231 jp_milcent 1424
		grillePersonnel.addPlugin(r);
1425
		grillePersonnel.getView().setForceFit(true);
211 jp_milcent 1426
  		grillePersonnel.setAutoExpandColumn("specialite");
1427
  		grillePersonnel.setStripeRows(true);
1428
  		grillePersonnel.setTrackMouseOver(true);
295 jp_milcent 1429
  		cp.add(grillePersonnel);
231 jp_milcent 1430
		personnelOnglet.add(cp);
306 jp_milcent 1431
 
231 jp_milcent 1432
		return personnelOnglet;
1433
	}
102 jpm 1434
 
110 jpm 1435
	private TabItem creerOngletIdentification() {
1436
		//+-----------------------------------------------------------------------------------------------------------+
1437
		// Onlget formulaire IDENTIFICATION
634 jp_milcent 1438
		identificationOnglet = creerOnglet("Identification", "identification");
211 jp_milcent 1439
		identificationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
1440
			public void handleEvent(ComponentEvent be) {
1441
				peuplerStructureIdentification();
279 jp_milcent 1442
				identificationOnglet.layout();
211 jp_milcent 1443
			}
1444
		});
1445
 
110 jpm 1446
		//+-----------------------------------------------------------------------------------------------------------+
172 jp_milcent 1447
		// Champs cachés
1448
		idStructureChp = new HiddenField<String>();
1449
 
1450
		//+-----------------------------------------------------------------------------------------------------------+
110 jpm 1451
		// Fieldset IDENTITÉ
1452
		FieldSet fieldSetIdentite = new FieldSet();
1453
		fieldSetIdentite.setHeading("Identité");
1454
		fieldSetIdentite.setCollapsible(true);
569 jp_milcent 1455
		fieldSetIdentite.setLayout(creerFormLayout(120, LabelAlign.LEFT));
110 jpm 1456
 
119 jpm 1457
		nomStructureChp = new TextField<String>();
277 jp_milcent 1458
		nomStructureChp.setTabIndex(tabIndex++);
110 jpm 1459
		nomStructureChp.setFieldLabel("Nom de la structure");
1460
		nomStructureChp.setAllowBlank(false);
1461
		nomStructureChp.getMessages().setBlankText("Ce champ est obligatoire.");
1462
		fieldSetIdentite.add(nomStructureChp, new FormData(450, 0));
1463
 
634 jp_milcent 1464
 
1465
		projetsMagazin = new ListStore<Projet>();
366 jp_milcent 1466
		mediateur.selectionnerProjets(this);
277 jp_milcent 1467
		projetsCombo = new ComboBox<Projet>();
1468
		projetsCombo.setTabIndex(tabIndex++);
1469
		projetsCombo.setFieldLabel("Projet");
1470
		projetsCombo.setLabelSeparator("");
1471
		projetsCombo.setDisplayField("nom");
1472
		projetsCombo.setEditable(false);
1473
		projetsCombo.setTriggerAction(TriggerAction.ALL);
1474
		projetsCombo.setStore(projetsMagazin);
1475
		fieldSetIdentite.add(projetsCombo, new FormData(450, 0));
1476
 
110 jpm 1477
		// Création du sous-formulaire : Acronyme
1478
		LayoutContainer ligne = new LayoutContainer();
1479
		ligne.setLayout(new ColumnLayout());
564 jp_milcent 1480
		ligne.setSize(600, -1);
1481
 
110 jpm 1482
		LayoutContainer gauche = new LayoutContainer();
569 jp_milcent 1483
		gauche.setLayout(creerFormLayout(120, LabelAlign.LEFT));
110 jpm 1484
		LayoutContainer droite = new LayoutContainer();
569 jp_milcent 1485
		droite.setLayout(creerFormLayout(10, LabelAlign.LEFT));
110 jpm 1486
 
1487
		ListStore<InterneValeur> acronymes = new ListStore<InterneValeur>();
1488
		acronymes.add(InterneValeurListe.getTypeAcronyme());
1489
 
133 jpm 1490
		comboAcronyme = new ComboBox<InterneValeur>();
277 jp_milcent 1491
		comboAcronyme.setTabIndex(tabIndex++);
110 jpm 1492
		comboAcronyme.setEmptyText("Sélectioner un type d'acronyme...");
564 jp_milcent 1493
		comboAcronyme.setFieldLabel("Type d'acronyme");
110 jpm 1494
		comboAcronyme.setDisplayField("nom");
1495
		comboAcronyme.setStore(acronymes);
1496
		comboAcronyme.setEditable(false);
1497
		comboAcronyme.setTypeAhead(true);
1498
		comboAcronyme.setTriggerAction(TriggerAction.ALL);
1499
		comboAcronyme.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
1500
			@Override
1501
			public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
1502
				String acronymeAbr = se.getSelectedItem().getAbr();
1503
				if (acronymeAbr.equals("IH")) {
1504
					mnhnChp.hide();
1505
					ihChp.show();
1506
				} else if (acronymeAbr.equals("MNHN")) {
1507
					ihChp.hide();
1508
					mnhnChp.show();
1509
				} else if (acronymeAbr.equals("")) {
1510
					ihChp.hide();
1511
					mnhnChp.hide();
1512
					comboAcronyme.clearSelections();
1513
				}
1514
			}
1515
        });
564 jp_milcent 1516
		gauche.add(comboAcronyme, new FormData("95%"));
110 jpm 1517
 
1518
		ihChp = new TextField<String>();
277 jp_milcent 1519
		ihChp.setTabIndex(tabIndex++);
110 jpm 1520
		ihChp.setLabelSeparator("");
1521
		ihChp.setToolTip("Index Herbariorum : herbier de plus de 5000 échantillons");
1522
		ihChp.hide();
564 jp_milcent 1523
		droite.add(ihChp, new FormData("95%"));
110 jpm 1524
 
133 jpm 1525
		mnhnChp = new TextField<String>();
277 jp_milcent 1526
		mnhnChp.setTabIndex(tabIndex++);
110 jpm 1527
		mnhnChp.setLabelSeparator("");
1528
		mnhnChp.setToolTip("Acronyme MNHN : herbier de moins de 5000 échantillons");
1529
		mnhnChp.hide();
564 jp_milcent 1530
		droite.add(mnhnChp, new FormData("95%"));
110 jpm 1531
 
564 jp_milcent 1532
		ligne.add(gauche, new ColumnData(.5));
1533
		ligne.add(droite, new ColumnData(.5));
110 jpm 1534
		fieldSetIdentite.add(ligne);
1535
 
1536
		// Création du sous-formulaire : Type de Structure
1537
		LayoutContainer ligneTs = new LayoutContainer();
1538
		ligneTs.setLayout(new ColumnLayout());
564 jp_milcent 1539
		ligneTs.setSize(600, -1);
110 jpm 1540
 
1541
		LayoutContainer gaucheTs = new LayoutContainer();
569 jp_milcent 1542
		gaucheTs.setLayout(creerFormLayout(120, LabelAlign.LEFT));
110 jpm 1543
 
1544
		LayoutContainer droiteTs = new LayoutContainer();
569 jp_milcent 1545
		droiteTs.setLayout(creerFormLayout(10, LabelAlign.LEFT));
110 jpm 1546
 
1547
		ListStore<InterneValeur> typesStructure = new ListStore<InterneValeur>();
1548
		typesStructure.add(InterneValeurListe.getTypeStructure());
1549
 
133 jpm 1550
		comboTypeStructure = new ComboBox<InterneValeur>();
277 jp_milcent 1551
		comboTypeStructure.setTabIndex(tabIndex++);
110 jpm 1552
		comboTypeStructure.setEmptyText("Sélectioner un type de structure...");
1553
		comboTypeStructure.setFieldLabel("Statut des structures");
1554
		comboTypeStructure.setDisplayField("nom");
1555
		comboTypeStructure.setStore(typesStructure);
1556
		comboTypeStructure.setEditable(false);
1557
		comboTypeStructure.setTypeAhead(true);
1558
		comboTypeStructure.setTriggerAction(TriggerAction.ALL);
1559
		comboTypeStructure.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
1560
			@Override
1561
			public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
1562
				String typeAbr = se.getSelectedItem().getAbr();
1563
				if (typeAbr.equals("stpu")) {
1564
					comboLstpr.hide();
1565
					comboLstpu.show();
1566
				} else if (typeAbr.equals("stpr")) {
1567
					comboLstpu.hide();
1568
					comboLstpr.show();
1569
				} else if (typeAbr.equals("")) {
1570
					comboLstpr.hide();
1571
					comboLstpu.hide();
1572
					comboTypeStructure.clearSelections();
1573
				}
1574
			}
1575
        });
564 jp_milcent 1576
		gaucheTs.add(comboTypeStructure, new FormData("95%"));
110 jpm 1577
 
1578
		magazinLstpu = new ListStore<Valeur>();
133 jpm 1579
		comboLstpu = new ComboBox<Valeur>();
277 jp_milcent 1580
		comboLstpu.setTabIndex(tabIndex++);
110 jpm 1581
		//comboLstpu.setFieldLabel("Statut des structures publiques");
1582
		comboLstpu.setLabelSeparator("");
1583
		comboLstpu.setDisplayField("nom");
1584
		comboLstpu.setEditable(false);
1585
		comboLstpu.setTriggerAction(TriggerAction.ALL);
1586
		comboLstpu.setStore(magazinLstpu);
1587
		comboLstpu.hide();
564 jp_milcent 1588
		droiteTs.add(comboLstpu, new FormData("95%"));
569 jp_milcent 1589
		mediateur.obtenirListeValeurEtRafraichir(this, "stpu");
110 jpm 1590
 
1591
		magazinLstpr = new ListStore<Valeur>();
133 jpm 1592
		comboLstpr = new ComboBox<Valeur>();
277 jp_milcent 1593
		comboLstpr.setTabIndex(tabIndex++);
110 jpm 1594
		//comboLstpr.setFieldLabel("Statut des structures privées");
1595
		comboLstpr.setLabelSeparator("");
1596
		comboLstpr.setDisplayField("nom");
1597
		comboLstpr.setEditable(false);
1598
		comboLstpr.setTriggerAction(TriggerAction.ALL);
1599
		comboLstpr.setStore(magazinLstpr);
1600
		comboLstpr.hide();
564 jp_milcent 1601
		droiteTs.add(comboLstpr, new FormData("95%"));
569 jp_milcent 1602
		mediateur.obtenirListeValeurEtRafraichir(this, "stpr");
110 jpm 1603
 
1604
		ligneTs.add(gaucheTs, new ColumnData(0.5));
1605
		ligneTs.add(droiteTs, new ColumnData(0.5));
1606
		fieldSetIdentite.add(ligneTs);
1607
 
119 jpm 1608
		dateFondationChp = new DateField();
277 jp_milcent 1609
		dateFondationChp.setTabIndex(tabIndex++);
110 jpm 1610
		dateFondationChp.setFieldLabel("Date de fondation");
1611
		dateFondationChp.getPropertyEditor().getFormat();
1612
		dateFondationChp.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
1613
		dateFondationChp.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
1614
		fieldSetIdentite.add(dateFondationChp);
1615
 
564 jp_milcent 1616
		nbreTotalPersonneStructureChp = new NumberField();
231 jp_milcent 1617
		nbreTotalPersonneStructureChp.setFieldLabel("Nombre de personne travaillant dans l'institution");
1618
		nbreTotalPersonneStructureChp.setFormat(NumberFormat.getFormat("#"));
686 jp_milcent 1619
		nbreTotalPersonneStructureChp.setToolTip(i18nC.champNumerique());
231 jp_milcent 1620
		fieldSetIdentite.add(nbreTotalPersonneStructureChp);
1621
 
279 jp_milcent 1622
		identificationOnglet.add(fieldSetIdentite);
231 jp_milcent 1623
 
110 jpm 1624
		//+-----------------------------------------------------------------------------------------------------------+
1625
		// Fieldset ADRESSE
1626
		LayoutContainer principalFdAdresse = new LayoutContainer();
1627
		principalFdAdresse.setLayout(new ColumnLayout());
564 jp_milcent 1628
		principalFdAdresse.setSize(600, -1);
110 jpm 1629
 
1630
		LayoutContainer gaucheFdAdresse = new LayoutContainer();
569 jp_milcent 1631
		gaucheFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
110 jpm 1632
 
1633
		LayoutContainer droiteFdAdresse = new LayoutContainer();
569 jp_milcent 1634
		droiteFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
110 jpm 1635
 
1636
		FieldSet fieldSetAdresse = new FieldSet();
1637
		fieldSetAdresse.setHeading("Adresse");
1638
		fieldSetAdresse.setCollapsible(true);
1639
 
569 jp_milcent 1640
		fieldSetAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
110 jpm 1641
 
164 jp_milcent 1642
		adrChp = new TextArea();
277 jp_milcent 1643
		adrChp.setTabIndex(tabIndex++);
110 jpm 1644
		adrChp.setFieldLabel("Adresse");
1645
		fieldSetAdresse.add(adrChp, new FormData(550, 0));
1646
 
133 jpm 1647
		cpChp = new TextField<String>();
277 jp_milcent 1648
		cpChp.setTabIndex(tabIndex++);
110 jpm 1649
		cpChp.setFieldLabel("Code postal");
564 jp_milcent 1650
		gaucheFdAdresse.add(cpChp, new FormData("95%"));
110 jpm 1651
 
133 jpm 1652
		villeChp = new TextField<String>();
277 jp_milcent 1653
		villeChp.setTabIndex(tabIndex++);
110 jpm 1654
		villeChp.setFieldLabel("Ville");
564 jp_milcent 1655
		droiteFdAdresse.add(villeChp, new FormData("95%"));
110 jpm 1656
 
133 jpm 1657
		regionChp = new TextField<String>();
277 jp_milcent 1658
		regionChp.setTabIndex(tabIndex++);
110 jpm 1659
		regionChp.setFieldLabel("Région");
564 jp_milcent 1660
		gaucheFdAdresse.add(regionChp, new FormData("95%"));
110 jpm 1661
 
164 jp_milcent 1662
		magazinPays = new ListStore<Valeur>();
1663
		comboPays = new ComboBox<Valeur>();
277 jp_milcent 1664
		comboPays.setTabIndex(tabIndex++);
164 jp_milcent 1665
		comboPays.setFieldLabel("Pays");
172 jp_milcent 1666
		comboPays.setEmptyText("Sélectioner un pays...");
164 jp_milcent 1667
		comboPays.setEditable(true);
1668
		comboPays.setLabelSeparator("");
1669
		comboPays.setDisplayField("nom");
172 jp_milcent 1670
		comboPays.setTemplate(getTemplatePays());
1671
		comboPays.setTypeAhead(true);
164 jp_milcent 1672
		comboPays.setTriggerAction(TriggerAction.ALL);
1673
		comboPays.setStore(magazinPays);
564 jp_milcent 1674
		droiteFdAdresse.add(comboPays, new FormData("95%"));
569 jp_milcent 1675
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
110 jpm 1676
 
1677
		principalFdAdresse.add(gaucheFdAdresse, new ColumnData(.5));
1678
		principalFdAdresse.add(droiteFdAdresse, new ColumnData(.5));
1679
		fieldSetAdresse.add(principalFdAdresse);
279 jp_milcent 1680
 
110 jpm 1681
		identificationOnglet.add(fieldSetAdresse);
279 jp_milcent 1682
 
110 jpm 1683
		//+-----------------------------------------------------------------------------------------------------------+
1684
		// Fieldset TÉLÉPHONE et EMAIL
1685
		LayoutContainer principalFdTelMail = new LayoutContainer();
1686
		principalFdTelMail.setLayout(new ColumnLayout());
569 jp_milcent 1687
		principalFdTelMail.setSize(700, -1);
110 jpm 1688
 
1689
		LayoutContainer gaucheFdTelMail = new LayoutContainer();
569 jp_milcent 1690
		gaucheFdTelMail.setLayout(creerFormLayout(60, LabelAlign.LEFT));
110 jpm 1691
 
1692
		LayoutContainer droiteFdTelMail = new LayoutContainer();
569 jp_milcent 1693
		droiteFdTelMail.setLayout(creerFormLayout(60, LabelAlign.LEFT));
110 jpm 1694
 
1695
		FieldSet fieldSetTelMail = new FieldSet();
1696
		fieldSetTelMail.setHeading("Communication");
1697
		fieldSetTelMail.setCollapsible(true);
1698
 
569 jp_milcent 1699
		fieldSetTelMail.setLayout(creerFormLayout(null, LabelAlign.LEFT));
110 jpm 1700
 
133 jpm 1701
		telChp = new TextField<String>();
277 jp_milcent 1702
		telChp.setTabIndex(tabIndex++);
602 jp_milcent 1703
		telChp.setFieldLabel("Téléphone fixe");
564 jp_milcent 1704
		gaucheFdTelMail.add(telChp, new FormData("95%"));
110 jpm 1705
 
133 jpm 1706
		faxChp = new TextField<String>();
277 jp_milcent 1707
		faxChp.setTabIndex(tabIndex++);
110 jpm 1708
		faxChp.setFieldLabel("Fax");
564 jp_milcent 1709
		droiteFdTelMail.add(faxChp, new FormData("95%"));
110 jpm 1710
 
133 jpm 1711
		emailChp = new TextField<String>();
277 jp_milcent 1712
		emailChp.setTabIndex(tabIndex++);
110 jpm 1713
		emailChp.setFieldLabel("Courriel");
1714
		emailChp.setToolTip("Saisir le courriel de l'organisation, pas de courriel individuel. Ex. : accueil@organisation.org");
564 jp_milcent 1715
		gaucheFdTelMail.add(emailChp, new FormData("95%"));
110 jpm 1716
 
133 jpm 1717
		urlChp = new TextField<String>();
277 jp_milcent 1718
		urlChp.setTabIndex(tabIndex++);
110 jpm 1719
		urlChp.setFieldLabel("Site web");
564 jp_milcent 1720
		droiteFdTelMail.add(urlChp, new FormData("95%"));
110 jpm 1721
 
1722
		principalFdTelMail.add(gaucheFdTelMail, new ColumnData(.5));
1723
		principalFdTelMail.add(droiteFdTelMail, new ColumnData(.5));
1724
		fieldSetTelMail.add(principalFdTelMail);
279 jp_milcent 1725
 
110 jpm 1726
		identificationOnglet.add(fieldSetTelMail);
1727
 
1728
		return identificationOnglet;
1729
	}
1730
 
172 jp_milcent 1731
	private native String getTemplatePays() /*-{
1732
		return  [
1733
		'<tpl for=".">',
1734
		'<div class="x-combo-list-item">{nom} ({abreviation})</div>',
1735
		'</tpl>'
1736
		].join("");
1737
		}-*/;
1738
 
192 jp_milcent 1739
	private void peuplerCasesACocher(String donnees, CheckBoxGroup groupeCac, TextField<String> champAutre) {
1740
		String[] valeurs = donnees.split(";;");
1741
		for (int i = 0; i < valeurs.length; i++) {
1742
			if (valeurs[i].startsWith("AUTRE##")) {
1743
				champAutre.setValue(valeurs[i].replaceFirst("^AUTRE##", ""));
1744
			} else {
491 gduche 1745
				//TODO : check : List<CheckBox> cases = groupeCac.getAll();
1746
				List<Field<?>> cases = groupeCac.getAll();
192 jp_milcent 1747
				for (int j = 0; j < cases.size(); j++) {
1748
					if (cases.get(j).getId().equals("val-"+valeurs[i])) {
491 gduche 1749
						((CheckBox) cases.get(j)).setValue(true);
192 jp_milcent 1750
					}
1751
				}
1752
			}
1753
		}
1754
	}
1755
 
1756
	private void peuplerBoutonsRadio(String valeur, RadioGroup groupeBr) {
491 gduche 1757
		//List<Radio> boutons = groupeBr.getAll();
1758
		List<Field<?>> boutons = groupeBr.getAll();
192 jp_milcent 1759
		String id = valeur+"_"+groupeBr.getName().replace("_grp", "");
1760
		for (int i = 0; i < boutons.size(); i++) {
1761
			if (boutons.get(i).getId().equals(id)) {
491 gduche 1762
				((Radio) boutons.get(i)).setValue(true);
192 jp_milcent 1763
			}
1764
		}
1765
	}
1766
 
1767
	private String creerChaineDenormalisee(List<CheckBox> liste) {
1768
		String identifiants = "";
306 jp_milcent 1769
		if (liste != null) {
1770
			int taille = liste.size();
1771
			for (int i = 0; i < taille; i++) {
1772
				CheckBox cac = liste.get(i);
1773
				if (cac.isEnabled()) {
1774
					identifiants = identifiants.concat(";;"+cac.getData("id"));
1775
				}
192 jp_milcent 1776
			}
306 jp_milcent 1777
			identifiants.replaceFirst("^;;", "");
192 jp_milcent 1778
		}
306 jp_milcent 1779
		return identifiants;
192 jp_milcent 1780
	}
1781
 
639 jp_milcent 1782
	protected void afficherChampSupplementaire(Radio radioBtn) {
119 jpm 1783
		//GWT.log("Nom btn : "+radioBtn.getName()+" - Nom group : "+radioBtn.getGroup().getName(), null);
115 jpm 1784
		// Valeur du bouton radio déclenchant l'affichage des composants cachés
1785
		String valeurPourAfficher = "oui";
111 jpm 1786
 
115 jpm 1787
		// Construction de la liste des composants à afficher/cacher
1788
		String radioGroupeNom = radioBtn.getGroup().getName();
1789
		ArrayList<Object> composants = new ArrayList<Object>();
1790
		if (radioGroupeNom.equals("action_mark_grp")) {
1791
			composants.add(actionTrukCp);
1792
		} else if (radioGroupeNom.equals("future_action_mark_grp")) {
1793
			composants.add(futureActionChp);
1794
		} else if (radioGroupeNom.equals("sans_motif_acces_mark_grp")) {
1795
			composants.add(sansMotifAccesChp);
1796
		} else if (radioGroupeNom.equals("avec_motif_acces_mark_grp")) {
1797
			composants.add(avecMotifAccesChp);
1798
		} else if (radioGroupeNom.equals("recherche_mark_grp")) {
1799
			composants.add(provenanceRechercheTrukCp);
119 jpm 1800
			composants.add(typeRechercheTrukCp);
115 jpm 1801
		} else if (radioGroupeNom.equals("formation_mark_grp")) {
1802
			composants.add(formationChp);
1803
		} else if (radioGroupeNom.equals("collection_commune_mark_grp")) {
1804
			composants.add(collectionAutreTrukCp);
1805
		} else if (radioGroupeNom.equals("restauration_mark_grp")) {
1806
			composants.add(opRestauTrukCp);
1807
		} else if (radioGroupeNom.equals("traitement_mark_grp")) {
1808
			composants.add(traitementTrukCp);
1809
		} else if (radioGroupeNom.equals("echantillon_acquisition_mark_grp")) {
1810
			composants.add(traitementAcquisitionMarkRGrpChp);
1811
		} else if (radioGroupeNom.equals("traitement_acquisition_mark_grp")) {
1812
			composants.add(traitementAcquisitionMarkLabel);
1813
			composants.add(poisonTraitementTrukCp);
1814
			composants.add(insecteTraitementTrukCp);
1815
		} else if (radioGroupeNom.equals("materiel_conservation_ce_grp")) {
1816
			composants.add(autreMaterielTrukCp);
1817
			valeurPourAfficher = "non";
1818
		}
111 jpm 1819
 
115 jpm 1820
		// Nous affichons/cachons les composant de la liste
211 jp_milcent 1821
		final int nbreComposants = composants.size();
115 jpm 1822
		//GWT.log("Id : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax, null);
119 jpm 1823
		//Window.alert("Radio grp nom : "+radioGroupeNom+" - Id btn : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax);
211 jp_milcent 1824
		for (int i = 0; i < nbreComposants; i++) {
111 jpm 1825
			// En fonction du type de bouton cliquer, on affiche ou cache les champs
115 jpm 1826
			String type = radioBtn.getBoxLabel().toLowerCase();
119 jpm 1827
			//GWT.log(type, null);
115 jpm 1828
			if (radioBtn.getValue() == true) {
1829
				if (type.equals(valeurPourAfficher)) {
1830
					((Component) composants.get(i)).show();
1831
				} else {
1832
					((Component) composants.get(i)).hide();
1833
				}
111 jpm 1834
			}
1835
			// Si on a à faire à un ContentPanel, on l'actualise pour déclencher l'affichage
115 jpm 1836
			if (composants.get(i) instanceof ContentPanel) {
1837
				((ContentPanel) composants.get(i)).layout();
111 jpm 1838
			}
1839
		}
1840
 
1841
	}
1842
 
639 jp_milcent 1843
	public void rafraichir(Object nouvellesDonnees) {
1844
		try {
1845
			if (nouvellesDonnees instanceof Information) {
1846
				Information info = (Information) nouvellesDonnees;
1847
				rafraichirInformation(info);
1848
			} else if (nouvellesDonnees instanceof ValeurListe) {
1849
				ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
1850
				rafraichirValeurListe(listeValeurs);
1851
			} else if (nouvellesDonnees instanceof ProjetListe) {
1852
				ProjetListe projets = (ProjetListe) nouvellesDonnees;
1853
				rafraichirProjetListe(projets);
1854
			} else {
1855
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
295 jp_milcent 1856
			}
639 jp_milcent 1857
		} catch (Exception e) {
1858
			GWT.log("rafraichir()", e);
109 jpm 1859
		}
1860
 
639 jp_milcent 1861
		verifierApresRafraichissement();
109 jpm 1862
	}
1863
 
639 jp_milcent 1864
	public void rafraichirInformation(Information info) {
1865
		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
1866
			GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
1867
		}
1868
 
1869
		if (info.getType().equals("modif_structure")) {
1870
			Info.display("Modification d'une institution", info.toString());
1871
		} else if (info.getType().equals("ajout_structure")) {
770 jpm 1872
			if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
1873
				String structureId = (String) info.getDonnee(0);
1874
				Info.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
1875
 
639 jp_milcent 1876
				// Suite à la récupération de l'id de l'institution nouvellement ajoutée nous ajoutons le personnel
770 jpm 1877
				mediateur.ajouterStructureAPersonne(this, structureId, personnelAjoute);
639 jp_milcent 1878
			} else {
1879
				Info.display("Ajout d'une Institution", info.toString());
1880
			}
1881
		} else if (info.getType().equals("modif_structure_a_personne")) {
1882
			Info.display("Modification du Personnel", info.toString());
1883
			GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
1884
			testerLancementRafraichirPersonnel();
1885
		} else if (info.getType().equals("suppression_structure_a_personne")) {
1886
			Info.display("Suppression du Personnel", info.toString());
1887
			GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
1888
			testerLancementRafraichirPersonnel();
1889
		} else if (info.getType().equals("ajout_structure_a_personne")) {
1890
			Info.display("Ajout du Personnel", info.toString());
1891
			GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
1892
			testerLancementRafraichirPersonnel();
1893
		} else if (info.getType().equals("selection_structure")) {
1894
			Info.display("Modification d'une institution", info.toString());
1895
			String titre = i18nC.titreModifFormStructurePanneau();
1896
			if (info.getDonnee(0) != null) {
1897
				identification = (Structure) info.getDonnee(0);
1898
				if (onglets.getSelectedItem().equals(identificationOnglet)) {
1899
					peuplerStructureIdentification();
188 jp_milcent 1900
				}
639 jp_milcent 1901
				// Composition du titre
1902
				titre += " - ID : "+identification.getId();
1903
			}
1904
			if (info.getDonnee(1) != null) {
1905
				conservation = (StructureConservation) info.getDonnee(1);
1906
				if (onglets.getSelectedItem().equals(conservationOnglet)) {
1907
					peuplerStructureConservation();
1908
				}
1909
			}
1910
			if (info.getDonnee(2) != null) {
1911
				valorisation = (StructureValorisation) info.getDonnee(2);
1912
				if (valorisation != null) {
1913
					if (onglets.getSelectedItem().equals(valorisationOnglet)) {
1914
						peuplerStructureValorisation();
231 jp_milcent 1915
					}
639 jp_milcent 1916
				}
1917
			}
1918
			panneauFormulaire.setHeading(titre);
1919
		} else if (info.getType().equals("liste_structure_a_personne")) {
1920
			if (info.getDonnee(0) != null) {
1921
				personnel = (StructureAPersonneListe) info.getDonnee(0);
243 jp_milcent 1922
 
639 jp_milcent 1923
				peuplerStructurePersonnel();
1924
				personnelOnglet.layout();
1925
				Info.display("Chargement du Personnel", "ok");
609 jp_milcent 1926
 
639 jp_milcent 1927
				// Remise à zéro des modification dans la liste du personnel
1928
				personnelModifie = new StructureAPersonneListe();
1929
				personnelAjoute = new StructureAPersonneListe();
1930
				personnelSupprime = new StructureAPersonneListe();
1931
			}
1932
		} else if (info.getType().equals("liste_personne")) {
1933
			if (info.getDonnee(0) != null) {
1934
				PersonneListe personnes = (PersonneListe) info.getDonnee(0);
704 jp_milcent 1935
				List<Personne> liste = personnes.toList();
639 jp_milcent 1936
 
1937
				personneExistanteMagazin.removeAll();
1938
				personneExistanteMagazin.add(liste);
1939
				personneExistanteCombo.setStore(personneExistanteMagazin);
1940
				personneExistanteCombo.expand();
1941
			}
1942
		}
1943
	}
1944
 
1945
	public void rafraichirValeurListe(ValeurListe listeValeurs) {
1946
		List<Valeur> liste = listeValeurs.toList();
407 jp_milcent 1947
 
639 jp_milcent 1948
		// Test pour savoir si la liste contient des éléments
1949
		if (liste.size() > 0) {
1950
			if (listeValeurs.getId().equals(config.getListeId("stpr"))) {
1951
				magazinLstpr.removeAll();
1952
				magazinLstpr.add(liste);
1953
				comboLstpr.setStore(magazinLstpr);
1954
			}
1955
			if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
1956
				magazinLstpu.removeAll();
1957
				magazinLstpu.add(liste);
1958
				comboLstpu.setStore(magazinLstpu);
1959
			}
1960
			if (listeValeurs.getId().equals(config.getListeId("statut"))) {
1961
				magazinLiStatut.removeAll();
1962
				magazinLiStatut.add(liste);
1963
				comboLiStatut.setStore(magazinLiStatut);
1964
			}
1965
			if (listeValeurs.getId().equals(config.getListeId("fonction"))) {
1966
				// FIXME : le store ne contient pas tout le temps les données, chose étrange.
1967
				// On stocke donc les données dans une variables de la classe pour recharger le store si besoin.
1968
				fonctionsListe = liste;
1969
				fonctionsMagazin.removeAll();
1970
				fonctionsMagazin.add(liste);
1971
				fonctionsCombo.setStore(fonctionsMagazin);
1972
			}
1973
			if (listeValeurs.getId().equals(config.getListeId("pays"))) {
1974
				magazinPays.removeAll();
1975
				magazinPays.add(liste);
1976
				comboPays.setStore(magazinPays);
1977
			}
1978
			if (listeValeurs.getId().equals(config.getListeId("localStockage"))) {
1979
				localStockageAutreChp = new TextField<String>();
1980
				creerChoixMultipleCac(localStockageTrukCp, localStockageTrukCacGrpChp, listeValeurs, localStockageAutreChp);
1981
			}
1982
			if (listeValeurs.getId().equals(config.getListeId("meubleStockage"))) {
1983
				meubleStockageAutreChp = new TextField<String>();
1984
				creerChoixMultipleCac(meubleStockageTrukCp, meubleStockageTrukCacGrpChp, listeValeurs, meubleStockageAutreChp);
1985
			}
1986
			if (listeValeurs.getId().equals(config.getListeId("parametreStockage"))) {
1987
				parametreStockageAutreChp = new TextField<String>();
1988
				creerChoixMultipleCac(parametreStockageTrukCp, parametreStockageTrukCacGrpChp, listeValeurs, parametreStockageAutreChp);
1989
			}
1990
			if (listeValeurs.getId().equals(config.getListeId("autreCollection"))) {
1991
				if (collectionAutreTrukCp != null && collectionAutreTrukCp.getItemByItemId("collectionAutreTrukCacGrpChp") == null) {
1992
					collectionAutreTrukCacGrpChp.setId("collectionAutreTrukCacGrpChp");
1993
					collectionAutreAutreChp = new TextField<String>();
1994
					creerChoixMultipleCac(collectionAutreTrukCp, collectionAutreTrukCacGrpChp, listeValeurs, collectionAutreAutreChp);
110 jpm 1995
				}
639 jp_milcent 1996
				if (autreCollectionTrukCp != null && autreCollectionTrukCp.getItemByItemId("autreCollectionTrukCacGrpChp") == null) {
1997
					autreCollectionTrukCacGrpChp.setId("autreCollectionTrukCacGrpChp");
1998
					autreCollectionAutreChp = new TextField<String>();
1999
					creerChoixMultipleCac(autreCollectionTrukCp, autreCollectionTrukCacGrpChp, listeValeurs, autreCollectionAutreChp);
277 jp_milcent 2000
				}
91 jpm 2001
			}
639 jp_milcent 2002
			if (listeValeurs.getId().equals(config.getListeId("opRestau"))) {
2003
				opRestauAutreChp = new TextField<String>();
2004
				creerChoixMultipleCac(opRestauTrukCp, opRestauTrukCacGrpChp, listeValeurs, opRestauAutreChp);
2005
			}
2006
			if (listeValeurs.getId().equals(config.getListeId("onep"))) {
2007
				creerChoixUniqueBoutonRadio(materielConservationCeRGrpChp, listeValeurs);
2008
				materielConservationCp.add(materielConservationCeRGrpChp);
2009
				materielConservationCp.layout();
2010
			}
2011
			if (listeValeurs.getId().equals(config.getListeId("autreMateriel"))) {
2012
				autreMaterielAutreChp = new TextField<String>();
2013
				creerChoixMultipleCac(autreMaterielTrukCp, autreMaterielTrukCacGrpChp, listeValeurs, autreMaterielAutreChp);
2014
			}
2015
			if (listeValeurs.getId().equals(config.getListeId("poisonTraitement"))) {
2016
				poisonTraitementAutreChp = new TextField<String>();
2017
				creerChoixMultipleCac(poisonTraitementTrukCp, poisonTraitementTrukCacGrpChp, listeValeurs, poisonTraitementAutreChp);
2018
			}
2019
			if (listeValeurs.getId().equals(config.getListeId("insecteTraitement"))) {
2020
				if (traitementTrukCp != null && traitementTrukCp.getItemByItemId("traitementTrukCacGrpChp") == null) {
2021
					traitementTrukCacGrpChp.setId("traitementTrukCacGrpChp");
2022
					traitementAutreChp = new TextField<String>();
2023
					creerChoixMultipleCac(traitementTrukCp, traitementTrukCacGrpChp, listeValeurs, traitementAutreChp);
2024
				}
2025
				if (insecteTraitementTrukCp != null && insecteTraitementTrukCp.getItemByItemId("insecteTraitementTrukCacGrpChp") == null) {
2026
					insecteTraitementTrukCacGrpChp.setId("insecteTraitementTrukCacGrpChp");
2027
					insecteTraitementAutreChp = new TextField<String>();
2028
					creerChoixMultipleCac(insecteTraitementTrukCp, insecteTraitementTrukCacGrpChp, listeValeurs, insecteTraitementAutreChp);
2029
				}
2030
			}
2031
			if (listeValeurs.getId().equals(config.getListeId("actionValorisation"))) {
2032
				actionAutreChp = new TextField<String>();
2033
				creerChoixMultipleCac(actionTrukCp, actionTrukCacGrpChp, listeValeurs, actionAutreChp);
2034
			}
2035
			if (listeValeurs.getId().equals(config.getListeId("continentEtFr"))) {
2036
				provenanceRechercheAutreChp = new TextField<String>();
2037
				creerChoixMultipleCac(provenanceRechercheTrukCp, provenanceRechercheTrukCacGrpChp, listeValeurs, provenanceRechercheAutreChp);
2038
			}
2039
			if (listeValeurs.getId().equals(config.getListeId("typeRecherche"))) {
2040
				typeRechercheAutreChp = new TextField<String>();
2041
				creerChoixMultipleCac(typeRechercheTrukCp, typeRechercheTrukCacGrpChp, listeValeurs, typeRechercheAutreChp);
2042
			}
2043
			//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
2044
		} else {
2045
			GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
91 jpm 2046
		}
639 jp_milcent 2047
	}
2048
 
2049
	private void rafraichirProjetListe(ProjetListe projets) {
686 jp_milcent 2050
		List<Projet> liste = projets.toList();
639 jp_milcent 2051
		projetsMagazin.removeAll();
2052
		projetsMagazin.add(liste);
2053
		projetsCombo.setStore(projetsMagazin);
69 jpm 2054
	}
243 jp_milcent 2055
 
609 jp_milcent 2056
	private void testerLancementRafraichirPersonnel() {
2057
		decompteRafraichissementPersonnel--;
2058
		if (decompteRafraichissementPersonnel == 0) {
2059
			// Nous rechargeons la liste du Personnel
2060
			rafraichirPersonnel();
2061
		}
2062
	}
2063
 
243 jp_milcent 2064
	private void rafraichirPersonnel() {
609 jp_milcent 2065
		decompteRafraichissementPersonnel = 0;
295 jp_milcent 2066
		if (mode.equals(MODE_MODIFIER)) {
609 jp_milcent 2067
			initialiserGrillePersonnelEnModification();
295 jp_milcent 2068
		} else if (mode.equals(MODE_AJOUTER)) {
2069
			initialiserGrillePersonnelEnAjout();
2070
		}
243 jp_milcent 2071
	}
2072
 
2073
	private void rafraichirPersonneExistante(String nom) {
245 jp_milcent 2074
		mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%");
243 jp_milcent 2075
	}
295 jp_milcent 2076
 
2077
	private void ajouterMembreAGrillePersonnel(StructureAPersonne personnel) {
2078
		grillePersonnel.stopEditing();
306 jp_milcent 2079
		personnelGrilleMagazin.insert(personnel, 0);
295 jp_milcent 2080
		grillePersonnel.startEditing(0, 0);
2081
	}
2082
 
2083
	private void initialiserGrillePersonnelEnAjout() {
2084
		personnelGrilleMagazin.removeAll();
2085
		StructureAPersonne conservateurDesCollections = new StructureAPersonne(StructureAPersonne.FONCTION_CONSERVATEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
2086
		ajouterMembreAGrillePersonnel(conservateurDesCollections);
2087
		StructureAPersonne directeurDuPersonnel = new StructureAPersonne(StructureAPersonne.FONCTION_DIRECTEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
2088
		ajouterMembreAGrillePersonnel(directeurDuPersonnel);
609 jp_milcent 2089
		personnelOnglet.layout();
295 jp_milcent 2090
	}
2091
 
609 jp_milcent 2092
	private void initialiserGrillePersonnelEnModification() {
295 jp_milcent 2093
		mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE);
2094
	}
115 jpm 2095
}