Subversion Repositories eFlore/Applications.coel

Rev

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