Subversion Repositories eFlore/Applications.coel

Rev

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

Rev Author Line No. Line
69 jpm 1
package org.tela_botanica.client.vues;
2
 
91 jpm 3
import java.util.ArrayList;
4
import java.util.Iterator;
69 jpm 5
import java.util.List;
6
 
172 jp_milcent 7
import org.tela_botanica.client.ComposantId;
119 jpm 8
import org.tela_botanica.client.Mediateur;
91 jpm 9
import org.tela_botanica.client.Modele;
10
import org.tela_botanica.client.RegistreId;
115 jpm 11
import org.tela_botanica.client.i18n.Constantes;
69 jpm 12
import org.tela_botanica.client.interfaces.Rafraichissable;
91 jpm 13
import org.tela_botanica.client.modeles.Configuration;
153 jpm 14
import org.tela_botanica.client.modeles.Information;
100 jpm 15
import org.tela_botanica.client.modeles.InterneValeur;
16
import org.tela_botanica.client.modeles.InterneValeurListe;
102 jpm 17
import org.tela_botanica.client.modeles.Personne;
119 jpm 18
import org.tela_botanica.client.modeles.Structure;
211 jp_milcent 19
import org.tela_botanica.client.modeles.StructureAPersonne;
20
import org.tela_botanica.client.modeles.StructureAPersonneListe;
188 jp_milcent 21
import org.tela_botanica.client.modeles.StructureConservation;
211 jp_milcent 22
import org.tela_botanica.client.modeles.StructureListe;
192 jp_milcent 23
import org.tela_botanica.client.modeles.StructureValorisation;
91 jpm 24
import org.tela_botanica.client.modeles.Valeur;
25
import org.tela_botanica.client.modeles.ValeurListe;
69 jpm 26
 
111 jpm 27
import com.extjs.gxt.ui.client.Events;
91 jpm 28
import com.extjs.gxt.ui.client.Registry;
69 jpm 29
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
110 jpm 30
import com.extjs.gxt.ui.client.Style.Scroll;
211 jp_milcent 31
import com.extjs.gxt.ui.client.event.BaseEvent;
111 jpm 32
import com.extjs.gxt.ui.client.event.ComponentEvent;
33
import com.extjs.gxt.ui.client.event.Listener;
100 jpm 34
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
35
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
103 jpm 36
import com.extjs.gxt.ui.client.event.SelectionListener;
37
import com.extjs.gxt.ui.client.event.ToolBarEvent;
69 jpm 38
import com.extjs.gxt.ui.client.store.ListStore;
172 jp_milcent 39
import com.extjs.gxt.ui.client.store.Store;
111 jpm 40
import com.extjs.gxt.ui.client.widget.Component;
102 jpm 41
import com.extjs.gxt.ui.client.widget.ContentPanel;
153 jpm 42
import com.extjs.gxt.ui.client.widget.Info;
69 jpm 43
import com.extjs.gxt.ui.client.widget.LayoutContainer;
100 jpm 44
import com.extjs.gxt.ui.client.widget.TabItem;
45
import com.extjs.gxt.ui.client.widget.TabPanel;
188 jp_milcent 46
import com.extjs.gxt.ui.client.widget.WidgetComponent;
69 jpm 47
import com.extjs.gxt.ui.client.widget.button.Button;
108 jpm 48
import com.extjs.gxt.ui.client.widget.form.CheckBox;
49
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
69 jpm 50
import com.extjs.gxt.ui.client.widget.form.ComboBox;
100 jpm 51
import com.extjs.gxt.ui.client.widget.form.DateField;
119 jpm 52
import com.extjs.gxt.ui.client.widget.form.Field;
100 jpm 53
import com.extjs.gxt.ui.client.widget.form.FieldSet;
69 jpm 54
import com.extjs.gxt.ui.client.widget.form.FormPanel;
172 jp_milcent 55
import com.extjs.gxt.ui.client.widget.form.HiddenField;
103 jpm 56
import com.extjs.gxt.ui.client.widget.form.LabelField;
102 jpm 57
import com.extjs.gxt.ui.client.widget.form.NumberField;
109 jpm 58
import com.extjs.gxt.ui.client.widget.form.Radio;
59
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
164 jp_milcent 60
import com.extjs.gxt.ui.client.widget.form.TextArea;
69 jpm 61
import com.extjs.gxt.ui.client.widget.form.TextField;
62
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
63
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
102 jpm 64
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
65
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
66
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
67
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
68
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
69
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
69 jpm 70
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
71
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
72
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
73
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
100 jpm 74
import com.extjs.gxt.ui.client.widget.layout.FormData;
69 jpm 75
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
110 jpm 76
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
102 jpm 77
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
78
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
79
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
91 jpm 80
import com.google.gwt.core.client.GWT;
100 jpm 81
import com.google.gwt.i18n.client.DateTimeFormat;
102 jpm 82
import com.google.gwt.i18n.client.NumberFormat;
192 jp_milcent 83
import com.google.gwt.user.client.Event;
133 jpm 84
import com.google.gwt.user.client.Window;
188 jp_milcent 85
import com.google.gwt.user.client.ui.HTML;
86
import com.google.gwt.user.client.ui.Widget;
69 jpm 87
 
