Subversion Repositories eFlore/Applications.coel

Rev

Rev 981 | Rev 1040 | 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
		}
306 jp_milcent 684
		return structureARetourner;
119 jpm 685
	}
686
 
211 jp_milcent 687
	private void peuplerStructureIdentification() {
295 jp_milcent 688
		if (mode.equals(MODE_AJOUTER)) {
263 jp_milcent 689
			// Indique que l'ongleta pu être modifié pour la méthode collecter...
690
			identificationOnglet.setData("acces", true);
306 jp_milcent 691
			// Initialisation de l'objet Structure
692
			identification = new Structure();
279 jp_milcent 693
			// Indication du projet sélectionné par défaut
694
			String projetCourantId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getProjetId();
295 jp_milcent 695
			if (projetCourantId != null && !projetCourantId.equals("0")) {
279 jp_milcent 696
				projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", projetCourantId));
697
			}
263 jp_milcent 698
		}
295 jp_milcent 699
		if (mode.equals(MODE_MODIFIER) && identification != null && identificationOnglet.getData("acces").equals(false)) {
211 jp_milcent 700
			idStructureChp.setValue(identification.getId());
701
			nomStructureChp.setValue(identification.getNom());
277 jp_milcent 702
			if (!identification.getIdProjet().equals("0")) {
703
				projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", identification.getIdProjet()));
704
			}
705
 
211 jp_milcent 706
			if (!identification.getIdAlternatif().isEmpty()) {
707
				String[] acronyme = identification.getIdAlternatif().split("##");
708
				if (acronyme[0].matches("^IH$")) {
709
					comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeIH());
710
					ihChp.setValue(acronyme[1]);
711
				} else if (acronyme[0].matches("^MNHN$")) {
712
					comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeMNHN());
713
					mnhnChp.setValue(acronyme[1]);
714
				}
188 jp_milcent 715
			}
211 jp_milcent 716
			if (!identification.getTypePrive().isEmpty()) {
717
				if (identification.getTypePrive().matches("^[0-9]+$")) {
718
					comboTypeStructure.setValue(InterneValeurListe.getTypePrivee());
719
					comboLstpr.setValue(comboLstpr.getStore().findModel("id_valeur", identification.getTypePrive()));
720
				}
721
			} else if (!identification.getTypePublic().isEmpty()) {
722
				if (identification.getTypePublic().matches("^[0-9]+$")) {
723
					comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
724
					comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
725
				}
172 jp_milcent 726
			}
211 jp_milcent 727
			dateFondationChp.setValue(identification.getDateFondation());
728
 
729
			adrChp.setValue(identification.getAdresse());
730
			cpChp.setValue(identification.getCodePostal());
731
			villeChp.setValue(identification.getVille());
1035 gduche 732
			mettreAJourRegion();
733
			//(identification.getRegion());
419 jp_milcent 734
			if (identification.getPays().matches("^[0-9]+$")) {
735
				comboPays.setValue(comboPays.getStore().findModel("id_valeur", identification.getPays()));
211 jp_milcent 736
			} else {
737
				comboPays.setRawValue(identification.getPays());
172 jp_milcent 738
			}
211 jp_milcent 739
 
602 jp_milcent 740
			telChp.setValue(identification.getTelephoneFixe());
211 jp_milcent 741
			faxChp.setValue(identification.getFax());
742
			emailChp.setValue(identification.getCourriel());
743
			urlChp.setValue(identification.getUrl("WEB"));
744
 
231 jp_milcent 745
			nbreTotalPersonneStructureChp.setValue(identification.getNbrePersonne());
746
 
243 jp_milcent 747
			// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
748
			identificationOnglet.setData("acces", true);
172 jp_milcent 749
		}
156 jp_milcent 750
	}
751
 
111 jpm 752
	private TabItem creerOngletValorisation() {
634 jp_milcent 753
		valorisationOnglet = creerOnglet("Valorisation", "valorisation");
569 jp_milcent 754
		valorisationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP));
634 jp_milcent 755
		Listener<ComponentEvent> ecouteurSelection = new Listener<ComponentEvent>() {
756
			public void handleEvent(ComponentEvent be) {
192 jp_milcent 757
				peuplerStructureValorisation();
634 jp_milcent 758
				valorisationOnglet.layout();
759
			}
760
		};
761
		valorisationOnglet.addListener(Events.Select, ecouteurSelection);
111 jpm 762
 
119 jpm 763
		actionMarkRGrpChp = creerChoixUniqueRadioGroupe("action_mark", "ouiNon");
111 jpm 764
		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 ?");
765
		valorisationOnglet.add(actionMarkRGrpChp);
766
 
119 jpm 767
 
569 jp_milcent 768
		actionTrukCp = creerChoixMultipleCp();
111 jpm 769
		actionTrukCp.hide();
115 jpm 770
		actionTrukCacGrpChp = new CheckBoxGroup();
771
		actionTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
111 jpm 772
		valorisationOnglet.add(actionTrukCp);
569 jp_milcent 773
		mediateur.obtenirListeValeurEtRafraichir(this, "actionValorisation");
111 jpm 774
 
206 jp_milcent 775
		publicationChp = new TextArea();
111 jpm 776
		publicationChp.setFieldLabel("Quelques titres des ouvrages, articles scientifiques, ...");
206 jp_milcent 777
		valorisationOnglet.add(publicationChp, new FormData(550, 0));
111 jpm 778
 
569 jp_milcent 779
		autreCollectionTrukCp = creerChoixMultipleCp();
119 jpm 780
		autreCollectionTrukCacGrpChp = new CheckBoxGroup();
781
		autreCollectionTrukCacGrpChp.setFieldLabel("L'organisme dispose-t-il d'autres collections (permettant une valorisation pluridisciplinaire) ?");
111 jpm 782
		valorisationOnglet.add(autreCollectionTrukCp);
569 jp_milcent 783
		mediateur.obtenirListeValeurEtRafraichir(this, "autreCollection");
111 jpm 784
 
188 jp_milcent 785
		futureActionMarkRGrpChp = creerChoixUniqueRadioGroupe("future_action_mark", "ouiNon");
111 jpm 786
		futureActionMarkRGrpChp.setFieldLabel("Envisagez vous des actions de valorisation dans le cadre de votre politique culturelle ?");
787
		valorisationOnglet.add(futureActionMarkRGrpChp);
788
 
206 jp_milcent 789
		futureActionChp = new TextArea();
111 jpm 790
		futureActionChp.setFieldLabel("Si oui, lesquelles ?");
791
		futureActionChp.hide();
306 jp_milcent 792
		futureActionChp.addListener(Events.Hide, new Listener<BaseEvent>() {
793
 
794
			public void handleEvent(BaseEvent be) {
491 gduche 795
				((TextArea) be.getSource()).setValue("");
306 jp_milcent 796
			}
797
 
798
		});
206 jp_milcent 799
		valorisationOnglet.add(futureActionChp, new FormData(550, 0));
111 jpm 800
 
188 jp_milcent 801
		rechercheMarkRGrpChp = creerChoixUniqueRadioGroupe("recherche_mark", "ouiNon");
111 jpm 802
		rechercheMarkRGrpChp.setFieldLabel("Vos collections botaniques sont-elles utilisées pour des recherches scientifiques ?");
803
		valorisationOnglet.add(rechercheMarkRGrpChp);
804
 
569 jp_milcent 805
		provenanceRechercheTrukCp = creerChoixMultipleCp();
111 jpm 806
		provenanceRechercheTrukCp.hide();
115 jpm 807
		provenanceRechercheTrukCacGrpChp = new CheckBoxGroup();
808
		provenanceRechercheTrukCacGrpChp.setFieldLabel("Si oui, par des chercheurs (professionnels ou amateurs) de quelle provenance ?");
111 jpm 809
		valorisationOnglet.add(provenanceRechercheTrukCp);
614 jp_milcent 810
		mediateur.obtenirListeValeurEtRafraichir(this, "continentEtFr");
111 jpm 811
 
569 jp_milcent 812
		typeRechercheTrukCp = creerChoixMultipleCp();
119 jpm 813
		typeRechercheTrukCp.hide();
115 jpm 814
		typeRechercheTrukCacGrpChp = new CheckBoxGroup();
815
		typeRechercheTrukCacGrpChp.setFieldLabel("Et pour quelles recherches ?");
119 jpm 816
		valorisationOnglet.add(typeRechercheTrukCp);
569 jp_milcent 817
		mediateur.obtenirListeValeurEtRafraichir(this, "typeRecherche");
111 jpm 818
 
188 jp_milcent 819
		sansMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("sans_motif_acces_mark", "ouiNon");
111 jpm 820
		sansMotifAccesMarkRGrpChp.setFieldLabel("Peut-on consulter vos collections botaniques sans motif de recherches scientifiques ?");
821
		valorisationOnglet.add(sansMotifAccesMarkRGrpChp);
822
 
206 jp_milcent 823
		valorisationOnglet.add(sansMotifAccesChp = new TextArea(), new FormData(550, 0));
111 jpm 824
		sansMotifAccesChp.hide();
306 jp_milcent 825
		sansMotifAccesChp.addListener(Events.Hide, new Listener<BaseEvent>() {
826
 
827
			public void handleEvent(BaseEvent be) {
491 gduche 828
				((TextArea) be.getSource()).setValue("");
306 jp_milcent 829
			}
830
 
831
		});
111 jpm 832
		sansMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les consulter ?");
833
 
188 jp_milcent 834
		avecMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("avec_motif_acces_mark", "ouiNon");
111 jpm 835
		avecMotifAccesMarkRGrpChp.setFieldLabel("Peut-on visiter vos collections botaniques avec des objectifs de recherches scientifiques ?");
836
		valorisationOnglet.add(avecMotifAccesMarkRGrpChp);
837
 
206 jp_milcent 838
		valorisationOnglet.add(avecMotifAccesChp = new TextArea(), new FormData(550, 0));
111 jpm 839
		avecMotifAccesChp.hide();
306 jp_milcent 840
		avecMotifAccesChp.addListener(Events.Hide, new Listener<BaseEvent>() {
841
 
842
			public void handleEvent(BaseEvent be) {
491 gduche 843
				((TextArea) be.getSource()).setValue("");
306 jp_milcent 844
			}
845
 
846
		});
111 jpm 847
		avecMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les visiter ?");
848
 
849
		return valorisationOnglet;
850
	}
851
 
108 jpm 852
	private TabItem creerOngletConservation() {
634 jp_milcent 853
		conservationOnglet = creerOnglet("Conservation", "conservation");
569 jp_milcent 854
		conservationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP));
