Subversion Repositories eFlore/Applications.coel

Rev

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