88
public class FormStructureVue extends LayoutContainer implements Rafraichissable {
115 jpm 89
 
90
	private Constantes i18nC = null;
119 jpm 91
	private Mediateur mediateur = null;
92
	private Modele modele = null ;
93
 
156 jp_milcent 94
	private String mode = "AJOUT";
206 jp_milcent 95
	private FormPanel structureFormPanneau = null;
133 jpm 96
	private int tabIndex = 100;
206 jp_milcent 97
	private TabPanel onglets = null;
192 jp_milcent 98
 
206 jp_milcent 99
	private TabItem identificationOnglet = null;
192 jp_milcent 100
	private TabItem personnelOnglet = null;
101
	private TabItem conservationOnglet = null;
102
	private TabItem valorisationOnglet = null;
206 jp_milcent 103
 
104
	private HiddenField<String> idStructureChp = null;
115 jpm 105
 
206 jp_milcent 106
	// Onglet IDENTIFICATION
211 jp_milcent 107
	private Structure identification;
91 jpm 108
	private ListStore<Valeur> magazinLstpr = null;
109
	private ComboBox<Valeur> comboLstpr = null;
110
	private ListStore<Valeur> magazinLstpu = null;
111
	private ComboBox<Valeur> comboLstpu = null;
103 jpm 112
	private ListStore<Valeur> magazinLiStatut = null;
113
	private ComboBox<Valeur> comboLiStatut = null;
114
	private ListStore<Valeur> magazinLiFonction = null;
115
	private ComboBox<Valeur> comboLiFonction = null;
100 jpm 116
	private ComboBox<InterneValeur> comboAcronyme = null;
117
	private TextField<String> ihChp = null;
118
	private TextField<String> mnhnChp = null;
119
	private ComboBox<InterneValeur> comboTypeStructure = null;
206 jp_milcent 120
	private TextField<String> nomStructureChp;
121
	private DateField dateFondationChp;
122
	private TextArea adrChp;
123
	private TextField<String> cpChp;
124
	private TextField<String> villeChp;
125
	private TextField<String> regionChp;
126
	private TextField<String> telChp;
127
	private TextField<String> faxChp;
128
	private TextField<String> emailChp;
129
	private TextField<String> urlChp;
130
	private ListStore<Valeur> magazinPays;
131
	private ComboBox<Valeur> comboPays;
192 jp_milcent 132
 
206 jp_milcent 133
	// Onglet PERSONNEL
213 jp_milcent 134
	private StructureAPersonneListe  personnel;
211 jp_milcent 135
	private NumberField nbreTotalPersonneStructureChp = null;
136
	private EditorGrid<StructureAPersonne> grillePersonnel = null;
137
	private ListStore<StructureAPersonne> personnelGrilleMagazin = null;
103 jpm 138
	private LabelField nbreTotalPersonnelChp = null;
211 jp_milcent 139
 
206 jp_milcent 140
	// Onglet CONSERVATION
211 jp_milcent 141
	private StructureConservation conservation = null;
206 jp_milcent 142
	private RadioGroup formationMarkRGrpChp;
143
	private RadioGroup interetFormationMarkRGrpChp;
144
	private RadioGroup collectionCommuneMarkRGrpChp;
145
	private RadioGroup accesControleMarkRGrpChp;
146
	private RadioGroup restaurationMarkRGrpChp;
147
	private RadioGroup traitementMarkRGrpChp;
148
	private RadioGroup collectionAcquisitionMarkRGrpChp;
149
	private RadioGroup echantillonAcquisitionMarkRGrpChp;
150
	private TextField<String> localStockageAutreChp;
151
	private TextField<String> meubleStockageAutreChp;
152
	private TextField<String> parametreStockageAutreChp;
153
	private TextField<String> collectionAutreAutreChp;
154
	private TextField<String> autreCollectionAutreChp;
155
	private TextField<String> opRestauAutreChp;
156
	private TextField<String> autreMaterielAutreChp;
157
	private TextField<String> poisonTraitementAutreChp;
158
	private TextField<String> traitementAutreChp;
159
	private TextField<String> insecteTraitementAutreChp;
160
	private TextField<String> actionAutreChp;
161
	private TextField<String> provenanceRechercheAutreChp;
162
	private TextField<String> typeRechercheAutreChp;
115 jpm 163
	private CheckBoxGroup localStockageTrukCacGrpChp = null;
164
	private ContentPanel localStockageTrukCp = null;
165
	private CheckBoxGroup meubleStockageTrukCacGrpChp = null;
166
	private ContentPanel meubleStockageTrukCp = null;
167
	private CheckBoxGroup parametreStockageTrukCacGrpChp = null;
168
	private ContentPanel parametreStockageTrukCp = null;
111 jpm 169
	private ContentPanel collectionAutreTrukCp = null;
170
	private CheckBoxGroup collectionAutreTrukCacGrpChp = null;
115 jpm 171
	private CheckBoxGroup opRestauTrukCacGrpChp = null;
111 jpm 172
	private ContentPanel opRestauTrukCp = null;
115 jpm 173
	private CheckBoxGroup autreMaterielTrukCacGrpChp = null;
174
	private ContentPanel autreMaterielTrukCp = null;
111 jpm 175
	private ContentPanel traitementTrukCp = null;
176
	private CheckBoxGroup traitementTrukCacGrpChp = null;
115 jpm 177
	private ContentPanel poisonTraitementTrukCp = null;
111 jpm 178
	private ContentPanel insecteTraitementTrukCp = null;
179
	private CheckBoxGroup insecteTraitementTrukCacGrpChp = null;
115 jpm 180
	private CheckBoxGroup poisonTraitementTrukCacGrpChp = null;
181
	private ContentPanel autreCollectionTrukCp = null;
119 jpm 182
	private CheckBoxGroup autreCollectionTrukCacGrpChp = null;
115 jpm 183
	private ContentPanel provenanceRechercheTrukCp = null;
184
	private CheckBoxGroup provenanceRechercheTrukCacGrpChp = null;
185
	private CheckBoxGroup typeRechercheTrukCacGrpChp = null;
119 jpm 186
	private ContentPanel typeRechercheTrukCp = null;
115 jpm 187
	private TextField<String> futureActionChp = null;
188
	private TextField<String> sansMotifAccesChp = null;
189
	private TextField<String> avecMotifAccesChp = null;
190
	private TextField<String> formationChp = null;
191
	private RadioGroup traitementAcquisitionMarkRGrpChp = null;
192
	private LabelField traitementAcquisitionMarkLabel = null;
193
	private RadioGroup materielConservationCeRGrpChp = null;
119 jpm 194
 
206 jp_milcent 195
	// Onglet VALORISATION
211 jp_milcent 196
	private StructureValorisation valorisation = null;
206 jp_milcent 197
	private RadioGroup actionMarkRGrpChp = null;
198
	private ContentPanel actionTrukCp = null;
199
	private CheckBoxGroup actionTrukCacGrpChp = null;
188 jp_milcent 200
	private RadioGroup futureActionMarkRGrpChp;
201
	private RadioGroup rechercheMarkRGrpChp;
202
	private RadioGroup sansMotifAccesMarkRGrpChp;
203
	private RadioGroup avecMotifAccesMarkRGrpChp;
204
	private TextField<String> publicationChp;
205
	private ContentPanel materielConservationCp;
192 jp_milcent 206
 
211 jp_milcent 207
 
208
 
69 jpm 209
	public FormStructureVue() {
100 jpm 210
		//+-----------------------------------------------------------------------------------------------------------+
211
		// Initialisation de variables
115 jpm 212
		i18nC = GWT.create(Constantes.class);
69 jpm 213
		setLayout(new FitLayout());
119 jpm 214
		modele = Registry.get(RegistreId.MODELE);
215
		mediateur = Registry.get(RegistreId.MEDIATEUR);
216
 
100 jpm 217
		//+-----------------------------------------------------------------------------------------------------------+
110 jpm 218
		// Création du panneau du FORMULAIRE GÉNÉRAL
119 jpm 219
		structureFormPanneau = new FormPanel();
220
		structureFormPanneau.setFrame(true);
221
		structureFormPanneau.setIconStyle("icone-form-ajouter");
222
		structureFormPanneau.setCollapsible(false);
156 jp_milcent 223
		structureFormPanneau.setHeading(i18nC.titreAjoutFormStructurePanneau());
119 jpm 224
		structureFormPanneau.setButtonAlign(HorizontalAlignment.CENTER);
225
		structureFormPanneau.setLayout(new FlowLayout());
100 jpm 226
 
110 jpm 227
		//+-----------------------------------------------------------------------------------------------------------+
100 jpm 228
		// Création des onglets
192 jp_milcent 229
		onglets = new TabPanel();
110 jpm 230
		// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner)
231
		onglets.setHeight("100%");
69 jpm 232
 
100 jpm 233
		//+-----------------------------------------------------------------------------------------------------------+
234
		// Onlget formulaire IDENTIFICATION
110 jpm 235
		onglets.add(creerOngletIdentification());
206 jp_milcent 236
 
100 jpm 237
		//+-----------------------------------------------------------------------------------------------------------+
238
		// Onlget formulaire PERSONNEL
103 jpm 239
		onglets.add(creerOngletPersonnel());
91 jpm 240
 
100 jpm 241
		//+-----------------------------------------------------------------------------------------------------------+
242
		// Onlget formulaire CONSERVATION
108 jpm 243
		onglets.add(creerOngletConservation());
100 jpm 244
 
245
		//+-----------------------------------------------------------------------------------------------------------+
246
		// Onlget formulaire VALORISATION
111 jpm 247
		onglets.add(creerOngletValorisation());
100 jpm 248
 
249
		//+-----------------------------------------------------------------------------------------------------------+
250
		// Gestion du FORMULAIRE GÉNÉRAL
251
 
119 jpm 252
		// Sélection de l'onglet par défaut
211 jp_milcent 253
		onglets.setSelection(personnelOnglet);
192 jp_milcent 254
 
119 jpm 255
		// Ajout des onglets au formulaire général
256
		structureFormPanneau.add(onglets);
69 jpm 257
 
258
		// Ajout des boutons au panneau formulaire
259
		Button annulerBtn = new Button("Annuler");
172 jp_milcent 260
		annulerBtn.addSelectionListener(new SelectionListener<ComponentEvent>() {
261
 
262
			@Override
263
			public void componentSelected(ComponentEvent ce) {
264
				mediateur.clicMenu("Institutions");
265
			}
266
 
267
		});
119 jpm 268
		structureFormPanneau.addButton(annulerBtn);
69 jpm 269
		Button validerBtn = new Button("Valider");
119 jpm 270
		validerBtn.addSelectionListener(new SelectionListener<ComponentEvent>() {
271
 
272
			@Override
273
			public void componentSelected(ComponentEvent ce) {
274
				soumettreFormulaire();
275
			}
276
 
277
		});
278
		structureFormPanneau.addButton(validerBtn);
69 jpm 279
 
280
		// Ajout du panneau Formulaire à la disposition générale
119 jpm 281
		add(structureFormPanneau);
69 jpm 282
	}
108 jpm 283
 
119 jpm 284
	private void soumettreFormulaire() {
285
		GWT.log("Soumission du formulaire", null);
192 jp_milcent 286
		Structure structure = collecterStructureIdentification();
287
		StructureConservation conservation = collecterStructureConservation();
288
		StructureValorisation valorisation = collecterStructureValorisation();
156 jp_milcent 289
		if (mode == "AJOUT") {
164 jp_milcent 290
			//mediateur.ajouterStructure(this, structure);
156 jp_milcent 291
		} else if (mode == "MODIF") {
192 jp_milcent 292
			mediateur.modifierStructure(this, structure, conservation, valorisation);
156 jp_milcent 293
		}
211 jp_milcent 294
		GWT.log("Info Structure envoyées :\n"+conservation.toString(), null);
119 jpm 295
	}
296
 
192 jp_milcent 297
	private StructureValorisation collecterStructureValorisation() {
206 jp_milcent 298
		if (valorisationOnglet.getData("acces").equals(false)) {
299
			return valorisation;
300
		} else {
301
			// Création de l'objet
302
			StructureValorisation valorisationModifie = new StructureValorisation();
303
 
304
			// ACTION
305
			if (actionMarkRGrpChp.getValue() != null) {
306
				valorisationModifie.setAction(actionMarkRGrpChp.getValue().getValueAttribute());
307
			}
308
 
309
			// ACTION INFO
310
			valorisationModifie.setActionInfo(creerChaineDenormalisee(actionTrukCacGrpChp.getValues()));
311
			valorisationModifie.setActionInfo("AUTRE", actionAutreChp.getValue());
312
 
313
			// PUBLICATION
314
			valorisationModifie.setPublication(publicationChp.getValue());
315
 
316
			// COLLECTION AUTRE
317
			valorisationModifie.setCollectionAutre(creerChaineDenormalisee(autreCollectionTrukCacGrpChp.getValues()));
318
			valorisationModifie.setCollectionAutre("AUTRE", autreCollectionAutreChp.getValue());
319
 
320
			// ACTION FUTURE
321
			if (futureActionMarkRGrpChp.getValue() != null) {
322
				valorisationModifie.setActionFuture(futureActionMarkRGrpChp.getValue().getValueAttribute());
323
			}
324
			// ACTION FUTURE INFO
325
			valorisationModifie.setActionFutureInfo(futureActionChp.getValue());
326
 
327
			// RECHERCHE
328
			if (rechercheMarkRGrpChp.getValue() != null) {
329
				valorisationModifie.setRecherche(rechercheMarkRGrpChp.getValue().getValueAttribute());
330
			}
331
 
332
			// RECHERCHE PROVENANCE
333
			valorisationModifie.setRechercheProvenance(creerChaineDenormalisee(provenanceRechercheTrukCacGrpChp.getValues()));
334
			valorisationModifie.setRechercheProvenance("AUTRE", provenanceRechercheAutreChp.getValue());
335
 
336
			// RECHERCHE TYPE
337
			valorisationModifie.setRechercheType(creerChaineDenormalisee(typeRechercheTrukCacGrpChp.getValues()));
338
			valorisationModifie.setRechercheType("AUTRE", typeRechercheAutreChp.getValue());
339
 
340
			// ACCÈS SANS MOTIF
341
			if (sansMotifAccesMarkRGrpChp.getValue() != null) {
342
				valorisationModifie.setAccesSansMotif(sansMotifAccesMarkRGrpChp.getValue().getValueAttribute());
343
			}
344
			// ACCÈS SANS MOTIF INFO
345
			valorisationModifie.setAccesSansMotifInfo(sansMotifAccesChp.getValue());
346
 
347
			// VISITE AVEC MOTIF
348
			if (avecMotifAccesMarkRGrpChp.getValue() != null) {
349
				valorisationModifie.setVisiteAvecMotif(avecMotifAccesMarkRGrpChp.getValue().getValueAttribute());
350
			}
351
			// VISITE AVEC MOTIF INFO
352
			valorisationModifie.setVisiteAvecMotifInfo(avecMotifAccesChp.getValue());
353
 
354
			return valorisationModifie;
192 jp_milcent 355
		}
356
	}
357
 
358
	private void peuplerStructureValorisation() {
206 jp_milcent 359
		if (valorisation != null) {
360
			// ACTION
211 jp_milcent 361
			actionMarkRGrpChp.get((valorisation.getAction().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 362
 
363
			// ACTION INFO
364
			peuplerCasesACocher(valorisation.getActionInfo(), actionTrukCacGrpChp, actionAutreChp);
365
 
366
			// PUBLICATION
367
			publicationChp.setValue(valorisation.getPublication());
368
 
369
			// COLLECTION AUTRE
370
			peuplerCasesACocher(valorisation.getCollectionAutre(), autreCollectionTrukCacGrpChp, autreCollectionAutreChp);
371
 
372
			// ACTION FUTURE
211 jp_milcent 373
			futureActionMarkRGrpChp.get((valorisation.getActionFuture().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 374
 
375
			// ACTION FUTURE INFO
376
			futureActionChp.setValue(valorisation.getActionFutureInfo());
377
 
378
			// RECHERCHE
211 jp_milcent 379
			rechercheMarkRGrpChp.get((valorisation.getRecherche().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 380
			// RECHERCHE PROVENANCE
381
			peuplerCasesACocher(valorisation.getRechercheProvenance(), provenanceRechercheTrukCacGrpChp, provenanceRechercheAutreChp);
382
			// RECHERCHE TYPE
383
			peuplerCasesACocher(valorisation.getRechercheType(), typeRechercheTrukCacGrpChp, typeRechercheAutreChp);
384
 
385
			// ACCÈS SANS MOTIF
211 jp_milcent 386
			sansMotifAccesMarkRGrpChp.get((valorisation.getAccesSansMotif().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 387
			// ACCÈS SANS MOTIF INFO
388
			sansMotifAccesChp.setValue(valorisation.getAccesSansMotifInfo());
389
 
390
			// VISITE AVEC MOTIF
211 jp_milcent 391
			avecMotifAccesMarkRGrpChp.get((valorisation.getVisiteAvecMotif().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 392
			// VISITE AVEC MOTIF INFO
393
			avecMotifAccesChp.setValue(valorisation.getVisiteAvecMotifInfo());
211 jp_milcent 394
 
395
			valorisationOnglet.layout();
206 jp_milcent 396
		}
192 jp_milcent 397
	}
398
 
399
	private StructureConservation collecterStructureConservation() {
206 jp_milcent 400
		if (conservationOnglet.getData("acces").equals(false)) {
401
			return conservation;
402
		} else {
403
			// Création de l'objet
404
			StructureConservation conservationModifie = new StructureConservation();
192 jp_milcent 405
 
206 jp_milcent 406
			// FORMATION
407
			if (formationMarkRGrpChp.getValue() != null) {
408
				conservationModifie.setFormation(formationMarkRGrpChp.getValue().getValueAttribute());
409
			}
410
			// FORMATION INFO
411
			conservationModifie.setFormationInfo(formationChp.getValue());
412
			// FORMATION INTERET
413
			if (interetFormationMarkRGrpChp.getValue() != null) {
414
				conservationModifie.setFormationInteret(interetFormationMarkRGrpChp.getValue().getValueAttribute());
415
			}
416
 
417
			// STOCKAGE LOCAL
418
			conservationModifie.setStockageLocal(creerChaineDenormalisee(localStockageTrukCacGrpChp.getValues()));
419
			conservationModifie.setStockageLocal("AUTRE", localStockageAutreChp.getValue());
420
 
421
			// STOCKAGE MEUBLE
422
			conservationModifie.setStockageMeuble(creerChaineDenormalisee(meubleStockageTrukCacGrpChp.getValues()));
423
			conservationModifie.setStockageMeuble("AUTRE", meubleStockageAutreChp.getValue());
424
 
425
			// STOCKAGE PAREMETRE
426
			conservationModifie.setStockageParametre(creerChaineDenormalisee(parametreStockageTrukCacGrpChp.getValues()));
427
			conservationModifie.setStockageParametre("AUTRE", parametreStockageAutreChp.getValue());
428
 
429
			// COLLECTION COMMUNE
430
			if (collectionCommuneMarkRGrpChp.getValue() != null) {
431
				conservationModifie.setCollectionCommune(collectionCommuneMarkRGrpChp.getValue().getValueAttribute());
432
			}
433
			// COLLECTION AUTRE
434
			conservationModifie.setCollectionAutre(creerChaineDenormalisee(collectionAutreTrukCacGrpChp.getValues()));
435
			conservationModifie.setCollectionAutre("AUTRE", collectionAutreAutreChp.getValue());
436
 
437
			// ACCÈS CONTROLÉ
438
			if (accesControleMarkRGrpChp.getValue() != null) {
439
				conservationModifie.setAccesControle(accesControleMarkRGrpChp.getValue().getValueAttribute());
440
			}
441
 
442
			// RESTAURATION
443
			if (restaurationMarkRGrpChp.getValue() != null) {
444
				conservationModifie.setRestauration(restaurationMarkRGrpChp.getValue().getValueAttribute());
445
			}
446
			// RESTAURATION OPÉRATION
447
			conservationModifie.setRestaurationOperation(creerChaineDenormalisee(opRestauTrukCacGrpChp.getValues()));
448
			conservationModifie.setRestaurationOperation("AUTRE", opRestauAutreChp.getValue());
449
 
450
			// MATERIEL CONSERVATION
451
			if (materielConservationCeRGrpChp.getValue() != null) {
452
				conservationModifie.setMaterielConservation(materielConservationCeRGrpChp.getValue().getValueAttribute());
453
			}
454
 
455
			// MATERIEL AUTRE
456
			conservationModifie.setMaterielAutre(creerChaineDenormalisee(autreMaterielTrukCacGrpChp.getValues()));
457
			conservationModifie.setMaterielAutre("AUTRE", autreMaterielAutreChp.getValue());
458
 
459
			// TRAITEMENT
460
			if (traitementMarkRGrpChp.getValue() != null) {
461
				conservationModifie.setTraitement(traitementMarkRGrpChp.getValue().getValueAttribute());
462
			}
463
			// TRAIEMENTS
464
			conservationModifie.setTraitements(creerChaineDenormalisee(traitementTrukCacGrpChp.getValues()));
465
			conservationModifie.setTraitements("AUTRE", traitementAutreChp.getValue());
466
 
467
 
468
			// ACQUISITION COLLECTION
469
			if (collectionAcquisitionMarkRGrpChp.getValue() != null) {
470
				conservationModifie.setAcquisitionCollection(collectionAcquisitionMarkRGrpChp.getValue().getValueAttribute());
471
			}
472
 
473
			// ACQUISITION ECHANTILLON
474
			if (echantillonAcquisitionMarkRGrpChp.getValue() != null) {
475
				conservationModifie.setAcquisitionEchantillon(echantillonAcquisitionMarkRGrpChp.getValue().getValueAttribute());
476
			}
477
			// ACQUISITION TRAITEMENT
478
			if (traitementAcquisitionMarkRGrpChp.getValue() != null) {
479
				conservationModifie.setAcquisitionTraitement(traitementAcquisitionMarkRGrpChp.getValue().getValueAttribute());
480
			}
481
			// ACQUISITION TRAITEMENT POISON
482
			conservationModifie.setAcquisitionTraitementPoison(creerChaineDenormalisee(poisonTraitementTrukCacGrpChp.getValues()));
483
			conservationModifie.setAcquisitionTraitementPoison("AUTRE", poisonTraitementAutreChp.getValue());
484
			// ACQUISITION TRAITEMENT INSECTE
485
			conservationModifie.setAcquisitionTraitementInsecte(creerChaineDenormalisee(insecteTraitementTrukCacGrpChp.getValues()));
486
			conservationModifie.setAcquisitionTraitementInsecte("AUTRE", insecteTraitementAutreChp.getValue());
487
 
488
			// Retour de l'objet
489
			//GWT.log(conservationLocal.toString(), null);
490
			return conservationModifie;
192 jp_milcent 491
		}
188 jp_milcent 492
	}
493
 
192 jp_milcent 494
	private void peuplerStructureConservation() {
206 jp_milcent 495
		if (conservation != null) {
496
			// FORMATION
497
			// Bouton oui, à toujours l'index 0 donc on teste en fonction...
211 jp_milcent 498
			formationMarkRGrpChp.get((conservation.getFormation().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 499
			// FORMATION INFO
500
			formationChp.setValue(conservation.getFormationInfo());
501
			// FORMATION INTERET
211 jp_milcent 502
			interetFormationMarkRGrpChp.get((conservation.getFormationInteret().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 503
 
504
			// STOCKAGE LOCAL
505
			peuplerCasesACocher(conservation.getStockageLocal(), localStockageTrukCacGrpChp,localStockageAutreChp);
506
 
507
			// STOCKAGE MEUBLE
508
			peuplerCasesACocher(conservation.getStockageMeuble(), meubleStockageTrukCacGrpChp, meubleStockageAutreChp);
509
 
510
			// STOCKAGE PAREMETRE
511
			peuplerCasesACocher(conservation.getStockageParametre(), parametreStockageTrukCacGrpChp, parametreStockageAutreChp);
512
 
513
			// COLLECTION COMMUNE
211 jp_milcent 514
			collectionCommuneMarkRGrpChp.get((conservation.getCollectionCommune().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 515
			// COLLECTION AUTRE
516
			peuplerCasesACocher(conservation.getCollectionAutre(), collectionAutreTrukCacGrpChp, collectionAutreAutreChp);
517
 
518
			// ACCÈS CONTROLÉ
211 jp_milcent 519
			accesControleMarkRGrpChp.get((conservation.getAccesControle().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 520
 
521
			// RESTAURATION
211 jp_milcent 522
			restaurationMarkRGrpChp.get((conservation.getRestauration().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 523
			// RESTAURATION OPÉRATION
524
			peuplerCasesACocher(conservation.getRestaurationOperation(), opRestauTrukCacGrpChp, opRestauAutreChp);
525
 
526
			// MATERIEL CONSERVATION
527
			peuplerBoutonsRadio(conservation.getMaterielConservation(), materielConservationCeRGrpChp);
528
 
529
			// MATERIEL AUTRE
530
			peuplerCasesACocher(conservation.getMaterielAutre(), autreMaterielTrukCacGrpChp, autreMaterielAutreChp);
531
 
532
			// TRAITEMENT
211 jp_milcent 533
			traitementMarkRGrpChp.get((conservation.getTraitement().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 534
			// TRAITEMENTS
535
			peuplerCasesACocher(conservation.getTraitements(), traitementTrukCacGrpChp, traitementAutreChp);
536
 
537
			// ACQUISITION COLLECTION
211 jp_milcent 538
			collectionAcquisitionMarkRGrpChp.get((conservation.getAcquisitionCollection().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 539
 
540
			// ACQUISITION ECHANTILLON
211 jp_milcent 541
			echantillonAcquisitionMarkRGrpChp.get((conservation.getAcquisitionEchantillon().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 542
 
543
			// ACQUISITION TRAITEMENT
211 jp_milcent 544
			traitementAcquisitionMarkRGrpChp.get((conservation.getAcquisitionTraitement().equals("1") ? 0 : 1)).setValue(true);
206 jp_milcent 545
 
546
			// ACQUISITION TRAITEMENT POISON
547
			peuplerCasesACocher(conservation.getAcquisitionTraitementPoison(), poisonTraitementTrukCacGrpChp, poisonTraitementAutreChp);
548
			// ACQUISITION TRAITEMENT INSECTE
549
			peuplerCasesACocher(conservation.getAcquisitionTraitementInsecte(), insecteTraitementTrukCacGrpChp, insecteTraitementAutreChp);
211 jp_milcent 550
 
551
			conservationOnglet.layout();
206 jp_milcent 552
		}
188 jp_milcent 553
	}
554
 
192 jp_milcent 555
	private Structure collecterStructureIdentification() {
211 jp_milcent 556
		if (identificationOnglet.getData("acces").equals(false)) {
557
			return identification;
558
		} else {
559
			Structure structure = new Structure();
560
			structure.setId(idStructureChp.getValue());
561
			structure.setNom(nomStructureChp.getValue());
562
			// Récupération de l'acronyme (= identifiant alternatif)
563
			structure.setIdAlternatif(null);
564
			if (comboAcronyme.getValue() != null) {
565
				String typeAcronyme = comboAcronyme.getValue().getAbr();
566
				if (typeAcronyme == "IH") {
567
					structure.setIdAlternatif(typeAcronyme+"##"+ihChp.getValue());
568
				} else if (typeAcronyme == "MNHN") {
569
					structure.setIdAlternatif(typeAcronyme+"##"+mnhnChp.getValue());
570
				}
164 jp_milcent 571
			}
211 jp_milcent 572
			// Récupération statut de la structure
573
			structure.setTypePublic(null);
574
			structure.setTypePrive(null);
575
			if (comboTypeStructure.getValue() != null) {
576
				String typeStructure = comboTypeStructure.getValue().getAbr();
577
				if (typeStructure == "stpu" && comboLstpu.getValue() != null) {
578
					structure.setTypePublic(comboLstpu.getValue().getId());
579
				} else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
580
					structure.setTypePrive(comboLstpr.getValue().getId());
581
				}
164 jp_milcent 582
			}
211 jp_milcent 583
			structure.setDateFondation(dateFondationChp.getValue());
584
 
585
			structure.setAdresse(adrChp.getValue());
586
			structure.setCodePostal(cpChp.getValue());
587
			structure.setVille(villeChp.getValue());
588
			structure.setRegion(regionChp.getValue());
589
			structure.setPays(null);
590
			if (comboPays.getValue() != null) {
591
				structure.setPays(comboPays.getValue().getAbreviation());
592
			} else if (comboPays.getRawValue() != "") {
593
				structure.setPays(comboPays.getRawValue());
594
			}
595
 
596
			structure.setTelephone(telChp.getValue());
597
			structure.setFax(faxChp.getValue());
598
			structure.setCourriel(emailChp.getValue());
599
			structure.setUrl(Structure.URL_SITE, urlChp.getValue());
600
 
601
			return structure;
164 jp_milcent 602
		}
119 jpm 603
	}
604
 
211 jp_milcent 605
	private void peuplerStructureIdentification() {
606
		if (identification != null) {
607
			idStructureChp.setValue(identification.getId());
608
			nomStructureChp.setValue(identification.getNom());
609
			if (!identification.getIdAlternatif().isEmpty()) {
610
				String[] acronyme = identification.getIdAlternatif().split("##");
611
				if (acronyme[0].matches("^IH$")) {
612
					comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeIH());
613
					ihChp.setValue(acronyme[1]);
614
				} else if (acronyme[0].matches("^MNHN$")) {
615
					comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeMNHN());
616
					mnhnChp.setValue(acronyme[1]);
617
				}
188 jp_milcent 618
			}
211 jp_milcent 619
			if (!identification.getTypePrive().isEmpty()) {
620
				if (identification.getTypePrive().matches("^[0-9]+$")) {
621
					comboTypeStructure.setValue(InterneValeurListe.getTypePrivee());
622
					comboLstpr.setValue(comboLstpr.getStore().findModel("id_valeur", identification.getTypePrive()));
623
				}
624
			} else if (!identification.getTypePublic().isEmpty()) {
625
				if (identification.getTypePublic().matches("^[0-9]+$")) {
626
					comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
627
					comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
628
				}
172 jp_milcent 629
			}
211 jp_milcent 630
			dateFondationChp.setValue(identification.getDateFondation());
631
 
632
			adrChp.setValue(identification.getAdresse());
633
			cpChp.setValue(identification.getCodePostal());
634
			villeChp.setValue(identification.getVille());
635
			regionChp.setValue(identification.getRegion());
636
			if (identification.getPays().matches("^[A-Z]{2}$")) {
637
				comboPays.setValue(comboPays.getStore().findModel("abreviation", identification.getPays()));
638
			} else {
639
				comboPays.setRawValue(identification.getPays());
172 jp_milcent 640
			}
211 jp_milcent 641
 
642
			telChp.setValue(identification.getTelephone());
643
			faxChp.setValue(identification.getFax());
644
			emailChp.setValue(identification.getCourriel());
645
			urlChp.setValue(identification.getUrl("WEB"));
646
 
647
			identificationOnglet.layout();
172 jp_milcent 648
		}
156 jp_milcent 649
	}
650
 
111 jpm 651
	private TabItem creerOngletValorisation() {
652
		valorisationOnglet = new TabItem();
653
		valorisationOnglet.setText("Valorisation");
654
		valorisationOnglet.setScrollMode(Scroll.AUTO);
655
		valorisationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP, null));
206 jp_milcent 656
		valorisationOnglet.setData("acces", false); // Permet de savoir si l'onblet a été accédé par l'utilisateur
192 jp_milcent 657
		valorisationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
658
			public void handleEvent(ComponentEvent be) {
206 jp_milcent 659
				// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
660
				valorisationOnglet.setData("acces", true);
192 jp_milcent 661
				peuplerStructureValorisation();
662
			}
663
		});
111 jpm 664
 
119 jpm 665
		actionMarkRGrpChp = creerChoixUniqueRadioGroupe("action_mark", "ouiNon");
111 jpm 666
		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 ?");
667
		valorisationOnglet.add(actionMarkRGrpChp);
668
 
119 jpm 669
 
111 jpm 670
		actionTrukCp = creerChoixMultipleCp("actionValorisation");
671
		actionTrukCp.hide();
115 jpm 672
		actionTrukCacGrpChp = new CheckBoxGroup();
673
		actionTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
111 jpm 674
		valorisationOnglet.add(actionTrukCp);
675
 
206 jp_milcent 676
		publicationChp = new TextArea();
111 jpm 677
		publicationChp.setFieldLabel("Quelques titres des ouvrages, articles scientifiques, ...");
206 jp_milcent 678
		valorisationOnglet.add(publicationChp, new FormData(550, 0));
111 jpm 679
 
680
		autreCollectionTrukCp = creerChoixMultipleCp("autreCollection");
119 jpm 681
		autreCollectionTrukCacGrpChp = new CheckBoxGroup();
682
		autreCollectionTrukCacGrpChp.setFieldLabel("L'organisme dispose-t-il d'autres collections (permettant une valorisation pluridisciplinaire) ?");
111 jpm 683
		valorisationOnglet.add(autreCollectionTrukCp);
684
 
188 jp_milcent 685
		futureActionMarkRGrpChp = creerChoixUniqueRadioGroupe("future_action_mark", "ouiNon");
111 jpm 686
		futureActionMarkRGrpChp.setFieldLabel("Envisagez vous des actions de valorisation dans le cadre de votre politique culturelle ?");
687
		valorisationOnglet.add(futureActionMarkRGrpChp);
688
 
206 jp_milcent 689
		futureActionChp = new TextArea();
111 jpm 690
		futureActionChp.setFieldLabel("Si oui, lesquelles ?");
691
		futureActionChp.hide();
206 jp_milcent 692
		valorisationOnglet.add(futureActionChp, new FormData(550, 0));
111 jpm 693
 
188 jp_milcent 694
		rechercheMarkRGrpChp = creerChoixUniqueRadioGroupe("recherche_mark", "ouiNon");
111 jpm 695
		rechercheMarkRGrpChp.setFieldLabel("Vos collections botaniques sont-elles utilisées pour des recherches scientifiques ?");
696
		valorisationOnglet.add(rechercheMarkRGrpChp);
697
 
698
		provenanceRechercheTrukCp = creerChoixMultipleCp("continentEtFr");
699
		provenanceRechercheTrukCp.hide();
115 jpm 700
		provenanceRechercheTrukCacGrpChp = new CheckBoxGroup();
701
		provenanceRechercheTrukCacGrpChp.setFieldLabel("Si oui, par des chercheurs (professionnels ou amateurs) de quelle provenance ?");
111 jpm 702
		valorisationOnglet.add(provenanceRechercheTrukCp);
703
 
119 jpm 704
		typeRechercheTrukCp = creerChoixMultipleCp("typeRecherche");
705
		typeRechercheTrukCp.hide();
115 jpm 706
		typeRechercheTrukCacGrpChp = new CheckBoxGroup();
707
		typeRechercheTrukCacGrpChp.setFieldLabel("Et pour quelles recherches ?");
119 jpm 708
		valorisationOnglet.add(typeRechercheTrukCp);
111 jpm 709
 
188 jp_milcent 710
		sansMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("sans_motif_acces_mark", "ouiNon");
111 jpm 711
		sansMotifAccesMarkRGrpChp.setFieldLabel("Peut-on consulter vos collections botaniques sans motif de recherches scientifiques ?");
712
		valorisationOnglet.add(sansMotifAccesMarkRGrpChp);
713
 
206 jp_milcent 714
		valorisationOnglet.add(sansMotifAccesChp = new TextArea(), new FormData(550, 0));
111 jpm 715
		sansMotifAccesChp.hide();
716
		sansMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les consulter ?");
717
 
188 jp_milcent 718
		avecMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("avec_motif_acces_mark", "ouiNon");
111 jpm 719
		avecMotifAccesMarkRGrpChp.setFieldLabel("Peut-on visiter vos collections botaniques avec des objectifs de recherches scientifiques ?");
720
		valorisationOnglet.add(avecMotifAccesMarkRGrpChp);
721
 
206 jp_milcent 722
		valorisationOnglet.add(avecMotifAccesChp = new TextArea(), new FormData(550, 0));
111 jpm 723
		avecMotifAccesChp.hide();
724
		avecMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les visiter ?");
725
 
726
		return valorisationOnglet;
727
	}
728
 
108 jpm 729
	private TabItem creerOngletConservation() {
730
		conservationOnglet = new TabItem();
731
		conservationOnglet.setText("Conservation");
110 jpm 732
		conservationOnglet.setScrollMode(Scroll.AUTO);
108 jpm 733
		conservationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP, null));
206 jp_milcent 734
		conservationOnglet.setData("acces", false);
192 jp_milcent 735
		conservationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
736
			public void handleEvent(ComponentEvent be) {
206 jp_milcent 737
				// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
738
				conservationOnglet.setData("acces", true);
739
				peuplerStructureConservation();
192 jp_milcent 740
			}
741
		});
108 jpm 742
 
188 jp_milcent 743
		formationMarkRGrpChp = creerChoixUniqueRadioGroupe("formation_mark", "ouiNon");
744
		formationMarkRGrpChp.setFieldLabel("Le personnel s'occupant des collections a-t-il suivi des formations en conservations ?");
745
		conservationOnglet.add(formationMarkRGrpChp);
108 jpm 746
 
111 jpm 747
		formationChp = new TextField<String>();
748
		formationChp.hide();
749
		formationChp.setFieldLabel("Si oui, lesquelles ?");
108 jpm 750
		conservationOnglet.add(formationChp);
751
 
188 jp_milcent 752
		interetFormationMarkRGrpChp = creerChoixUniqueRadioGroupe("interet_formation_mark", "ouiNon");
753
		interetFormationMarkRGrpChp.setFieldLabel("Seriez vous intéressé par une formation à la conservation et à la restauration d'herbier ?");
754
		conservationOnglet.add(interetFormationMarkRGrpChp);
108 jpm 755
 
115 jpm 756
		localStockageTrukCp = creerChoixMultipleCp("localStockage");
757
		localStockageTrukCacGrpChp = new CheckBoxGroup();
758
		localStockageTrukCacGrpChp.setFieldLabel("Avez vous des locaux spécifiques de stockage des collections botaniques ?");
759
		conservationOnglet.add(localStockageTrukCp);
108 jpm 760
 
115 jpm 761
		meubleStockageTrukCp = creerChoixMultipleCp("meubleStockage");
762
		meubleStockageTrukCacGrpChp = new CheckBoxGroup();
763
		meubleStockageTrukCacGrpChp.setFieldLabel("Avez vous des meubles spécifiques au stockage des collections botaniques ?");
764
		conservationOnglet.add(meubleStockageTrukCp);
108 jpm 765
 
115 jpm 766
		parametreStockageTrukCp = creerChoixMultipleCp("parametreStockage");
767
		parametreStockageTrukCacGrpChp = new CheckBoxGroup();
768
		parametreStockageTrukCacGrpChp.setFieldLabel("Quels paramètres maîtrisez vous ?");
769
		conservationOnglet.add(parametreStockageTrukCp);
109 jpm 770
 
188 jp_milcent 771
		collectionCommuneMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_commune_mark", "ouiNon");
111 jpm 772
		collectionCommuneMarkRGrpChp.setFieldLabel("Les collections botaniques sont-elles conservées avec d'autres collections  dans les mêmes locaux (problème de conservation en commun) ?");
773
		conservationOnglet.add(collectionCommuneMarkRGrpChp);
109 jpm 774
 
111 jpm 775
		collectionAutreTrukCp = creerChoixMultipleCp("autreCollection");
115 jpm 776
		collectionAutreTrukCacGrpChp = new CheckBoxGroup();
777
		collectionAutreTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
111 jpm 778
		collectionAutreTrukCp.hide();
779
		conservationOnglet.add(collectionAutreTrukCp);
110 jpm 780
 
188 jp_milcent 781
		accesControleMarkRGrpChp = creerChoixUniqueRadioGroupe("mark_acces_controle", "ouiNon");
115 jpm 782
		accesControleMarkRGrpChp.setFieldLabel("L'accès à vos collections botanique est-il contrôlé (ex. : manipulation réservées à des personnes compétentes) ?");
783
		conservationOnglet.add(accesControleMarkRGrpChp);
110 jpm 784
 
188 jp_milcent 785
		restaurationMarkRGrpChp = creerChoixUniqueRadioGroupe("restauration_mark", "ouiNon");
115 jpm 786
		restaurationMarkRGrpChp.setFieldLabel("Effectuez vous des opérations de restauration ou de remise en état de vos collections botaniques ?");
787
		conservationOnglet.add(restaurationMarkRGrpChp);
110 jpm 788
 
111 jpm 789
		opRestauTrukCp = creerChoixMultipleCp("opRestau");
115 jpm 790
		opRestauTrukCacGrpChp = new CheckBoxGroup();
791
		opRestauTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
111 jpm 792
		opRestauTrukCp.hide();
793
		conservationOnglet.add(opRestauTrukCp);
110 jpm 794
 
188 jp_milcent 795
		// Création d'un ContentPanel vide et du groupe de bouton radio
796
		// 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
797
		materielConservationCp = creerChoixMultipleCp("onep");
798
		conservationOnglet.add(materielConservationCp);
115 jpm 799
		materielConservationCeRGrpChp = creerChoixUniqueRadioGroupe("materiel_conservation_ce", "onep");
800
		materielConservationCeRGrpChp.setFieldLabel("Utilisez vous du matériel de conservation ?");
801
		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 802
 
115 jpm 803
		autreMaterielTrukCp = creerChoixMultipleCp("autreMateriel");
804
		autreMaterielTrukCp.hide();
805
		autreMaterielTrukCacGrpChp = new CheckBoxGroup();
806
		autreMaterielTrukCacGrpChp.setFieldLabel("Si non, qu'utilisez vous comme matériel ?");
807
		conservationOnglet.add(autreMaterielTrukCp);
110 jpm 808
 
188 jp_milcent 809
		traitementMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_mark", "ouiNon");
810
		traitementMarkRGrpChp.setFieldLabel("Réalisez vous actuellement des traitements globaux contre les insectes ?");
811
		conservationOnglet.add(traitementMarkRGrpChp);
110 jpm 812
 
111 jpm 813
		traitementTrukCp = creerChoixMultipleCp("insecteTraitement");
115 jpm 814
		traitementTrukCp.hide();
815
		traitementTrukCacGrpChp = new CheckBoxGroup();
816
		traitementTrukCacGrpChp.setFieldLabel("Si oui, lesquels ?");
111 jpm 817
		conservationOnglet.add(traitementTrukCp);
110 jpm 818
 
188 jp_milcent 819
		collectionAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_acquisition_mark", "ouiNon");
820
		collectionAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, vos collections botaniques s'accroissent-elles de nouvelles acquisitions ?");
821
		conservationOnglet.add(collectionAcquisitionMarkRGrpChp);
110 jpm 822
 
188 jp_milcent 823
		echantillonAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("echantillon_acquisition_mark", "ouiNon");
824
		echantillonAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, mettez vous en herbier de nouveaux échantillons ?");
825
		conservationOnglet.add(echantillonAcquisitionMarkRGrpChp);
110 jpm 826
 
115 jpm 827
		traitementAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_acquisition_mark", "ouiNon");
828
		traitementAcquisitionMarkRGrpChp.hide();
829
		traitementAcquisitionMarkRGrpChp.setFieldLabel("Si oui, faites-vous un traitement contre les insectes avant l'intégration dans vos collections ?");
830
		conservationOnglet.add(traitementAcquisitionMarkRGrpChp);
110 jpm 831
 
115 jpm 832
		traitementAcquisitionMarkLabel = new LabelField();
833
		traitementAcquisitionMarkLabel.hide();
834
		traitementAcquisitionMarkLabel.setFieldLabel("Si oui, lesquels ?");
835
		conservationOnglet.add(traitementAcquisitionMarkLabel);
110 jpm 836
 
115 jpm 837
		poisonTraitementTrukCp = creerChoixMultipleCp("poisonTraitement");
838
		poisonTraitementTrukCp.hide();
839
		poisonTraitementTrukCacGrpChp = new CheckBoxGroup();
840
		poisonTraitementTrukCacGrpChp.setFieldLabel("Empoisonnement");
841
		poisonTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
842
		poisonTraitementTrukCacGrpChp.setLabelSeparator("");
843
		conservationOnglet.add(poisonTraitementTrukCp);
110 jpm 844
 
111 jpm 845
		insecteTraitementTrukCp = creerChoixMultipleCp("insecteTraitement");
115 jpm 846
		insecteTraitementTrukCp.hide();
847
		insecteTraitementTrukCacGrpChp = new CheckBoxGroup();
848
		insecteTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
849
		insecteTraitementTrukCacGrpChp.setLabelSeparator("");
850
		insecteTraitementTrukCacGrpChp.setFieldLabel("Désinsectisation");
111 jpm 851
		conservationOnglet.add(insecteTraitementTrukCp);
110 jpm 852
 
108 jpm 853
		return conservationOnglet;
854
	}
855
 
211 jp_milcent 856
 
857
	private void peuplerStructurePersonnel() {
858
		if (identification != null) {
859
			// NBRE PERSONNE
860
			nbreTotalPersonneStructureChp.setValue(identification.getNbrePersonne());
861
		}
862
 
863
		if (personnel != null) {
213 jp_milcent 864
 
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 {
872
					personnel.get(index).set("fonction", personnel.get(index).getFonction());
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
 
879
			grillePersonnel.getColumnModel().getColumn(1).getEditor().fireEvent(Events.StateSave);
880
			/*
881
			int nbreLigne = personnelGrilleMagazin.getCount();
882
			for (int i = 0; i < nbreLigne; i++) {
883
 
884
			}
885
			*/
886
			personnelOnglet.layout();
887
		}
888
	}
889
 
103 jpm 890
	private TabItem creerOngletPersonnel() {
108 jpm 891
		personnelOnglet = new TabItem();
211 jp_milcent 892
 
103 jpm 893
		personnelOnglet.setText("Personnel");
110 jpm 894
		personnelOnglet.setScrollMode(Scroll.AUTO);
895
		personnelOnglet.setLayout(creerFormLayout(400, LabelAlign.LEFT, null));
211 jp_milcent 896
		personnelOnglet.setData("acces", false); // Permet de savoir si l'onblet a été accédé par l'utilisateur
897
		personnelOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
898
			public void handleEvent(ComponentEvent be) {
899
				// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
900
				personnelOnglet.setData("acces", true);
901
				peuplerStructurePersonnel();
902
			}
903
 
904
		});
103 jpm 905
 
188 jp_milcent 906
		nbreTotalPersonneStructureChp = new NumberField();
103 jpm 907
		nbreTotalPersonneStructureChp.setFieldLabel("Nombre de personne travaillant dans l'institution");
908
		nbreTotalPersonneStructureChp.setFormat(NumberFormat.getFormat("#"));
909
		nbreTotalPersonneStructureChp.setToolTip("Ce champ doit contenir un nombre");
910
		personnelOnglet.add(nbreTotalPersonneStructureChp);
911
 
912
		personnelOnglet.add(this.creerGrillePersonnel());
913
 
914
		nbreTotalPersonnelChp = new LabelField();
915
		nbreTotalPersonnelChp.setFieldLabel("Nombre de personne travaillant sur les collections");
916
		nbreTotalPersonnelChp.setLabelSeparator(":");
917
		nbreTotalPersonnelChp.setValue(""+grillePersonnel.getStore().getCount());
918
		personnelOnglet.add(nbreTotalPersonnelChp);
211 jp_milcent 919
 
103 jpm 920
		return personnelOnglet;
921
	}
922
 
102 jpm 923
	private ContentPanel creerGrillePersonnel() {
211 jp_milcent 924
		ContentPanel cp = new ContentPanel();
103 jpm 925
 
211 jp_milcent 926
		List<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
927
		personnes.add(new StructureAPersonne(Valeur.FONCTION_DIRECTEUR));
928
		personnes.add(new StructureAPersonne(Valeur.FONCTION_CONSERVATEUR));
102 jpm 929
 
211 jp_milcent 930
		personnelGrilleMagazin = new ListStore<StructureAPersonne>();
103 jpm 931
		personnelGrilleMagazin.add(personnes);
932
 
102 jpm 933
		List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
934
 
211 jp_milcent 935
		CheckBoxSelectionModel<StructureAPersonne> sm = new CheckBoxSelectionModel<StructureAPersonne>();
102 jpm 936
		configs.add(sm.getColumn());
103 jpm 937
 
213 jp_milcent 938
		ColumnConfig column = new ColumnConfig("fonction", "Fonction", 100);
119 jpm 939
		modele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("fonction"));
103 jpm 940
		magazinLiFonction = new ListStore<Valeur>();
941
		magazinLiFonction.add(new ArrayList<Valeur>());
942
 
943
		comboLiFonction = new ComboBox<Valeur>();
944
		comboLiFonction.setTriggerAction(TriggerAction.ALL);
945
		comboLiFonction.setEditable(true);
946
		comboLiFonction.setDisplayField("nom");
947
		//comboLiStatut.setEmptyText("Sélectionez une fonction...");
948
		comboLiFonction.setStore(magazinLiFonction);
211 jp_milcent 949
		/*
950
		comboLiFonction.addListener(Events.Blur, new Listener<BaseEvent>() {
951
 
952
			@Override
953
			public void handleEvent(BaseEvent be) {
954
				//grillePersonnel..comboLiFonction.getRawValue();
955
 
956
			}
957
 
958
		});*/
103 jpm 959
 
960
		CellEditor fonctionEditor = new CellEditor(comboLiFonction) {
961
			@Override
211 jp_milcent 962
			public Object preProcessValue(Object valeur) {
963
				if (valeur == null) {
213 jp_milcent 964
					GWT.log("pre null :", null);
965
					return null;
103 jpm 966
				}
211 jp_milcent 967
				GWT.log("pre : "+valeur.toString(), null);
968
				Object retour = null;
969
				if (((String) valeur).matches("^[0-9]+$")) {
213 jp_milcent 970
					Valeur valeurRecherche = comboLiFonction.getStore().findModel("id_valeur", (String) valeur);
971
					if (valeurRecherche != null) {
972
						retour = valeurRecherche;
973
						GWT.log("pre - retour valeur par chiffre : \n"+retour.toString(), null);
974
					} else {
975
						this.getField().setRawValue((String) valeur);
976
						retour = null;
977
					}
978
				} else if (valeur instanceof String) {
979
					this.getField().setRawValue((String) valeur);
980
					retour = null;
211 jp_milcent 981
				} else {
982
					retour = comboLiFonction.getStore().findModel("nom", (String) valeur);
213 jp_milcent 983
					GWT.log("pre - retour valeur par chaine : \n"+retour.toString(), null);
211 jp_milcent 984
				}
213 jp_milcent 985
 
211 jp_milcent 986
				return retour;
103 jpm 987
			}
988
 
989
			@Override
211 jp_milcent 990
			public Object postProcessValue(Object valeur) {
991
				if (valeur == null) {
992
					// Si la combobox n'a pas été utilisé, nous renvoyons la valeur brute saisie par l'utilisateur
213 jp_milcent 993
					GWT.log("post raw : \n"+this.getField().getRawValue(), null);
994
					String retour = this.getField().getRawValue();
995
					if (retour.matches("^[0-9]+$")) {
996
						GWT.log("ici", null);
997
						Valeur valeurRecherche = comboLiFonction.getStore().findModel("id_valeur", (String) retour);
998
						if (valeurRecherche != null) {
999
							retour = valeurRecherche.getNom();
1000
						}
1001
					}
1002
					return retour;
211 jp_milcent 1003
				} else {
1004
					GWT.log("post : \n"+valeur.toString(), null);
213 jp_milcent 1005
					String nom = "";
1006
					if (valeur instanceof Valeur) {
1007
						nom = (((Valeur) valeur).getNom());
211 jp_milcent 1008
						GWT.log("la "+nom, null);
1009
					}
213 jp_milcent 1010
					return nom;
103 jpm 1011
				}
211 jp_milcent 1012
			}
103 jpm 1013
		};
1014
		column.setEditor(fonctionEditor);
102 jpm 1015
		configs.add(column);
1016
 
1017
		column = new ColumnConfig();
1018
		column.setId("prenom");
103 jpm 1019
		column.setHeader("Prénom");
1020
		column.setWidth(100);
1021
		TextField<String> prenomChp = new TextField<String>();
1022
		prenomChp.setAllowBlank(false);
1023
		prenomChp.getMessages().setBlankText("Ce champ est obligatoire.");
1024
		prenomChp.setAutoValidate(true);
1025
		column.setEditor(new CellEditor(prenomChp));
102 jpm 1026
		configs.add(column);
1027
 
1028
		column = new ColumnConfig();
1029
		column.setId("nom");
1030
		column.setHeader("Nom");
103 jpm 1031
		column.setWidth(100);
1032
		TextField<String> nomChp = new TextField<String>();
1033
		nomChp.setAllowBlank(false);
1034
		nomChp.getMessages().setBlankText("Ce champ est obligatoire.");
1035
		nomChp.setAutoValidate(true);
1036
		column.setEditor(new CellEditor(nomChp));
102 jpm 1037
		configs.add(column);
1038
 
211 jp_milcent 1039
		column = new ColumnConfig("telephone", "Téléphone fixe", 100);
103 jpm 1040
		TextField<String> telChp = new TextField<String>();
1041
		column.setEditor(new CellEditor(telChp));
102 jpm 1042
		configs.add(column);
1043
 
1044
		column = new ColumnConfig("fax", "Fax", 100);
103 jpm 1045
		TextField<String> faxChp = new TextField<String>();
1046
		column.setEditor(new CellEditor(faxChp));
102 jpm 1047
		configs.add(column);
1048
 
103 jpm 1049
		column = new ColumnConfig("courriel", "Courriel", 100);
1050
		TextField<String> emailChp = new TextField<String>();
1051
		column.setEditor(new CellEditor(emailChp));
102 jpm 1052
		configs.add(column);
1053
 
119 jpm 1054
		modele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("statut"));
103 jpm 1055
		magazinLiStatut = new ListStore<Valeur>();
1056
		magazinLiStatut.add(new ArrayList<Valeur>());
1057
 
1058
		comboLiStatut = new ComboBox<Valeur>();
1059
		comboLiStatut.setTriggerAction(TriggerAction.ALL);
1060
		comboLiStatut.setEditable(false);
1061
		comboLiStatut.setDisplayField("nom");
1062
		comboLiStatut.setEmptyText("Sélectionez un statut...");
1063
		comboLiStatut.setStore(magazinLiStatut);
1064
 
1065
		CellEditor statutEditor = new CellEditor(comboLiStatut) {
1066
			@Override
1067
			public Object preProcessValue(Object value) {
1068
				if (value == null) {
1069
					return value;
1070
				}
1071
				//GWT.log("pre : "+value.toString(), null);
1072
				return comboLiStatut.getStore().findModel("nom", (String) value);
1073
			}
1074
 
1075
			@Override
1076
			public Object postProcessValue(Object value) {
1077
				if (value == null) {
1078
					return value;
1079
				}
1080
				//GWT.log("post : "+value.toString(), null);
1081
				return ((Valeur) value).get("nom");
1082
			}
1083
		};
1084
		column = new ColumnConfig("statut", "Statut", 100);
1085
		column.setEditor(statutEditor);
102 jpm 1086
		configs.add(column);
1087
 
211 jp_milcent 1088
		column = new ColumnConfig("travail", "Temps travail", 100);
103 jpm 1089
		column.setNumberFormat(NumberFormat.getFormat("##"));
1090
		NumberField tpsWChp = new NumberField();
1091
		tpsWChp.setFormat(NumberFormat.getFormat("##"));
1092
		tpsWChp.setToolTip("Ce champ doit contenir un nombre");
1093
		column.setEditor(new CellEditor(tpsWChp));
1094
		configs.add(column);
1095
 
211 jp_milcent 1096
		column = new ColumnConfig("specialite", "Spécialité principale", 150);
103 jpm 1097
		TextField<String> speChp = new TextField<String>();
1098
		column.setEditor(new CellEditor(speChp));
1099
		configs.add(column);
1100
 
211 jp_milcent 1101
		CheckColumnConfig checkColumn = new CheckColumnConfig("contact", "Contact ?", 60);
102 jpm 1102
		configs.add(checkColumn);
1103
 
211 jp_milcent 1104
 
102 jpm 1105
		cp.setHeading("Personnes travaillant sur les collections");
110 jpm 1106
		cp.setIconStyle("icone-table");
1107
		cp.setScrollMode(Scroll.AUTO);
103 jpm 1108
		cp.setLayout(new FitLayout());
110 jpm 1109
		cp.setSize(1100, 200);
102 jpm 1110
		cp.setFrame(true);
1111
 
1112
		ToolBar toolBar = new ToolBar();
103 jpm 1113
 
1114
		TextToolItem ajouterPersonnelBtn = new TextToolItem("Ajouter", "icone-vcard-ajouter");
1115
		ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
1116
			@Override
1117
			public void componentSelected(ToolBarEvent ce) {
211 jp_milcent 1118
				StructureAPersonne personne = new StructureAPersonne();
103 jpm 1119
				grillePersonnel.stopEditing();
1120
				personnelGrilleMagazin.insert(personne, 0);
1121
				grillePersonnel.startEditing(0, 0);
1122
				// Mise à jour du nombre de personnel travaillant sur les collections
1123
				nbreTotalPersonnelChp.setValue(""+grillePersonnel.getStore().getCount());
1124
				// Activation du bouton supprimer si la grille contient un élément
1125
				if (grillePersonnel.getStore().getCount() > 0) {
1126
					ce.component.enable();
1127
				}
1128
			}
1129
		});
1130
		toolBar.add(ajouterPersonnelBtn);
1131
		toolBar.add(new SeparatorToolItem());
1132
		TextToolItem supprimerPersonnelBtn = new TextToolItem("Supprimer", "icone-vcard-supprimer");
1133
		supprimerPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
1134
			@Override
1135
			public void componentSelected(ToolBarEvent ce) {
1136
				grillePersonnel.getStore().remove(grillePersonnel.getStore().getAt(0));
1137
				// Mise à jour du nombre de personnel travaillant sur les collections
1138
				nbreTotalPersonnelChp.setValue(""+grillePersonnel.getStore().getCount());
1139
				// Désactivation du bouton supprimer si la grille contient plus d'élément
1140
				if (grillePersonnel.getStore().getCount() == 0) {
1141
					ce.item.disable();
1142
				}
1143
			}
1144
		});
1145
		toolBar.add(supprimerPersonnelBtn);
102 jpm 1146
		cp.setTopComponent(toolBar);
1147
 
1148
		ColumnModel cm = new ColumnModel(configs);
1149
 
211 jp_milcent 1150
		grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
103 jpm 1151
		grillePersonnel.setBorders(true);
1152
		grillePersonnel.setSelectionModel(sm);
1153
		grillePersonnel.addPlugin(sm);
1154
		grillePersonnel.addPlugin(checkColumn);
211 jp_milcent 1155
  		grillePersonnel.setAutoExpandColumn("specialite");
1156
  		grillePersonnel.setStripeRows(true);
1157
  		grillePersonnel.setTrackMouseOver(true);
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
}