634 jp_milcent 855
		Listener<ComponentEvent> ecouteurSelection = new Listener<ComponentEvent>() {
856
			public void handleEvent(ComponentEvent be) {
206 jp_milcent 857
				peuplerStructureConservation();
279 jp_milcent 858
				conservationOnglet.layout();
192 jp_milcent 859
			}
634 jp_milcent 860
		};
861
		conservationOnglet.addListener(Events.Select, ecouteurSelection);
108 jpm 862
 
188 jp_milcent 863
		formationMarkRGrpChp = creerChoixUniqueRadioGroupe("formation_mark", "ouiNon");
864
		formationMarkRGrpChp.setFieldLabel("Le personnel s'occupant des collections a-t-il suivi des formations en conservations ?");
865
		conservationOnglet.add(formationMarkRGrpChp);
108 jpm 866
 
401 jp_milcent 867
		formationChp = new TextArea();
111 jpm 868
		formationChp.hide();
306 jp_milcent 869
		formationChp.addListener(Events.Hide, new Listener<BaseEvent>() {
870
 
871
			public void handleEvent(BaseEvent be) {
491 gduche 872
				((TextArea) be.getSource()).setValue("");
306 jp_milcent 873
			}
874
 
875
		});
111 jpm 876
		formationChp.setFieldLabel("Si oui, lesquelles ?");
108 jpm 877
		conservationOnglet.add(formationChp);
878
 
188 jp_milcent 879
		interetFormationMarkRGrpChp = creerChoixUniqueRadioGroupe("interet_formation_mark", "ouiNon");
880
		interetFormationMarkRGrpChp.setFieldLabel("Seriez vous intéressé par une formation à la conservation et à la restauration d'herbier ?");
881
		conservationOnglet.add(interetFormationMarkRGrpChp);
108 jpm 882
 
115 jpm 883
		localStockageTrukCacGrpChp = new CheckBoxGroup();
884
		localStockageTrukCacGrpChp.setFieldLabel("Avez vous des locaux spécifiques de stockage des collections botaniques ?");
569 jp_milcent 885
		localStockageTrukCp = creerChoixMultipleCp();
115 jpm 886
		conservationOnglet.add(localStockageTrukCp);
569 jp_milcent 887
		mediateur.obtenirListeValeurEtRafraichir(this, "localStockage");
108 jpm 888
 
569 jp_milcent 889
		meubleStockageTrukCp = creerChoixMultipleCp();
115 jpm 890
		meubleStockageTrukCacGrpChp = new CheckBoxGroup();
891
		meubleStockageTrukCacGrpChp.setFieldLabel("Avez vous des meubles spécifiques au stockage des collections botaniques ?");
892
		conservationOnglet.add(meubleStockageTrukCp);
569 jp_milcent 893
		mediateur.obtenirListeValeurEtRafraichir(this, "meubleStockage");
108 jpm 894
 
569 jp_milcent 895
		parametreStockageTrukCp = creerChoixMultipleCp();
115 jpm 896
		parametreStockageTrukCacGrpChp = new CheckBoxGroup();
897
		parametreStockageTrukCacGrpChp.setFieldLabel("Quels paramètres maîtrisez vous ?");
898
		conservationOnglet.add(parametreStockageTrukCp);
569 jp_milcent 899
		mediateur.obtenirListeValeurEtRafraichir(this, "parametreStockage");
109 jpm 900
 
188 jp_milcent 901
		collectionCommuneMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_commune_mark", "ouiNon");
111 jpm 902
		collectionCommuneMarkRGrpChp.setFieldLabel("Les collections botaniques sont-elles conservées avec d'autres collections  dans les mêmes locaux (problème de conservation en commun) ?");
903
		conservationOnglet.add(collectionCommuneMarkRGrpChp);
109 jpm 904
 
569 jp_milcent 905
		collectionAutreTrukCp = creerChoixMultipleCp();
115 jpm 906
		collectionAutreTrukCacGrpChp = new CheckBoxGroup();
907
		collectionAutreTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
111 jpm 908
		collectionAutreTrukCp.hide();
909
		conservationOnglet.add(collectionAutreTrukCp);
569 jp_milcent 910
		mediateur.obtenirListeValeurEtRafraichir(this, "autreCollection");
110 jpm 911
 
188 jp_milcent 912
		accesControleMarkRGrpChp = creerChoixUniqueRadioGroupe("mark_acces_controle", "ouiNon");
115 jpm 913
		accesControleMarkRGrpChp.setFieldLabel("L'accès à vos collections botanique est-il contrôlé (ex. : manipulation réservées à des personnes compétentes) ?");
914
		conservationOnglet.add(accesControleMarkRGrpChp);
110 jpm 915
 
188 jp_milcent 916
		restaurationMarkRGrpChp = creerChoixUniqueRadioGroupe("restauration_mark", "ouiNon");
115 jpm 917
		restaurationMarkRGrpChp.setFieldLabel("Effectuez vous des opérations de restauration ou de remise en état de vos collections botaniques ?");
918
		conservationOnglet.add(restaurationMarkRGrpChp);
110 jpm 919
 
569 jp_milcent 920
		opRestauTrukCp = creerChoixMultipleCp();
115 jpm 921
		opRestauTrukCacGrpChp = new CheckBoxGroup();
922
		opRestauTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
111 jpm 923
		opRestauTrukCp.hide();
924
		conservationOnglet.add(opRestauTrukCp);
569 jp_milcent 925
		mediateur.obtenirListeValeurEtRafraichir(this, "opRestau");
110 jpm 926
 
188 jp_milcent 927
		// Création d'un ContentPanel vide et du groupe de bouton radio
928
		// 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 929
		materielConservationCp = creerChoixMultipleCp();
188 jp_milcent 930
		conservationOnglet.add(materielConservationCp);
115 jpm 931
		materielConservationCeRGrpChp = creerChoixUniqueRadioGroupe("materiel_conservation_ce", "onep");
932
		materielConservationCeRGrpChp.setFieldLabel("Utilisez vous du matériel de conservation ?");
933
		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 934
		mediateur.obtenirListeValeurEtRafraichir(this, "onep");
110 jpm 935
 
569 jp_milcent 936
		autreMaterielTrukCp = creerChoixMultipleCp();
115 jpm 937
		autreMaterielTrukCacGrpChp = new CheckBoxGroup();
938
		autreMaterielTrukCacGrpChp.setFieldLabel("Si non, qu'utilisez vous comme matériel ?");
428 jp_milcent 939
		autreMaterielTrukCp.hide();
115 jpm 940
		conservationOnglet.add(autreMaterielTrukCp);
569 jp_milcent 941
		mediateur.obtenirListeValeurEtRafraichir(this, "autreMateriel");
110 jpm 942
 
188 jp_milcent 943
		traitementMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_mark", "ouiNon");
944
		traitementMarkRGrpChp.setFieldLabel("Réalisez vous actuellement des traitements globaux contre les insectes ?");
945
		conservationOnglet.add(traitementMarkRGrpChp);
110 jpm 946
 
569 jp_milcent 947
		traitementTrukCp = creerChoixMultipleCp();
115 jpm 948
		traitementTrukCp.hide();
949
		traitementTrukCacGrpChp = new CheckBoxGroup();
950
		traitementTrukCacGrpChp.setFieldLabel("Si oui, lesquels ?");
111 jpm 951
		conservationOnglet.add(traitementTrukCp);
569 jp_milcent 952
		mediateur.obtenirListeValeurEtRafraichir(this, "insecteTraitement");
110 jpm 953
 
188 jp_milcent 954
		collectionAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_acquisition_mark", "ouiNon");
955
		collectionAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, vos collections botaniques s'accroissent-elles de nouvelles acquisitions ?");
956
		conservationOnglet.add(collectionAcquisitionMarkRGrpChp);
110 jpm 957
 
188 jp_milcent 958
		echantillonAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("echantillon_acquisition_mark", "ouiNon");
959
		echantillonAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, mettez vous en herbier de nouveaux échantillons ?");
960
		conservationOnglet.add(echantillonAcquisitionMarkRGrpChp);
110 jpm 961
 
115 jpm 962
		traitementAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_acquisition_mark", "ouiNon");
963
		traitementAcquisitionMarkRGrpChp.hide();
964
		traitementAcquisitionMarkRGrpChp.setFieldLabel("Si oui, faites-vous un traitement contre les insectes avant l'intégration dans vos collections ?");
965
		conservationOnglet.add(traitementAcquisitionMarkRGrpChp);
110 jpm 966
 
115 jpm 967
		traitementAcquisitionMarkLabel = new LabelField();
968
		traitementAcquisitionMarkLabel.hide();
969
		traitementAcquisitionMarkLabel.setFieldLabel("Si oui, lesquels ?");
970
		conservationOnglet.add(traitementAcquisitionMarkLabel);
110 jpm 971
 
569 jp_milcent 972
		poisonTraitementTrukCp = creerChoixMultipleCp();
115 jpm 973
		poisonTraitementTrukCp.hide();
974
		poisonTraitementTrukCacGrpChp = new CheckBoxGroup();
975
		poisonTraitementTrukCacGrpChp.setFieldLabel("Empoisonnement");
976
		poisonTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
977
		poisonTraitementTrukCacGrpChp.setLabelSeparator("");
978
		conservationOnglet.add(poisonTraitementTrukCp);
569 jp_milcent 979
		mediateur.obtenirListeValeurEtRafraichir(this, "poisonTraitement");
110 jpm 980
 
569 jp_milcent 981
		insecteTraitementTrukCp = creerChoixMultipleCp();
115 jpm 982
		insecteTraitementTrukCp.hide();
983
		insecteTraitementTrukCacGrpChp = new CheckBoxGroup();
984
		insecteTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
985
		insecteTraitementTrukCacGrpChp.setLabelSeparator("");
986
		insecteTraitementTrukCacGrpChp.setFieldLabel("Désinsectisation");
111 jpm 987
		conservationOnglet.add(insecteTraitementTrukCp);
569 jp_milcent 988
		mediateur.obtenirListeValeurEtRafraichir(this, "insecteTraitement");
110 jpm 989
 
579 jp_milcent 990
		conservationOnglet.add(new Html("<br />"));
108 jpm 991
		return conservationOnglet;
992
	}
993
 
