Subversion Repositories eFlore/Applications.coel

Rev

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

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