Subversion Repositories eFlore/Applications.coel

Rev

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