231 jp_milcent 994
	private void collecterStructurePersonnel() {
995
		if (personnelOnglet.getData("acces").equals(true)) {
771 jpm 996
			personnelGrilleMagazin.commitChanges();
231 jp_milcent 997
			int nbrePersonne = personnelGrilleMagazin.getCount();
998
			for (int i = 0; i < nbrePersonne; i++) {
999
				StructureAPersonne personne = personnelGrilleMagazin.getAt(i);
771 jpm 1000
 
231 jp_milcent 1001
				// Seules les lignes ajoutées ou modifiées sont prises en compte.
771 jpm 1002
				Record record = personnelGrilleMagazin.getRecord(personne);
1003
				if (personnelGrilleMagazin.getModifiedRecords().contains(record) == true
1004
						|| (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE) )) {
245 jp_milcent 1005
 
1006
					// Gestion de l'id de la structure
1007
					if (mode.equals("MODIF")) {
1008
						personne.setIdStructure(identification.getId());
1009
					}
609 jp_milcent 1010
 
1011
					// Récupération de l'id du projet de la structure qui servira aussi pour les Personnes crées dans ce formulaire
1012
					if (personne.getIdPersonne().equals("") && projetsCombo.getValue() != null) {
1013
						personne.setIdProjetPersonne(projetsCombo.getValue().getId());
1014
					}
1015
 
231 jp_milcent 1016
					// Gestion de la fonction
1017
					String fonction = personne.get("fonction");
1018
					if (fonction != null && !fonction.equals("")) {
295 jp_milcent 1019
						Valeur valeurRecherche = fonctionsCombo.getStore().findModel("nom", fonction);
231 jp_milcent 1020
						if (valeurRecherche != null) {
1021
							personne.setFonction(valeurRecherche.getId());
1022
						} else {
1023
							personne.setFonction("AUTRE", fonction);
1024
						}
602 jp_milcent 1025
					} else {
1026
						personne.setFonction("");
231 jp_milcent 1027
					}
1028
 
1029
					// Gestion de la notion de "contact"
1030
					personne.setContact(false);
1031
					if (personne.get("contact").equals(true)) {
1032
						personne.setContact(true);
1033
					}
1034
 
1035
					// Gestion du statut
1036
					String statut = personne.get("statut");
1037
					if (statut != null && !statut.equals("")) {
1038
						Valeur valeurRecherche = comboLiStatut.getStore().findModel("nom", statut);
1039
						if (valeurRecherche != null) {
1040
							personne.setStatut(valeurRecherche.getId());
1041
						} else {
1042
							personne.setStatut("AUTRE", statut);
1043
						}
602 jp_milcent 1044
					} else {
1045
						personne.setStatut("");
231 jp_milcent 1046
					}
1047
 
1048
					// Gestion du temps de travail
602 jp_milcent 1049
					personne.setBotaTravailHebdoTps(personne.get("travail").toString());
231 jp_milcent 1050
 
1051
					// Gestion du téléphone
602 jp_milcent 1052
					String telephoneFixe = personne.get("tel_fix");
1053
					personne.setTelephoneFixe(telephoneFixe);
231 jp_milcent 1054
 
1055
					// Gestion du fax
602 jp_milcent 1056
					String fax = personne.get("tel_fax");
1057
					personne.setFax(fax);
1058
 
231 jp_milcent 1059
					// Gestion du courriel
1060
					String courriel = personne.get("courriel");
602 jp_milcent 1061
					personne.setCourriel(courriel);
231 jp_milcent 1062
 
602 jp_milcent 1063
					// Gestion de la spécialité
231 jp_milcent 1064
					String specialite = personne.get("specialite");
602 jp_milcent 1065
					personne.setSpecialite(specialite);
231 jp_milcent 1066
 
1067
					// Ajout de la personne dans la liste correspondant à son état (ajouté ou modifié)
771 jpm 1068
					if (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE)) {// Une personne ajoutée
231 jp_milcent 1069
						personnelAjoute.put(""+i, personne);
1070
					} else {// Une personne modifiée
1071
						personnelModifie.put(personne.getId(), personne);
1072
					}
245 jp_milcent 1073
				} else {
1074
					GWT.log("Personne non modifiées : "+personne.getPrenom()+" "+personne.getNom(), null);
231 jp_milcent 1075
				}
1076
			}
1077
		}
1078
	}
211 jp_milcent 1079
 
1080
	private void peuplerStructurePersonnel() {
295 jp_milcent 1081
		if (mode.equals(MODE_MODIFIER) && personnel != null) {
213 jp_milcent 1082
			ArrayList<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
1083
			for (Iterator<String> it = personnel.keySet().iterator(); it.hasNext();) {
1084
				String index = it.next();
231 jp_milcent 1085
 
1086
				// Gestion de la fonction
295 jp_milcent 1087
				if (fonctionsMagazin != null && !((String) personnel.get(index).getFonction()).startsWith("AUTRE##")) {
1088
					if (fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()) != null) {
1089
						personnel.get(index).set("fonction", fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()).getNom());
243 jp_milcent 1090
					}
213 jp_milcent 1091
				} else {
214 jp_milcent 1092
					personnel.get(index).set("fonction", personnel.get(index).getFonction().replaceFirst("AUTRE##", ""));
213 jp_milcent 1093
				}
231 jp_milcent 1094
 
1095
				// Gestion de la notion de "contact"
1096
				personnel.get(index).set("contact", (personnel.get(index).getContact().equals("1") ? true : false));
1097
 
1098
				// Gestion du statut
1099
				if (magazinLiStatut != null && ((String) personnel.get(index).getStatut()).matches("^[0-9]+$")) {
1100
					personnel.get(index).set("statut", magazinLiStatut.findModel("id_valeur", personnel.get(index).getStatut()).getNom());
1101
				} else {
1102
					personnel.get(index).set("statut", personnel.get(index).getStatut().replaceFirst("AUTRE##", ""));
1103
				}
1104
 
1105
				// Gestion du temps de travail
1106
				String tps = personnel.get(index).getBotaTravailHebdoTps();
1107
				personnel.get(index).set("travail", (tps.matches("^[0-9]+$")  ? Integer.parseInt(tps) : 0));
1108
 
213 jp_milcent 1109
				personnes.add(personnel.get(index));
1110
			}
211 jp_milcent 1111
			personnelGrilleMagazin.removeAll();
213 jp_milcent 1112
			personnelGrilleMagazin.add(personnes);
231 jp_milcent 1113
 
214 jp_milcent 1114
			// Nous vidons la variable personnel une fois qu'elle a remplie la grille
1115
			personnel = null;
211 jp_milcent 1116
		}
1117
	}
1118
 
103 jpm 1119
	private TabItem creerOngletPersonnel() {
306 jp_milcent 1120
		// Création des objets contenant les manipulations de la grille
1121
		personnelModifie = new StructureAPersonneListe();
1122
		personnelAjoute = new StructureAPersonneListe();
1123
		personnelSupprime = new StructureAPersonneListe();
1124
 
634 jp_milcent 1125
		personnelOnglet = creerOnglet("Personnel", "personnel");
569 jp_milcent 1126
		personnelOnglet.setLayout(creerFormLayout(400, LabelAlign.LEFT));
739 jpm 1127
		personnelOnglet.setStyleAttribute("padding", "0");
634 jp_milcent 1128
		personnelOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
1129
			public void handleEvent(ComponentEvent be) {
211 jp_milcent 1130
				// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
1131
				personnelOnglet.setData("acces", true);
306 jp_milcent 1132
 
609 jp_milcent 1133
				// Rafraichissement du contenu de la grille du personnel
1134
				if (mode.equals(MODE_AJOUTER)) {
1135
					rafraichirPersonnel();
1136
				}
211 jp_milcent 1137
			}
1138
		});
103 jpm 1139
 
211 jp_milcent 1140
		ContentPanel cp = new ContentPanel();
231 jp_milcent 1141
		cp.setHeading("Personnes travaillant sur les collections");
569 jp_milcent 1142
		cp.setIcon(Images.ICONES.table());
231 jp_milcent 1143
		//cp.setScrollMode(Scroll.AUTO);
1144
		cp.setLayout(new FitLayout());
559 jp_milcent 1145
		//cp.setWidth(1250);
1146
		//cp.setHeight("100%");
231 jp_milcent 1147
		cp.setFrame(true);
103 jpm 1148
 
231 jp_milcent 1149
		personnelGrilleMagazin = new ListStore<StructureAPersonne>();
245 jp_milcent 1150
		personnelGrilleMagazin.addListener(Store.Add, new Listener<StoreEvent<StructureAPersonne>>() {
1151
 
1152
			public void handleEvent(StoreEvent<StructureAPersonne> ce) {
1153
				// Activation du bouton supprimer si la grille contient un élément
1154
				if (grillePersonnel.getStore().getCount() > 0) {
1155
					supprimerPersonnelBtn.enable();
1156
				}
1157
 
1158
			}
1159
		});
231 jp_milcent 1160
 
1161
		RowNumberer r = new RowNumberer();
1162
 
102 jpm 1163
		List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
1164
 
231 jp_milcent 1165
		GridSelectionModel<StructureAPersonne> sm = new GridSelectionModel<StructureAPersonne>();
1166
		configs.add(r);
103 jpm 1167
 
214 jp_milcent 1168
		ColumnConfig column = new ColumnConfig("fonction", "Fonction", 150);
295 jp_milcent 1169
		fonctionsMagazin = new ListStore<Valeur>();
103 jpm 1170
 
295 jp_milcent 1171
		fonctionsCombo = new ComboBox<Valeur>();
1172
		fonctionsCombo.setTriggerAction(TriggerAction.ALL);
1173
		fonctionsCombo.setEditable(true);
1174
		fonctionsCombo.setDisplayField("nom");
1175
		fonctionsCombo.setStore(fonctionsMagazin);
569 jp_milcent 1176
		mediateur.obtenirListeValeurEtRafraichir(this, "fonction");
103 jpm 1177
 
295 jp_milcent 1178
		fonctionEditor = new CellEditor(fonctionsCombo) {
103 jpm 1179
			@Override
211 jp_milcent 1180
			public Object preProcessValue(Object valeur) {
295 jp_milcent 1181
				Valeur retour = null;
1182
 
1183
				if (valeur != null) {
1184
					String chaineTransmise = (String) valeur;
1185
					if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
1186
						fonctionsMagazin.add(fonctionsListe);
1187
					}
1188
					if (fonctionsMagazin.findModel("id_valeur", chaineTransmise) != null) {
1189
						retour = fonctionsMagazin.findModel("id_valeur", chaineTransmise);
1190
					} else if (fonctionsMagazin.findModel("nom", chaineTransmise) != null) {
1191
						retour = fonctionsMagazin.findModel("nom", chaineTransmise);
213 jp_milcent 1192
					} else {
295 jp_milcent 1193
						retour = new Valeur("", chaineTransmise, "", "");
213 jp_milcent 1194
					}
211 jp_milcent 1195
				}
213 jp_milcent 1196
 
211 jp_milcent 1197
				return retour;
103 jpm 1198
			}
1199
 
1200
			@Override
