Subversion Repositories eFlore/Applications.coel

Rev

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

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