Subversion Repositories eFlore/Applications.coel

Rev

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

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