211 jp_milcent 1201
			public Object postProcessValue(Object valeur) {
295 jp_milcent 1202
				String retour = "";
1203
				Valeur fonctionTrouvee = null;
211 jp_milcent 1204
				if (valeur == null) {
295 jp_milcent 1205
					String valeurBrute = this.getField().getRawValue();
1206
					if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
1207
						fonctionsMagazin.add(fonctionsListe);
213 jp_milcent 1208
					}
295 jp_milcent 1209
					if (valeurBrute.matches("^[0-9]+$") && fonctionsMagazin.findModel("id_valeur", valeurBrute) != null) {
1210
						fonctionTrouvee = fonctionsMagazin.findModel("id_valeur", valeurBrute);
1211
					} else {
1212
						retour = valeurBrute;
211 jp_milcent 1213
					}
295 jp_milcent 1214
				} else if (valeur instanceof Valeur) {
1215
					fonctionTrouvee = (Valeur) valeur;
103 jpm 1216
				}
295 jp_milcent 1217
 
1218
				if (fonctionTrouvee != null) {
1219
					retour = fonctionTrouvee.getNom();
1220
				}
1221
 
1222
				return retour;
211 jp_milcent 1223
			}
103 jpm 1224
		};
1225
		column.setEditor(fonctionEditor);
102 jpm 1226
		configs.add(column);
1227
 
243 jp_milcent 1228
		column = new ColumnConfig("prenom", "Prénom", 100);
103 jpm 1229
		TextField<String> prenomChp = new TextField<String>();
1230
		prenomChp.setAllowBlank(false);
1231
		prenomChp.getMessages().setBlankText("Ce champ est obligatoire.");
980 jpm 1232
		prenomChp.setAutoValidate(true);
981 jpm 1233
		prenomChp.addStyleName(ComposantClass.OBLIGATOIRE);
980 jpm 1234
		prenomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
103 jpm 1235
		column.setEditor(new CellEditor(prenomChp));
102 jpm 1236
		configs.add(column);
1237
 
243 jp_milcent 1238
		column = new ColumnConfig("nom", "Nom", 100);
103 jpm 1239
		TextField<String> nomChp = new TextField<String>();
1240
		nomChp.setAllowBlank(false);
1241
		nomChp.getMessages().setBlankText("Ce champ est obligatoire.");
980 jpm 1242
		nomChp.setAutoValidate(true);
981 jpm 1243
		nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
980 jpm 1244
		nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
103 jpm 1245
		column.setEditor(new CellEditor(nomChp));
102 jpm 1246
		configs.add(column);
1247
 
602 jp_milcent 1248
		column = new ColumnConfig("tel_fix", "Téléphone fixe", 100);
103 jpm 1249
		TextField<String> telChp = new TextField<String>();
1250
		column.setEditor(new CellEditor(telChp));
102 jpm 1251
		configs.add(column);
1252
 
602 jp_milcent 1253
		column = new ColumnConfig("tel_fax", "Fax", 100);
103 jpm 1254
		TextField<String> faxChp = new TextField<String>();
1255
		column.setEditor(new CellEditor(faxChp));
102 jpm 1256
		configs.add(column);
1257
 
214 jp_milcent 1258
		column = new ColumnConfig("courriel", "Courriel principal", 200);
103 jpm 1259
		TextField<String> emailChp = new TextField<String>();
1260
		column.setEditor(new CellEditor(emailChp));
102 jpm 1261
		configs.add(column);
1262
 
103 jpm 1263
		magazinLiStatut = new ListStore<Valeur>();
1264
		magazinLiStatut.add(new ArrayList<Valeur>());
1265
 
1266
		comboLiStatut = new ComboBox<Valeur>();
1267
		comboLiStatut.setTriggerAction(TriggerAction.ALL);
1268
		comboLiStatut.setEditable(false);
214 jp_milcent 1269
		comboLiStatut.disableTextSelection(true);
103 jpm 1270
		comboLiStatut.setDisplayField("nom");
1271
		comboLiStatut.setStore(magazinLiStatut);
569 jp_milcent 1272
		mediateur.obtenirListeValeurEtRafraichir(this, "statut");
103 jpm 1273
 
1274
		CellEditor statutEditor = new CellEditor(comboLiStatut) {
1275
			@Override
1276
			public Object preProcessValue(Object value) {
1277
				if (value == null) {
1278
					return value;
1279
				}
1280
				return comboLiStatut.getStore().findModel("nom", (String) value);
1281
			}
1282
 
1283
			@Override
1284
			public Object postProcessValue(Object value) {
1285
				if (value == null) {
1286
					return value;
1287
				}
1288
				return ((Valeur) value).get("nom");
1289
			}
214 jp_milcent 1290
		};
103 jpm 1291
		column = new ColumnConfig("statut", "Statut", 100);
1292
		column.setEditor(statutEditor);
102 jpm 1293
		configs.add(column);
1294
 
211 jp_milcent 1295
		column = new ColumnConfig("travail", "Temps travail", 100);
103 jpm 1296
		column.setNumberFormat(NumberFormat.getFormat("##"));
1297
		NumberField tpsWChp = new NumberField();
1298
		tpsWChp.setFormat(NumberFormat.getFormat("##"));
1299
		tpsWChp.setToolTip("Ce champ doit contenir un nombre");
1300
		column.setEditor(new CellEditor(tpsWChp));
1301
		configs.add(column);
1302
 
211 jp_milcent 1303
		column = new ColumnConfig("specialite", "Spécialité principale", 150);
103 jpm 1304
		TextField<String> speChp = new TextField<String>();
1305
		column.setEditor(new CellEditor(speChp));
1306
		configs.add(column);
1307
 
211 jp_milcent 1308
		CheckColumnConfig checkColumn = new CheckColumnConfig("contact", "Contact ?", 60);
102 jpm 1309
		configs.add(checkColumn);
1310
 
1311
		ToolBar toolBar = new ToolBar();
103 jpm 1312
 
491 gduche 1313
		Button ajouterPersonnelBtn = new Button("Ajouter");
569 jp_milcent 1314
		ajouterPersonnelBtn.setIcon(Images.ICONES.vcardAjouter());
491 gduche 1315
		ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
103 jpm 1316
			@Override
491 gduche 1317
			public void componentSelected(ButtonEvent ce) {
295 jp_milcent 1318
				StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
1319
				ajouterMembreAGrillePersonnel(membreDuPersonnel);
103 jpm 1320
			}
1321
		});
1322
		toolBar.add(ajouterPersonnelBtn);
243 jp_milcent 1323
 
103 jpm 1324
		toolBar.add(new SeparatorToolItem());
243 jp_milcent 1325
 
491 gduche 1326
		supprimerPersonnelBtn = new Button("Supprimer");
569 jp_milcent 1327
		supprimerPersonnelBtn.setIcon(Images.ICONES.vcardSupprimer());
491 gduche 1328
		supprimerPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
103 jpm 1329
			@Override
491 gduche 1330
			public void componentSelected(ButtonEvent ce) {
231 jp_milcent 1331
				StructureAPersonne personne = grillePersonnel.getSelectionModel().getSelectedItem();
1332
				if (personne != null) {
1333
					// Ajout de la personne supprimée à la liste
243 jp_milcent 1334
					if (personne.getIdPersonne() != null && !personne.getIdPersonne().equals("")) {
231 jp_milcent 1335
						personnelSupprime.put(personne.getId(), personne);
1336
					}
1337
 
1338
					// Suppression de l'enregistrement de la grille
1339
					grillePersonnel.getStore().remove(personne);
1340
 
1341
					// Désactivation du bouton supprimer si la grille contient plus d'élément
1342
					if (grillePersonnel.getStore().getCount() == 0) {
491 gduche 1343
						//TODO : check : Item -> component
1344
						ce.getComponent().disable();
231 jp_milcent 1345
					}
1346
				}
103 jpm 1347
			}
1348
		});
243 jp_milcent 1349
		toolBar.add(supprimerPersonnelBtn);
1350
 
1351
		toolBar.add(new SeparatorToolItem());
1352
 
491 gduche 1353
		Button rafraichirPersonnelBtn = new Button("Rafraichir");
569 jp_milcent 1354
		rafraichirPersonnelBtn.setIcon(Images.ICONES.rafraichir());
491 gduche 1355
		rafraichirPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
243 jp_milcent 1356
			@Override
491 gduche 1357
			public void componentSelected(ButtonEvent ce) {
243 jp_milcent 1358
				rafraichirPersonnel();
1359
			}
1360
		});
1361
		toolBar.add(rafraichirPersonnelBtn);
1362
 
1363
		toolBar.add(new SeparatorToolItem());
1364
 
1365
		personneExistanteMagazin = new ListStore<Personne>();
1366
		personneExistanteMagazin.add(new ArrayList<Personne>());
1367
 
245 jp_milcent 1368
		personneExistanteCombo = new ComboBox<Personne>();
243 jp_milcent 1369
		personneExistanteCombo.setWidth(200);
1370
		personneExistanteCombo.setEmptyText("Chercher une personne existante...");
1371
		personneExistanteCombo.setTriggerAction(TriggerAction.ALL);
1372
		personneExistanteCombo.setEditable(true);
1373
		personneExistanteCombo.setDisplayField("fmt_nom_complet");
1374
		personneExistanteCombo.setStore(personneExistanteMagazin);
1375
		personneExistanteCombo.addKeyListener(new KeyListener() {
1376
 
1377
			public void componentKeyUp(ComponentEvent ce) {
1378
				if (!ce.isNavKeyPress() && personneExistanteCombo.getRawValue() != null && personneExistanteCombo.getRawValue().length() > 0) {
1379
					rafraichirPersonneExistante(personneExistanteCombo.getRawValue());
1380
				}
1381
			}
1382
 
1383
		});
1384
 
1385
		// TODO : dans GXT 2.0 plus besoin de l'adaptateur, on peut ajouter la combobox directement sur la toolbar
491 gduche 1386
			//> CHECK
1387
		toolBar.add(personneExistanteCombo);
243 jp_milcent 1388
 
491 gduche 1389
		Button ajouterPersonneExistanteBtn = new Button("Ajouter");
1390
		ajouterPersonneExistanteBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
243 jp_milcent 1391
			@Override
491 gduche 1392
			public void componentSelected(ButtonEvent ce) {
243 jp_milcent 1393
				Personne personneExistante = personneExistanteCombo.getValue();
1394
 
295 jp_milcent 1395
				if (personneExistante != null) {
1396
					StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
1397
					membreDuPersonnel.setIdPersonne(personneExistante.getId());
609 jp_milcent 1398
					membreDuPersonnel.setIdProjetPersonne(personneExistante.getIdProjet());
295 jp_milcent 1399
					membreDuPersonnel.setNom(personneExistante.getNom());
1400
					membreDuPersonnel.setPrenom(personneExistante.getPrenom());
1401
					membreDuPersonnel.setTelephone(personneExistante.getTelephone());
603 jp_milcent 1402
					membreDuPersonnel.setCourriel(personneExistante.selectionnerCourriel(1));
1403
					membreDuPersonnel.setSpecialite(personneExistante.afficherSpecialite());
295 jp_milcent 1404
 
1405
					ajouterMembreAGrillePersonnel(membreDuPersonnel);
1406
				}
243 jp_milcent 1407
			}
