Subversion Repositories eFlore/Applications.coel

Rev

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