1408
		});
1409
		toolBar.add(ajouterPersonneExistanteBtn);
1410
 
102 jpm 1411
		cp.setTopComponent(toolBar);
1412
 
1413
		ColumnModel cm = new ColumnModel(configs);
1414
 
559 jp_milcent 1415
		grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
1416
		grillePersonnel.setHeight("100%");
103 jpm 1417
		grillePersonnel.setBorders(true);
1418
		grillePersonnel.setSelectionModel(sm);
1419
		grillePersonnel.addPlugin(checkColumn);
231 jp_milcent 1420
		grillePersonnel.addPlugin(r);
1421
		grillePersonnel.getView().setForceFit(true);
211 jp_milcent 1422
  		grillePersonnel.setAutoExpandColumn("specialite");
1423
  		grillePersonnel.setStripeRows(true);
1424
  		grillePersonnel.setTrackMouseOver(true);
295 jp_milcent 1425
  		cp.add(grillePersonnel);
231 jp_milcent 1426
		personnelOnglet.add(cp);
306 jp_milcent 1427
 
231 jp_milcent 1428
		return personnelOnglet;
1429
	}
102 jpm 1430
 
110 jpm 1431
	private TabItem creerOngletIdentification() {
1432
		//+-----------------------------------------------------------------------------------------------------------+
1433
		// Onlget formulaire IDENTIFICATION
634 jp_milcent 1434
		identificationOnglet = creerOnglet("Identification", "identification");
211 jp_milcent 1435
		identificationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
1436
			public void handleEvent(ComponentEvent be) {
1437
				peuplerStructureIdentification();
279 jp_milcent 1438
				identificationOnglet.layout();
211 jp_milcent 1439
			}
1440
		});
1441
 
110 jpm 1442
		//+-----------------------------------------------------------------------------------------------------------+
172 jp_milcent 1443
		// Champs cachés
1444
		idStructureChp = new HiddenField<String>();
1445
 
1446
		//+-----------------------------------------------------------------------------------------------------------+
110 jpm 1447
		// Fieldset IDENTITÉ
1448
		FieldSet fieldSetIdentite = new FieldSet();
1449
		fieldSetIdentite.setHeading("Identité");
1450
		fieldSetIdentite.setCollapsible(true);
569 jp_milcent 1451
		fieldSetIdentite.setLayout(creerFormLayout(120, LabelAlign.LEFT));
110 jpm 1452
 
119 jpm 1453
		nomStructureChp = new TextField<String>();
277 jp_milcent 1454
		nomStructureChp.setTabIndex(tabIndex++);
110 jpm 1455
		nomStructureChp.setFieldLabel("Nom de la structure");
1456
		nomStructureChp.setAllowBlank(false);
1457
		nomStructureChp.getMessages().setBlankText("Ce champ est obligatoire.");
981 jpm 1458
		nomStructureChp.addStyleName(ComposantClass.OBLIGATOIRE);
980 jpm 1459
		nomStructureChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
110 jpm 1460
		fieldSetIdentite.add(nomStructureChp, new FormData(450, 0));
1461
 
634 jp_milcent 1462
 
1463
		projetsMagazin = new ListStore<Projet>();
928 jpm 1464
		mediateur.selectionnerProjet(this, null);
277 jp_milcent 1465
		projetsCombo = new ComboBox<Projet>();
1466
		projetsCombo.setTabIndex(tabIndex++);
1467
		projetsCombo.setFieldLabel("Projet");
1468
		projetsCombo.setLabelSeparator("");
1469
		projetsCombo.setDisplayField("nom");
1470
		projetsCombo.setEditable(false);
1471
		projetsCombo.setTriggerAction(TriggerAction.ALL);
1472
		projetsCombo.setStore(projetsMagazin);
981 jpm 1473
		projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
980 jpm 1474
		projetsCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
277 jp_milcent 1475
		fieldSetIdentite.add(projetsCombo, new FormData(450, 0));
1476
 
110 jpm 1477
		// Création du sous-formulaire : Acronyme
1478
		LayoutContainer ligne = new LayoutContainer();
1479
		ligne.setLayout(new ColumnLayout());
564 jp_milcent 1480
		ligne.setSize(600, -1);
1481
 
110 jpm 1482
		LayoutContainer gauche = new LayoutContainer();
569 jp_milcent 1483
		gauche.setLayout(creerFormLayout(120, LabelAlign.LEFT));
110 jpm 1484
		LayoutContainer droite = new LayoutContainer();
569 jp_milcent 1485
		droite.setLayout(creerFormLayout(10, LabelAlign.LEFT));
110 jpm 1486
 
1487
		ListStore<InterneValeur> acronymes = new ListStore<InterneValeur>();
1488
		acronymes.add(InterneValeurListe.getTypeAcronyme());
1489
 
133 jpm 1490
		comboAcronyme = new ComboBox<InterneValeur>();
277 jp_milcent 1491
		comboAcronyme.setTabIndex(tabIndex++);
110 jpm 1492
		comboAcronyme.setEmptyText("Sélectioner un type d'acronyme...");
564 jp_milcent 1493
		comboAcronyme.setFieldLabel("Type d'acronyme");
110 jpm 1494
		comboAcronyme.setDisplayField("nom");
1495
		comboAcronyme.setStore(acronymes);
1496
		comboAcronyme.setEditable(false);
1497
		comboAcronyme.setTypeAhead(true);
1498
		comboAcronyme.setTriggerAction(TriggerAction.ALL);
1499
		comboAcronyme.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
1500
			@Override
1501
			public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
1502
				String acronymeAbr = se.getSelectedItem().getAbr();
1503
				if (acronymeAbr.equals("IH")) {
1504
					mnhnChp.hide();
1505
					ihChp.show();
1506
				} else if (acronymeAbr.equals("MNHN")) {
1507
					ihChp.hide();
1508
					mnhnChp.show();
1509
				} else if (acronymeAbr.equals("")) {
1510
					ihChp.hide();
1511
					mnhnChp.hide();
1512
					comboAcronyme.clearSelections();
1513
				}
1514
			}
1515
        });
564 jp_milcent 1516
		gauche.add(comboAcronyme, new FormData("95%"));
110 jpm 1517
 
1518
		ihChp = new TextField<String>();
277 jp_milcent 1519
		ihChp.setTabIndex(tabIndex++);
110 jpm 1520
		ihChp.setLabelSeparator("");
1521
		ihChp.setToolTip("Index Herbariorum : herbier de plus de 5000 échantillons");
1522
		ihChp.hide();
564 jp_milcent 1523
		droite.add(ihChp, new FormData("95%"));
110 jpm 1524
 
133 jpm 1525
		mnhnChp = new TextField<String>();
277 jp_milcent 1526
		mnhnChp.setTabIndex(tabIndex++);
110 jpm 1527
		mnhnChp.setLabelSeparator("");
1528
		mnhnChp.setToolTip("Acronyme MNHN : herbier de moins de 5000 échantillons");
1529
		mnhnChp.hide();
564 jp_milcent 1530
		droite.add(mnhnChp, new FormData("95%"));
110 jpm 1531
 
564 jp_milcent 1532
		ligne.add(gauche, new ColumnData(.5));
1533
		ligne.add(droite, new ColumnData(.5));
110 jpm 1534
		fieldSetIdentite.add(ligne);
1535
 
1536
		// Création du sous-formulaire : Type de Structure
1537
		LayoutContainer ligneTs = new LayoutContainer();
1538
		ligneTs.setLayout(new ColumnLayout());
564 jp_milcent 1539
		ligneTs.setSize(600, -1);
110 jpm 1540
 
1541
		LayoutContainer gaucheTs = new LayoutContainer();
569 jp_milcent 1542
		gaucheTs.setLayout(creerFormLayout(120, LabelAlign.LEFT));
110 jpm 1543
 
1544
		LayoutContainer droiteTs = new LayoutContainer();
569 jp_milcent 1545
		droiteTs.setLayout(creerFormLayout(10, LabelAlign.LEFT));
110 jpm 1546
 
1547
		ListStore<InterneValeur> typesStructure = new ListStore<InterneValeur>();
1548
		typesStructure.add(InterneValeurListe.getTypeStructure());
1549
 
133 jpm 1550
		comboTypeStructure = new ComboBox<InterneValeur>();
277 jp_milcent 1551
		comboTypeStructure.setTabIndex(tabIndex++);
110 jpm 1552
		comboTypeStructure.setEmptyText("Sélectioner un type de structure...");
1553
		comboTypeStructure.setFieldLabel("Statut des structures");
1554
		comboTypeStructure.setDisplayField("nom");
1555
		comboTypeStructure.setStore(typesStructure);
1556
		comboTypeStructure.setEditable(false);
1557
		comboTypeStructure.setTypeAhead(true);
1558
		comboTypeStructure.setTriggerAction(TriggerAction.ALL);
1559
		comboTypeStructure.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
1560
			@Override
1561
			public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
1562
				String typeAbr = se.getSelectedItem().getAbr();
1563
				if (typeAbr.equals("stpu")) {
1564
					comboLstpr.hide();
1565
					comboLstpu.show();
1566
				} else if (typeAbr.equals("stpr")) {
1567
					comboLstpu.hide();
1568
					comboLstpr.show();
1569
				} else if (typeAbr.equals("")) {
1570
					comboLstpr.hide();
1571
					comboLstpu.hide();
1572
					comboTypeStructure.clearSelections();
1573
				}
1574
			}
1575
        });
564 jp_milcent 1576
		gaucheTs.add(comboTypeStructure, new FormData("95%"));
110 jpm 1577
 
1578
		magazinLstpu = new ListStore<Valeur>();
133 jpm 1579
		comboLstpu = new ComboBox<Valeur>();
277 jp_milcent 1580
		comboLstpu.setTabIndex(tabIndex++);
110 jpm 1581
		//comboLstpu.setFieldLabel("Statut des structures publiques");
1582
		comboLstpu.setLabelSeparator("");
1583
		comboLstpu.setDisplayField("nom");
1584
		comboLstpu.setEditable(false);
1585
		comboLstpu.setTriggerAction(TriggerAction.ALL);
1586
		comboLstpu.setStore(magazinLstpu);
1587
		comboLstpu.hide();
564 jp_milcent 1588
		droiteTs.add(comboLstpu, new FormData("95%"));
569 jp_milcent 1589
		mediateur.obtenirListeValeurEtRafraichir(this, "stpu");
110 jpm 1590
 
1591
		magazinLstpr = new ListStore<Valeur>();
133 jpm 1592
		comboLstpr = new ComboBox<Valeur>();
277 jp_milcent 1593
		comboLstpr.setTabIndex(tabIndex++);
110 jpm 1594
		//comboLstpr.setFieldLabel("Statut des structures privées");
1595
		comboLstpr.setLabelSeparator("");
1596
		comboLstpr.setDisplayField("nom");
1597
		comboLstpr.setEditable(false);
1598
		comboLstpr.setTriggerAction(TriggerAction.ALL);
1599
		comboLstpr.setStore(magazinLstpr);
1600
		comboLstpr.hide();
564 jp_milcent 1601
		droiteTs.add(comboLstpr, new FormData("95%"));
569 jp_milcent 1602
		mediateur.obtenirListeValeurEtRafraichir(this, "stpr");
110 jpm 1603
 
1604
		ligneTs.add(gaucheTs, new ColumnData(0.5));
1605
		ligneTs.add(droiteTs, new ColumnData(0.5));
1606
		fieldSetIdentite.add(ligneTs);
1607
 
119 jpm 1608
		dateFondationChp = new DateField();
277 jp_milcent 1609
		dateFondationChp.setTabIndex(tabIndex++);
110 jpm 1610
		dateFondationChp.setFieldLabel("Date de fondation");
1611
		dateFondationChp.getPropertyEditor().getFormat();
1612
		dateFondationChp.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
1613
		dateFondationChp.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
1614
		fieldSetIdentite.add(dateFondationChp);
1615
 
564 jp_milcent 1616
		nbreTotalPersonneStructureChp = new NumberField();
231 jp_milcent 1617
		nbreTotalPersonneStructureChp.setFieldLabel("Nombre de personne travaillant dans l'institution");
1618
		nbreTotalPersonneStructureChp.setFormat(NumberFormat.getFormat("#"));
686 jp_milcent 1619
		nbreTotalPersonneStructureChp.setToolTip(i18nC.champNumerique());
231 jp_milcent 1620
		fieldSetIdentite.add(nbreTotalPersonneStructureChp);
1621
 
279 jp_milcent 1622
		identificationOnglet.add(fieldSetIdentite);
231 jp_milcent 1623
 
110 jpm 1624
		//+-----------------------------------------------------------------------------------------------------------+
1625
		// Fieldset ADRESSE
1626
		LayoutContainer principalFdAdresse = new LayoutContainer();
1627
		principalFdAdresse.setLayout(new ColumnLayout());
564 jp_milcent 1628
		principalFdAdresse.setSize(600, -1);
110 jpm 1629
 
1630
		LayoutContainer gaucheFdAdresse = new LayoutContainer();
569 jp_milcent 1631
		gaucheFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
110 jpm 1632
 
1633
		LayoutContainer droiteFdAdresse = new LayoutContainer();
569 jp_milcent 1634
		droiteFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
110 jpm 1635
 
1636
		FieldSet fieldSetAdresse = new FieldSet();
1637
		fieldSetAdresse.setHeading("Adresse");
1638
		fieldSetAdresse.setCollapsible(true);
1639
 
569 jp_milcent 1640
		fieldSetAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
110 jpm 1641
 
164 jp_milcent 1642
		adrChp = new TextArea();
277 jp_milcent 1643
		adrChp.setTabIndex(tabIndex++);
110 jpm 1644
		adrChp.setFieldLabel("Adresse");
1645
		fieldSetAdresse.add(adrChp, new FormData(550, 0));
1646
 
133 jpm 1647
		cpChp = new TextField<String>();
277 jp_milcent 1648
		cpChp.setTabIndex(tabIndex++);
110 jpm 1649
		cpChp.setFieldLabel("Code postal");
564 jp_milcent 1650
		gaucheFdAdresse.add(cpChp, new FormData("95%"));
110 jpm 1651
 
133 jpm 1652
		villeChp = new TextField<String>();
277 jp_milcent 1653
		villeChp.setTabIndex(tabIndex++);
110 jpm 1654
		villeChp.setFieldLabel("Ville");
1035 gduche 1655
		gaucheFdAdresse.add(villeChp, new FormData("95%"));
110 jpm 1656
 
1035 gduche 1657
		magazinPays = new ListStore<Valeur>();
164 jp_milcent 1658
		comboPays = new ComboBox<Valeur>();
277 jp_milcent 1659
		comboPays.setTabIndex(tabIndex++);
164 jp_milcent 1660
		comboPays.setFieldLabel("Pays");
1035 gduche 1661
		comboPays.setEmptyText("Sélectionner un pays...");
164 jp_milcent 1662
		comboPays.setEditable(true);
1663
		comboPays.setLabelSeparator("");
1664
		comboPays.setDisplayField("nom");
172 jp_milcent 1665
		comboPays.setTemplate(getTemplatePays());
1666
		comboPays.setTypeAhead(true);
164 jp_milcent 1667
		comboPays.setTriggerAction(TriggerAction.ALL);
1668
		comboPays.setStore(magazinPays);
1035 gduche 1669
 
1670
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
1671
			public void selectionChanged(SelectionChangedEvent se) {
1672
				// Rafraichir avec le pays sélectionné
1673
				obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
1674
			}
1675
		};
1676
 
1677
		comboPays.addSelectionChangedListener(selectionChange);
1678
 
1679
 
564 jp_milcent 1680
		droiteFdAdresse.add(comboPays, new FormData("95%"));
569 jp_milcent 1681
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
110 jpm 1682
 
1035 gduche 1683
		magazinRegion = new ListStore<Valeur>();
1684
		comboRegion = new ComboBox<Valeur>();
1685
		comboRegion.setTabIndex(tabIndex++);
1686
		comboRegion.setFieldLabel("Région");
1687
		comboRegion.setEmptyText("Sélectionner une région...");
1688
		comboRegion.setDisplayField("nom");
1689
		comboRegion.setTypeAhead(true);
1690
		comboRegion.setTriggerAction(TriggerAction.ALL);
1691
		comboRegion.setStore(magazinRegion);
1692
 
1693
		droiteFdAdresse.add(comboRegion, new FormData("95%"));
1694
 
1695
 
110 jpm 1696
		principalFdAdresse.add(gaucheFdAdresse, new ColumnData(.5));
1697
		principalFdAdresse.add(droiteFdAdresse, new ColumnData(.5));
1698
		fieldSetAdresse.add(principalFdAdresse);
279 jp_milcent 1699
 
110 jpm 1700
		identificationOnglet.add(fieldSetAdresse);
279 jp_milcent 1701
 
110 jpm 1702
		//+-----------------------------------------------------------------------------------------------------------+
1703
		// Fieldset TÉLÉPHONE et EMAIL
1704
		LayoutContainer principalFdTelMail = new LayoutContainer();
1705
		principalFdTelMail.setLayout(new ColumnLayout());
569 jp_milcent 1706
		principalFdTelMail.setSize(700, -1);
110 jpm 1707
 
1708
		LayoutContainer gaucheFdTelMail = new LayoutContainer();
569 jp_milcent 1709
		gaucheFdTelMail.setLayout(creerFormLayout(60, LabelAlign.LEFT));
110 jpm 1710
 
1711
		LayoutContainer droiteFdTelMail = new LayoutContainer();
569 jp_milcent 1712
		droiteFdTelMail.setLayout(creerFormLayout(60, LabelAlign.LEFT));
110 jpm 1713
 
1714
		FieldSet fieldSetTelMail = new FieldSet();
1715
		fieldSetTelMail.setHeading("Communication");
1716
		fieldSetTelMail.setCollapsible(true);
1717
 
569 jp_milcent 1718
		fieldSetTelMail.setLayout(creerFormLayout(null, LabelAlign.LEFT));
110 jpm 1719
 
133 jpm 1720
		telChp = new TextField<String>();
277 jp_milcent 1721
		telChp.setTabIndex(tabIndex++);
602 jp_milcent 1722
		telChp.setFieldLabel("Téléphone fixe");
564 jp_milcent 1723
		gaucheFdTelMail.add(telChp, new FormData("95%"));
110 jpm 1724
 
133 jpm 1725
		faxChp = new TextField<String>();
277 jp_milcent 1726
		faxChp.setTabIndex(tabIndex++);
110 jpm 1727
		faxChp.setFieldLabel("Fax");
564 jp_milcent 1728
		droiteFdTelMail.add(faxChp, new FormData("95%"));
110 jpm 1729
 
133 jpm 1730
		emailChp = new TextField<String>();
277 jp_milcent 1731
		emailChp.setTabIndex(tabIndex++);
110 jpm 1732
		emailChp.setFieldLabel("Courriel");
1733
		emailChp.setToolTip("Saisir le courriel de l'organisation, pas de courriel individuel. Ex. : accueil@organisation.org");
564 jp_milcent 1734
		gaucheFdTelMail.add(emailChp, new FormData("95%"));
110 jpm 1735
 
133 jpm 1736
		urlChp = new TextField<String>();
277 jp_milcent 1737
		urlChp.setTabIndex(tabIndex++);
110 jpm 1738
		urlChp.setFieldLabel("Site web");
564 jp_milcent 1739
		droiteFdTelMail.add(urlChp, new FormData("95%"));
110 jpm 1740
 
1741
		principalFdTelMail.add(gaucheFdTelMail, new ColumnData(.5));
1742
		principalFdTelMail.add(droiteFdTelMail, new ColumnData(.5));
1743
		fieldSetTelMail.add(principalFdTelMail);
279 jp_milcent 1744
 
110 jpm 1745
		identificationOnglet.add(fieldSetTelMail);
1746
 
1747
		return identificationOnglet;
1748
	}
1749
 
1035 gduche 1750
	public void obtenirListeRegionParPays(String strPays)	{
1751
		mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
1752
	}
1753
 
1754
	private void mettreAJourRegion()	{
1755
		//Met à jour la combo box en sélectionnant la valeur enregistrée pour la personne
1756
		if (identification.get("ce_truk_region") != null && comboRegion.getStore().getCount() > 0)	{
1757
			Valeur valeurRegion = comboRegion.getStore().findModel("id_valeur", identification.get("ce_truk_region"));
1758
			if (valeurRegion!=null)	{
1759
				comboRegion.setValue(valeurRegion);
1760
			} else if (identification.get("ce_truk_region").toString().startsWith("AUTRE##")) {
1761
				comboRegion.setRawValue(identification.get("ce_truk_region").toString().replaceFirst("^AUTRE##", ""));
1762
			}
1763
		}
1764
	}
1765
 
172 jp_milcent 1766
	private native String getTemplatePays() /*-{
1767
		return  [
1768
		'<tpl for=".">',
1769
		'<div class="x-combo-list-item">{nom} ({abreviation})</div>',
1770
		'</tpl>'
1771
		].join("");
1772
		}-*/;
1773
 
192 jp_milcent 1774
	private void peuplerCasesACocher(String donnees, CheckBoxGroup groupeCac, TextField<String> champAutre) {
1775
		String[] valeurs = donnees.split(";;");
1776
		for (int i = 0; i < valeurs.length; i++) {
1777
			if (valeurs[i].startsWith("AUTRE##")) {
1778
				champAutre.setValue(valeurs[i].replaceFirst("^AUTRE##", ""));
1779
			} else {
491 gduche 1780
				//TODO : check : List<CheckBox> cases = groupeCac.getAll();
1781
				List<Field<?>> cases = groupeCac.getAll();
192 jp_milcent 1782
				for (int j = 0; j < cases.size(); j++) {
1783
					if (cases.get(j).getId().equals("val-"+valeurs[i])) {
491 gduche 1784
						((CheckBox) cases.get(j)).setValue(true);
192 jp_milcent 1785
					}
1786
				}
1787
			}
1788
		}
1789
	}
1790
 
1791
	private void peuplerBoutonsRadio(String valeur, RadioGroup groupeBr) {
491 gduche 1792
		//List<Radio> boutons = groupeBr.getAll();
1793
		List<Field<?>> boutons = groupeBr.getAll();
192 jp_milcent 1794
		String id = valeur+"_"+groupeBr.getName().replace("_grp", "");
1795
		for (int i = 0; i < boutons.size(); i++) {
1796
			if (boutons.get(i).getId().equals(id)) {
491 gduche 1797
				((Radio) boutons.get(i)).setValue(true);
192 jp_milcent 1798
			}
1799
		}
1800
	}
1801
 
1802
	private String creerChaineDenormalisee(List<CheckBox> liste) {
1803
		String identifiants = "";
306 jp_milcent 1804
		if (liste != null) {
1805
			int taille = liste.size();
1806
			for (int i = 0; i < taille; i++) {
1807
				CheckBox cac = liste.get(i);
1808
				if (cac.isEnabled()) {
1809
					identifiants = identifiants.concat(";;"+cac.getData("id"));
1810
				}
192 jp_milcent 1811
			}
306 jp_milcent 1812
			identifiants.replaceFirst("^;;", "");
192 jp_milcent 1813
		}
306 jp_milcent 1814
		return identifiants;
192 jp_milcent 1815
	}
1816
 
934 jpm 1817
	public void afficherChampSupplementaire(Radio radioBtn) {
119 jpm 1818
		//GWT.log("Nom btn : "+radioBtn.getName()+" - Nom group : "+radioBtn.getGroup().getName(), null);
115 jpm 1819
		// Valeur du bouton radio déclenchant l'affichage des composants cachés
1820
		String valeurPourAfficher = "oui";
111 jpm 1821
 
115 jpm 1822
		// Construction de la liste des composants à afficher/cacher
1823
		String radioGroupeNom = radioBtn.getGroup().getName();
1824
		ArrayList<Object> composants = new ArrayList<Object>();
1825
		if (radioGroupeNom.equals("action_mark_grp")) {
1826
			composants.add(actionTrukCp);
1827
		} else if (radioGroupeNom.equals("future_action_mark_grp")) {
1828
			composants.add(futureActionChp);
1829
		} else if (radioGroupeNom.equals("sans_motif_acces_mark_grp")) {
1830
			composants.add(sansMotifAccesChp);
1831
		} else if (radioGroupeNom.equals("avec_motif_acces_mark_grp")) {
1832
			composants.add(avecMotifAccesChp);
1833
		} else if (radioGroupeNom.equals("recherche_mark_grp")) {
1834
			composants.add(provenanceRechercheTrukCp);
119 jpm 1835
			composants.add(typeRechercheTrukCp);
115 jpm 1836
		} else if (radioGroupeNom.equals("formation_mark_grp")) {
1837
			composants.add(formationChp);
1838
		} else if (radioGroupeNom.equals("collection_commune_mark_grp")) {
1839
			composants.add(collectionAutreTrukCp);
1840
		} else if (radioGroupeNom.equals("restauration_mark_grp")) {
1841
			composants.add(opRestauTrukCp);
1842
		} else if (radioGroupeNom.equals("traitement_mark_grp")) {
1843
			composants.add(traitementTrukCp);
1844
		} else if (radioGroupeNom.equals("echantillon_acquisition_mark_grp")) {
1845
			composants.add(traitementAcquisitionMarkRGrpChp);
1846
		} else if (radioGroupeNom.equals("traitement_acquisition_mark_grp")) {
1847
			composants.add(traitementAcquisitionMarkLabel);
1848
			composants.add(poisonTraitementTrukCp);
1849
			composants.add(insecteTraitementTrukCp);
1850
		} else if (radioGroupeNom.equals("materiel_conservation_ce_grp")) {
1851
			composants.add(autreMaterielTrukCp);
1852
			valeurPourAfficher = "non";
1853
		}
111 jpm 1854
 
115 jpm 1855
		// Nous affichons/cachons les composant de la liste
211 jp_milcent 1856
		final int nbreComposants = composants.size();
115 jpm 1857
		//GWT.log("Id : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax, null);
119 jpm 1858
		//Window.alert("Radio grp nom : "+radioGroupeNom+" - Id btn : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax);
211 jp_milcent 1859
		for (int i = 0; i < nbreComposants; i++) {
111 jpm 1860
			// En fonction du type de bouton cliquer, on affiche ou cache les champs
115 jpm 1861
			String type = radioBtn.getBoxLabel().toLowerCase();
119 jpm 1862
			//GWT.log(type, null);
115 jpm 1863
			if (radioBtn.getValue() == true) {
1864
				if (type.equals(valeurPourAfficher)) {
1865
					((Component) composants.get(i)).show();
1866
				} else {
1867
					((Component) composants.get(i)).hide();
1868
				}
111 jpm 1869
			}
1870
			// Si on a à faire à un ContentPanel, on l'actualise pour déclencher l'affichage
115 jpm 1871
			if (composants.get(i) instanceof ContentPanel) {
1872
				((ContentPanel) composants.get(i)).layout();
111 jpm 1873
			}
1874
		}
1875
 
1876
	}
1877
 
639 jp_milcent 1878
	public void rafraichir(Object nouvellesDonnees) {
1879
		try {
1880
			if (nouvellesDonnees instanceof Information) {
1881
				Information info = (Information) nouvellesDonnees;
1882
				rafraichirInformation(info);
1883
			} else if (nouvellesDonnees instanceof ValeurListe) {
1884
				ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
1885
				rafraichirValeurListe(listeValeurs);
1886
			} else if (nouvellesDonnees instanceof ProjetListe) {
1887
				ProjetListe projets = (ProjetListe) nouvellesDonnees;
1888
				rafraichirProjetListe(projets);
1889
			} else {
1890
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
295 jp_milcent 1891
			}
639 jp_milcent 1892
		} catch (Exception e) {
875 jpm 1893
			GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), e);
109 jpm 1894
		}
1895
 
782 jpm 1896
		controlerFermetureApresRafraichissement();
109 jpm 1897
	}
1898
 
639 jp_milcent 1899
	public void rafraichirInformation(Information info) {
1900
		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
1901
			GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
1902
		}
1903
 
1904
		if (info.getType().equals("modif_structure")) {
1905
			Info.display("Modification d'une institution", info.toString());
1906
		} else if (info.getType().equals("ajout_structure")) {
770 jpm 1907
			if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
1908
				String structureId = (String) info.getDonnee(0);
1909
				Info.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
1910
 
639 jp_milcent 1911
				// Suite à la récupération de l'id de l'institution nouvellement ajoutée nous ajoutons le personnel
770 jpm 1912
				mediateur.ajouterStructureAPersonne(this, structureId, personnelAjoute);
639 jp_milcent 1913
			} else {
1914
				Info.display("Ajout d'une Institution", info.toString());
1915
			}
1916
		} else if (info.getType().equals("modif_structure_a_personne")) {
1917
			Info.display("Modification du Personnel", info.toString());
1918
			GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
1919
			testerLancementRafraichirPersonnel();
1920
		} else if (info.getType().equals("suppression_structure_a_personne")) {
1921
			Info.display("Suppression du Personnel", info.toString());
1922
			GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
1923
			testerLancementRafraichirPersonnel();
1924
		} else if (info.getType().equals("ajout_structure_a_personne")) {
1925
			Info.display("Ajout du Personnel", info.toString());
1926
			GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
1927
			testerLancementRafraichirPersonnel();
1928
		} else if (info.getType().equals("selection_structure")) {
1929
			Info.display("Modification d'une institution", info.toString());
1930
			String titre = i18nC.titreModifFormStructurePanneau();
1931
			if (info.getDonnee(0) != null) {
1932
				identification = (Structure) info.getDonnee(0);
1933
				if (onglets.getSelectedItem().equals(identificationOnglet)) {
1934
					peuplerStructureIdentification();
188 jp_milcent 1935
				}
639 jp_milcent 1936
				// Composition du titre
1937
				titre += " - ID : "+identification.getId();
1938
			}
1939
			if (info.getDonnee(1) != null) {
1940
				conservation = (StructureConservation) info.getDonnee(1);
1941
				if (onglets.getSelectedItem().equals(conservationOnglet)) {
1942
					peuplerStructureConservation();
1943
				}
1944
			}
1945
			if (info.getDonnee(2) != null) {
1946
				valorisation = (StructureValorisation) info.getDonnee(2);
1947
				if (valorisation != null) {
1948
					if (onglets.getSelectedItem().equals(valorisationOnglet)) {
1949
						peuplerStructureValorisation();
231 jp_milcent 1950
					}
639 jp_milcent 1951
				}
1952
			}
1953
			panneauFormulaire.setHeading(titre);
1954
		} else if (info.getType().equals("liste_structure_a_personne")) {
1955
			if (info.getDonnee(0) != null) {
1956
				personnel = (StructureAPersonneListe) info.getDonnee(0);
243 jp_milcent 1957
 
639 jp_milcent 1958
				peuplerStructurePersonnel();
1959
				personnelOnglet.layout();
1960
				Info.display("Chargement du Personnel", "ok");
609 jp_milcent 1961
 
639 jp_milcent 1962
				// Remise à zéro des modification dans la liste du personnel
1963
				personnelModifie = new StructureAPersonneListe();
1964
				personnelAjoute = new StructureAPersonneListe();
1965
				personnelSupprime = new StructureAPersonneListe();
1966
			}
1967
		} else if (info.getType().equals("liste_personne")) {
1968
			if (info.getDonnee(0) != null) {
1969
				PersonneListe personnes = (PersonneListe) info.getDonnee(0);
704 jp_milcent 1970
				List<Personne> liste = personnes.toList();
639 jp_milcent 1971
 
1972
				personneExistanteMagazin.removeAll();
1973
				personneExistanteMagazin.add(liste);
1974
				personneExistanteCombo.setStore(personneExistanteMagazin);
1975
				personneExistanteCombo.expand();
1976
			}
1977
		}
1978
	}
1979
 
1980
	public void rafraichirValeurListe(ValeurListe listeValeurs) {
1981
		List<Valeur> liste = listeValeurs.toList();
407 jp_milcent 1982
 
639 jp_milcent 1983
		// Test pour savoir si la liste contient des éléments
1984
		if (liste.size() > 0) {
1985
			if (listeValeurs.getId().equals(config.getListeId("stpr"))) {
1986
				magazinLstpr.removeAll();
1987
				magazinLstpr.add(liste);
1988
				comboLstpr.setStore(magazinLstpr);
1989
			}
1990
			if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
1991
				magazinLstpu.removeAll();
1992
				magazinLstpu.add(liste);
1993
				comboLstpu.setStore(magazinLstpu);
1994
			}
1995
			if (listeValeurs.getId().equals(config.getListeId("statut"))) {
1996
				magazinLiStatut.removeAll();
1997
				magazinLiStatut.add(liste);
1998
				comboLiStatut.setStore(magazinLiStatut);
1999
			}
2000
			if (listeValeurs.getId().equals(config.getListeId("fonction"))) {
2001
				// FIXME : le store ne contient pas tout le temps les données, chose étrange.
2002
				// On stocke donc les données dans une variables de la classe pour recharger le store si besoin.
2003
				fonctionsListe = liste;
2004
				fonctionsMagazin.removeAll();
2005
				fonctionsMagazin.add(liste);
2006
				fonctionsCombo.setStore(fonctionsMagazin);
2007
			}
2008
			if (listeValeurs.getId().equals(config.getListeId("pays"))) {
2009
				magazinPays.removeAll();
2010
				magazinPays.add(liste);
2011
				comboPays.setStore(magazinPays);
2012
			}
1035 gduche 2013
 
2014
			if (listeValeurs.getId().equals(config.getListeId("region"))) {
2015
				magazinRegion.removeAll();
2016
				magazinRegion.add(liste);
2017
				comboRegion.setStore(magazinRegion);
2018
 
2019
				mettreAJourRegion();
2020
			}
2021
 
2022
 
639 jp_milcent 2023
			if (listeValeurs.getId().equals(config.getListeId("localStockage"))) {
2024
				localStockageAutreChp = new TextField<String>();
2025
				creerChoixMultipleCac(localStockageTrukCp, localStockageTrukCacGrpChp, listeValeurs, localStockageAutreChp);
2026
			}
2027
			if (listeValeurs.getId().equals(config.getListeId("meubleStockage"))) {
2028
				meubleStockageAutreChp = new TextField<String>();
2029
				creerChoixMultipleCac(meubleStockageTrukCp, meubleStockageTrukCacGrpChp, listeValeurs, meubleStockageAutreChp);
2030
			}
2031
			if (listeValeurs.getId().equals(config.getListeId("parametreStockage"))) {
2032
				parametreStockageAutreChp = new TextField<String>();
2033
				creerChoixMultipleCac(parametreStockageTrukCp, parametreStockageTrukCacGrpChp, listeValeurs, parametreStockageAutreChp);
2034
			}
2035
			if (listeValeurs.getId().equals(config.getListeId("autreCollection"))) {
2036
				if (collectionAutreTrukCp != null && collectionAutreTrukCp.getItemByItemId("collectionAutreTrukCacGrpChp") == null) {
2037
					collectionAutreTrukCacGrpChp.setId("collectionAutreTrukCacGrpChp");
2038
					collectionAutreAutreChp = new TextField<String>();
2039
					creerChoixMultipleCac(collectionAutreTrukCp, collectionAutreTrukCacGrpChp, listeValeurs, collectionAutreAutreChp);
110 jpm 2040
				}
639 jp_milcent 2041
				if (autreCollectionTrukCp != null && autreCollectionTrukCp.getItemByItemId("autreCollectionTrukCacGrpChp") == null) {
2042
					autreCollectionTrukCacGrpChp.setId("autreCollectionTrukCacGrpChp");
2043
					autreCollectionAutreChp = new TextField<String>();
2044
					creerChoixMultipleCac(autreCollectionTrukCp, autreCollectionTrukCacGrpChp, listeValeurs, autreCollectionAutreChp);
277 jp_milcent 2045
				}
91 jpm 2046
			}
639 jp_milcent 2047
			if (listeValeurs.getId().equals(config.getListeId("opRestau"))) {
2048
				opRestauAutreChp = new TextField<String>();
2049
				creerChoixMultipleCac(opRestauTrukCp, opRestauTrukCacGrpChp, listeValeurs, opRestauAutreChp);
2050
			}
2051
			if (listeValeurs.getId().equals(config.getListeId("onep"))) {
2052
				creerChoixUniqueBoutonRadio(materielConservationCeRGrpChp, listeValeurs);
2053
				materielConservationCp.add(materielConservationCeRGrpChp);
2054
				materielConservationCp.layout();
2055
			}
2056
			if (listeValeurs.getId().equals(config.getListeId("autreMateriel"))) {
2057
				autreMaterielAutreChp = new TextField<String>();
2058
				creerChoixMultipleCac(autreMaterielTrukCp, autreMaterielTrukCacGrpChp, listeValeurs, autreMaterielAutreChp);
2059
			}
2060
			if (listeValeurs.getId().equals(config.getListeId("poisonTraitement"))) {
2061
				poisonTraitementAutreChp = new TextField<String>();
2062
				creerChoixMultipleCac(poisonTraitementTrukCp, poisonTraitementTrukCacGrpChp, listeValeurs, poisonTraitementAutreChp);
2063
			}
2064
			if (listeValeurs.getId().equals(config.getListeId("insecteTraitement"))) {
2065
				if (traitementTrukCp != null && traitementTrukCp.getItemByItemId("traitementTrukCacGrpChp") == null) {
2066
					traitementTrukCacGrpChp.setId("traitementTrukCacGrpChp");
2067
					traitementAutreChp = new TextField<String>();
2068
					creerChoixMultipleCac(traitementTrukCp, traitementTrukCacGrpChp, listeValeurs, traitementAutreChp);
2069
				}
2070
				if (insecteTraitementTrukCp != null && insecteTraitementTrukCp.getItemByItemId("insecteTraitementTrukCacGrpChp") == null) {
2071
					insecteTraitementTrukCacGrpChp.setId("insecteTraitementTrukCacGrpChp");
2072
					insecteTraitementAutreChp = new TextField<String>();
2073
					creerChoixMultipleCac(insecteTraitementTrukCp, insecteTraitementTrukCacGrpChp, listeValeurs, insecteTraitementAutreChp);
2074
				}
2075
			}
2076
			if (listeValeurs.getId().equals(config.getListeId("actionValorisation"))) {
2077
				actionAutreChp = new TextField<String>();
2078
				creerChoixMultipleCac(actionTrukCp, actionTrukCacGrpChp, listeValeurs, actionAutreChp);
2079
			}
2080
			if (listeValeurs.getId().equals(config.getListeId("continentEtFr"))) {
2081
				provenanceRechercheAutreChp = new TextField<String>();
2082
				creerChoixMultipleCac(provenanceRechercheTrukCp, provenanceRechercheTrukCacGrpChp, listeValeurs, provenanceRechercheAutreChp);
2083
			}
2084
			if (listeValeurs.getId().equals(config.getListeId("typeRecherche"))) {
2085
				typeRechercheAutreChp = new TextField<String>();
2086
				creerChoixMultipleCac(typeRechercheTrukCp, typeRechercheTrukCacGrpChp, listeValeurs, typeRechercheAutreChp);
2087
			}
2088
			//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
2089
		} else {
2090
			GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
91 jpm 2091
		}
639 jp_milcent 2092
	}
2093
 
2094
	private void rafraichirProjetListe(ProjetListe projets) {
686 jp_milcent 2095
		List<Projet> liste = projets.toList();
639 jp_milcent 2096
		projetsMagazin.removeAll();
2097
		projetsMagazin.add(liste);
2098
		projetsCombo.setStore(projetsMagazin);
69 jpm 2099
	}
243 jp_milcent 2100
 
609 jp_milcent 2101
	private void testerLancementRafraichirPersonnel() {
2102
		decompteRafraichissementPersonnel--;
2103
		if (decompteRafraichissementPersonnel == 0) {
2104
			// Nous rechargeons la liste du Personnel
2105
			rafraichirPersonnel();
2106
		}
2107
	}
2108
 
243 jp_milcent 2109
	private void rafraichirPersonnel() {
609 jp_milcent 2110
		decompteRafraichissementPersonnel = 0;
295 jp_milcent 2111
		if (mode.equals(MODE_MODIFIER)) {
609 jp_milcent 2112
			initialiserGrillePersonnelEnModification();
295 jp_milcent 2113
		} else if (mode.equals(MODE_AJOUTER)) {
2114
			initialiserGrillePersonnelEnAjout();
2115
		}
243 jp_milcent 2116
	}
2117
 
2118
	private void rafraichirPersonneExistante(String nom) {
245 jp_milcent 2119
		mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%");
243 jp_milcent 2120
	}
295 jp_milcent 2121
 
2122
	private void ajouterMembreAGrillePersonnel(StructureAPersonne personnel) {
2123
		grillePersonnel.stopEditing();
306 jp_milcent 2124
		personnelGrilleMagazin.insert(personnel, 0);
295 jp_milcent 2125
		grillePersonnel.startEditing(0, 0);
2126
	}
2127
 
2128
	private void initialiserGrillePersonnelEnAjout() {
2129
		personnelGrilleMagazin.removeAll();
2130
		StructureAPersonne conservateurDesCollections = new StructureAPersonne(StructureAPersonne.FONCTION_CONSERVATEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
2131
		ajouterMembreAGrillePersonnel(conservateurDesCollections);
2132
		StructureAPersonne directeurDuPersonnel = new StructureAPersonne(StructureAPersonne.FONCTION_DIRECTEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
2133
		ajouterMembreAGrillePersonnel(directeurDuPersonnel);
609 jp_milcent 2134
		personnelOnglet.layout();
295 jp_milcent 2135
	}
2136
 
609 jp_milcent 2137
	private void initialiserGrillePersonnelEnModification() {
295 jp_milcent 2138
		mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE);
2139
	}
115 jpm 2140
}