Subversion Repositories eFlore/Applications.coel

Rev

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

Rev Author Line No. Line
127 gduche 1
package org.tela_botanica.client.vues;
2
 
283 gduche 3
import java.util.ArrayList;
352 gduche 4
import java.util.Collection;
376 gduche 5
import java.util.Date;
276 gduche 6
import java.util.HashMap;
283 gduche 7
import java.util.Iterator;
352 gduche 8
import java.util.LinkedList;
283 gduche 9
import java.util.List;
276 gduche 10
 
11
import org.tela_botanica.client.ComposantClass;
12
import org.tela_botanica.client.Mediateur;
13
import org.tela_botanica.client.RegistreId;
127 gduche 14
import org.tela_botanica.client.interfaces.Rafraichissable;
283 gduche 15
import org.tela_botanica.client.modeles.Configuration;
280 gduche 16
import org.tela_botanica.client.modeles.InterneValeur;
293 gduche 17
 
352 gduche 18
import org.tela_botanica.client.modeles.Information;
286 gduche 19
import org.tela_botanica.client.modeles.Personne;
352 gduche 20
import org.tela_botanica.client.modeles.PersonneListe;
280 gduche 21
import org.tela_botanica.client.modeles.Valeur;
283 gduche 22
import org.tela_botanica.client.modeles.ValeurListe;
127 gduche 23
 
446 gduche 24
import com.extjs.gxt.ui.client.Events;
276 gduche 25
import com.extjs.gxt.ui.client.Registry;
26
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
283 gduche 27
import com.extjs.gxt.ui.client.Style.Scroll;
386 gduche 28
 
376 gduche 29
import com.extjs.gxt.ui.client.binding.FormBinding;
386 gduche 30
 
276 gduche 31
import com.extjs.gxt.ui.client.event.ComponentEvent;
32
import com.extjs.gxt.ui.client.event.KeyListener;
446 gduche 33
import com.extjs.gxt.ui.client.event.Listener;
280 gduche 34
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
35
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
276 gduche 36
import com.extjs.gxt.ui.client.event.SelectionListener;
280 gduche 37
import com.extjs.gxt.ui.client.store.ListStore;
127 gduche 38
import com.extjs.gxt.ui.client.widget.LayoutContainer;
319 gduche 39
import com.extjs.gxt.ui.client.widget.MessageBox;
338 gduche 40
 
386 gduche 41
import com.extjs.gxt.ui.client.widget.Info;
276 gduche 42
import com.extjs.gxt.ui.client.widget.TabItem;
43
import com.extjs.gxt.ui.client.widget.TabPanel;
293 gduche 44
import com.extjs.gxt.ui.client.widget.Text;
283 gduche 45
 
356 gduche 46
import com.extjs.gxt.ui.client.widget.button.Button;
47
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
319 gduche 48
import com.extjs.gxt.ui.client.widget.button.IconButton;
280 gduche 49
import com.extjs.gxt.ui.client.widget.form.ComboBox;
50
import com.extjs.gxt.ui.client.widget.form.DateField;
276 gduche 51
import com.extjs.gxt.ui.client.widget.form.FieldSet;
352 gduche 52
import com.extjs.gxt.ui.client.widget.form.FormPanel;
293 gduche 53
import com.extjs.gxt.ui.client.widget.form.HiddenField;
276 gduche 54
import com.extjs.gxt.ui.client.widget.form.LabelField;
446 gduche 55
import com.extjs.gxt.ui.client.widget.form.Radio;
56
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
286 gduche 57
import com.extjs.gxt.ui.client.widget.form.TextArea;
276 gduche 58
import com.extjs.gxt.ui.client.widget.form.TextField;
59
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
60
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
61
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
319 gduche 62
import com.extjs.gxt.ui.client.widget.layout.FormData;
276 gduche 63
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
356 gduche 64
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
276 gduche 65
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
66
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
386 gduche 67
import com.google.gwt.core.client.GWT;
339 gduche 68
import com.google.gwt.i18n.client.DateTimeFormat;
446 gduche 69
import com.google.gwt.user.client.Window;
70
import com.google.gwt.user.client.ui.RadioButton;
276 gduche 71
import com.google.gwt.user.client.ui.Widget;
127 gduche 72
 
446 gduche 73
public class PersonneForm extends FormPanel implements Rafraichissable {
127 gduche 74
 
276 gduche 75
	/*--------------------------------------------------------------------------------------
76
	 * 		VARIABLES
77
	 * -------------------------------------------------------------------------------------
78
	 */
79
 
80
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
283 gduche 81
	private Mediateur mediateur = Registry.get(RegistreId.MEDIATEUR);
82
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
376 gduche 83
	private Personne personneSelectionnee, personneSauvegarde = null;
276 gduche 84
 
376 gduche 85
	private FormBinding binding = null;
86
 
276 gduche 87
	/*--------------------------------------------------------------------------------------
88
	 * 		CONSTRUCTEUR
89
	 * -------------------------------------------------------------------------------------
90
	 */
446 gduche 91
 
276 gduche 92
	/**
93
	 * Constructeur du panneau
94
	 *
95
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le
96
	 * formulaire et annuler la saisie).
97
	 *
98
	 * */
437 gduche 99
	public PersonneForm() {
386 gduche 100
		initialiserComposants();
352 gduche 101
	}
102
 
386 gduche 103
	public void initialiserComposants()	{
352 gduche 104
 
376 gduche 105
		personneSelectionnee = new Personne();
106
		personneSauvegarde = new Personne();
107
 
283 gduche 108
		initialiserPanneau();
276 gduche 109
 
356 gduche 110
		ButtonBar barreOutilsBas = new ButtonBar();
111
		barreOutilsBas.setButtonAlign(HorizontalAlignment.CENTER);
276 gduche 112
 
352 gduche 113
		ajouterBoutonEnregistrer(barreOutilsBas);
114
		ajouterBoutonEnregistrerEtRevenir(barreOutilsBas);
115
		ajouterBoutonAnnuler(barreOutilsBas);
276 gduche 116
 
352 gduche 117
		setBottomComponent(barreOutilsBas);
276 gduche 118
 
352 gduche 119
		ToolBar barreOutilsHaut = new ToolBar();
120
		ajouterBoutonReinitialiser(barreOutilsHaut);
121
		setTopComponent(barreOutilsHaut);
338 gduche 122
 
276 gduche 123
		initialiserOnglets();
124
 
125
		creerComposantsIdentite();
293 gduche 126
		creerComposantsAdresse();
280 gduche 127
 
352 gduche 128
		layout();
338 gduche 129
 
376 gduche 130
		binderPersonne(personneSelectionnee);
276 gduche 131
	}
132
 
133
	/*---------------------------------------------------------------------------------------
134
	 * 		SOUS-METHODES
135
	 * --------------------------------------------------------------------------------------
136
	 */
137
	/**
138
	 * Inialise le panneau donné
139
	 *
140
	 * @param contentPanel le panneau à initialiser
141
	 * */
283 gduche 142
	public void initialiserPanneau()	{
276 gduche 143
 
283 gduche 144
		setIconStyle("icone-form-ajouter");
145
		setCollapsible(false);
146
		setHeading("Ajouter une personne");
147
		setButtonAlign(HorizontalAlignment.CENTER);
386 gduche 148
		setLayout(new FitLayout());
376 gduche 149
		setBodyBorder(false);
150
		setBorders(false);
151
		setPadding(0);
152
		setWidth("100%");
446 gduche 153
 
276 gduche 154
	}
155
 
156
	/**
157
	 * Crée les onglets identité, adresse et informations naturaliste
158
	 *
159
	 * */
160
	public void initialiserOnglets()	{
161
		//TabPanel
162
		TabPanel formulaireOnglets = new TabPanel();
163
 
164
		//Tab 1 : identite
165
		tiIdentite = new TabItem("Identité");
166
		tiIdentite.setLayout(new FormLayout());
283 gduche 167
		tiIdentite.setScrollMode(Scroll.AUTO);
446 gduche 168
 
276 gduche 169
		formulaireOnglets.add(tiIdentite);
293 gduche 170
		hmIdentite.put("tiIdentite", tiIdentite);
276 gduche 171
 
172
		//Tab 2 : Adresse
173
		tiAdresses = new TabItem("Adresse");
304 gduche 174
		tiAdresses.setLayout(new FormLayout());
283 gduche 175
		tiAdresses.setScrollMode(Scroll.AUTO);
446 gduche 176
 
276 gduche 177
		formulaireOnglets.add(tiAdresses);
178
 
179
		//Tab 3 : Infos Naturalistes
180
		tiInfosNat = new TabItem("Informations Naturalistes");
181
		tiInfosNat.setLayout(new FormLayout());
283 gduche 182
		tiInfosNat.setScrollMode(Scroll.AUTO);
446 gduche 183
 
276 gduche 184
		formulaireOnglets.add(tiInfosNat);
185
		add(formulaireOnglets);
186
	}
187
 
188
	/**
189
	 * Crée les widgets pour l'onglet identité
190
	 *
191
	 * */
192
 
293 gduche 193
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
276 gduche 194
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
293 gduche 195
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
196
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
319 gduche 197
	private FormData fd100 = new FormData("1");
276 gduche 198
 
199
	public void creerComposantsIdentite()	{
200
 
376 gduche 201
			// Gestion de l'affichage en colonnes : 3 Layout container : principal, gauche & droite
276 gduche 202
			LayoutContainer left = new LayoutContainer();
203
			left.setLayout(new FormLayout());
204
 
205
			LayoutContainer right = new LayoutContainer();
206
			right.setLayout(new FormLayout());
207
 
208
			LayoutContainer main = new LayoutContainer();
209
			main.setLayout(new ColumnLayout());
210
 
293 gduche 211
			main.add(left, new ColumnData(.49));
212
			main.add(right, new ColumnData(.49));
276 gduche 213
 
214
			// Création des champs
215
			FormLayout formLayout = new FormLayout();
216
			formLayout.setLabelAlign(LabelAlign.LEFT);
217
 
376 gduche 218
				FieldSet fsNoms = new FieldSet();
219
				fsNoms.setHeading("Noms");
220
				fsNoms.setLayout(formLayout);
276 gduche 221
 
376 gduche 222
					// Nom complet : Affiché que si valeurs saisies
223
					LabelField nomComplet = new LabelField();
224
					nomComplet.setFieldLabel("Nom complet:");
225
					nomComplet.hide();
226
 
227
					fsNoms.add(nomComplet);
228
					hmIdentite.put("nomComplet", nomComplet);
276 gduche 229
 
376 gduche 230
					//Préfixe
231
					ListStore<Valeur> storePrefixe = new ListStore<Valeur>();
232
					ComboBox<Valeur> cbPrefixe = new ComboBox<Valeur>();
233
					cbPrefixe.setStore(storePrefixe);
234
					cbPrefixe.setDisplayField("nom");
235
					cbPrefixe.setEmptyText("Choisissez le préfixe:");
236
					cbPrefixe.setFieldLabel("Prefix");
237
 
238
					fsNoms.add(cbPrefixe);
239
					hmIdentite.put("cbPrefixe", cbPrefixe);
240
 
241
					mediateur.obtenirListeValeurEtRafraichir(this, "prefixe");
352 gduche 242
 
376 gduche 243
					//Prénom
244
					TextField<String> tfPrenom = new TextField<String>();
245
					tfPrenom.setFieldLabel("Prénom");
246
					tfPrenom.setName("prenom");
352 gduche 247
 
376 gduche 248
					fsNoms.add(tfPrenom);
249
					hmIdentite.put("tfPrenom", tfPrenom);
352 gduche 250
 
376 gduche 251
					//Nom
252
					TextField<String> tfNom = new TextField<String>();
253
					tfNom.setFieldLabel("Nom");
254
					tfNom.setName("nom");
255
 
256
					fsNoms.add(tfNom);
257
					hmIdentite.put("tfNom", tfNom);
258
 
259
					//Suffixe
260
					ListStore<Valeur> storeSuffixe = new ListStore<Valeur>();
261
					ComboBox<Valeur> cbSuffixe = new ComboBox<Valeur>();
262
					cbSuffixe.setStore(storeSuffixe);
263
					cbSuffixe.setFieldLabel("Suffixe");
264
					cbSuffixe.setDisplayField("nom");
265
					cbSuffixe.setEmptyText("Choisissez un suffixe:");
266
 
267
					fsNoms.add(cbSuffixe);
268
					hmIdentite.put("cbSuffixe", cbSuffixe);
269
 
270
					mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
352 gduche 271
 
376 gduche 272
					TextField<String> tfNomAutre = new TextField();
273
					tfNomAutre.setFieldLabel("Autres noms");
386 gduche 274
					tfNomAutre.setName("truk_nom_autre");
376 gduche 275
 
276
					fsNoms.add(tfNomAutre);
277
					hmIdentite.put("tfNomAutre", tfNomAutre);
278
 
279
					TextField<String> tfAbreviation = new TextField<String>();
280
					tfAbreviation.setFieldLabel("Abréviation");
281
					tfAbreviation.setName("abreviation");
282
 
283
					fsNoms.add(tfAbreviation);
284
					hmIdentite.put("tfAbreviation", tfAbreviation);
446 gduche 285
 
376 gduche 286
					//Abréviation autres
287
					TextField<String> tfAbreviationAutre = new TextField<String>();
288
					tfAbreviationAutre.setFieldLabel("Autres Abrév.");
289
					tfAbreviationAutre.setName("truk_abreviation_autre");
290
 
291
					fsNoms.add(tfAbreviationAutre);
292
					hmIdentite.put("tfAbreviationAutre", tfAbreviationAutre);
293
 
294
				left.add(fsNoms);
276 gduche 295
 
376 gduche 296
				formLayout = new FormLayout();
297
				formLayout.setLabelAlign(LabelAlign.LEFT);
276 gduche 298
 
376 gduche 299
				FieldSet fsNaissance = new FieldSet();
300
				fsNaissance.setHeading("Naissance");
301
				fsNaissance.setLayout(formLayout);
352 gduche 302
 
376 gduche 303
					DateField dfDateNaissance = new DateField();
304
					dfDateNaissance.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
305
					dfDateNaissance.setFieldLabel("Date");
306
					dfDateNaissance.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
307
 
308
					fsNaissance.add(dfDateNaissance);
309
					hmIdentite.put("dfDateNaissance", dfDateNaissance);
310
 
311
					// Lieu naissance
312
					TextField<String> tfLieuNaissance = new TextField();
313
					tfLieuNaissance.setFieldLabel("Lieu");
314
					tfLieuNaissance.setName("naissance_lieu");
315
 
316
					fsNaissance.add(tfLieuNaissance);
317
					hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
318
 
319
				left.add(fsNaissance);
276 gduche 320
 
376 gduche 321
				formLayout = new FormLayout();
322
				formLayout.setLabelAlign(LabelAlign.LEFT);
276 gduche 323
 
376 gduche 324
				FieldSet fsDeces = new FieldSet();
325
				fsDeces.setHeading("Décès");
326
				fsDeces.setLayout(formLayout);
446 gduche 327
 
328
					Radio rbEstDecedee = new Radio();
329
					rbEstDecedee.setBoxLabel("oui");
330
 
331
					rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() {
332
 
333
						public void handleEvent(ComponentEvent be) {
334
							if(((Radio) be.component).getValue().equals(true))	{
335
								((DateField) hmIdentite.get("dfDateDeces")).setVisible(true);
336
								((TextField) hmIdentite.get("tfLieuDeces")).setVisible(true);
337
							} else	{
338
								((DateField) hmIdentite.get("dfDateDeces")).setVisible(false);
339
								((TextField) hmIdentite.get("tfLieuDeces")).setVisible(false);
340
							}
341
							//afficherChampSupplementaire(((Radio) be.component));
342
						}
343
 
344
					});
345
 
346
 
347
 
348
					Radio rbNestPasDecedee = new Radio();
349
					rbNestPasDecedee.setBoxLabel("non");
350
					rbNestPasDecedee.setValue(true);
351
 
352
					RadioGroup rbgDeces = new RadioGroup();
353
					rbgDeces.setFieldLabel("Est décédée");
354
					rbgDeces.add(rbEstDecedee);
355
					rbgDeces.add(rbNestPasDecedee);
356
 
357
					fsDeces.add(rbgDeces);
358
 
376 gduche 359
					DateField dfDateDeces = new DateField();
360
					dfDateDeces.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
361
					dfDateDeces.setFormatValue(true);
362
					dfDateDeces.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
363
					dfDateDeces.setFieldLabel("Date");
446 gduche 364
					dfDateDeces.setVisible(false);
276 gduche 365
 
376 gduche 366
					fsDeces.add(dfDateDeces);
367
					hmIdentite.put("dfDateDeces", dfDateDeces);
446 gduche 368
 
376 gduche 369
					TextField<String> tfLieuDeces = new TextField();
370
					tfLieuDeces.setFieldLabel("Lieu");
371
					tfLieuDeces.setName("deces_lieu");
446 gduche 372
					tfLieuDeces.setVisible(false);
376 gduche 373
 
374
					fsDeces.add(tfLieuDeces);
375
					hmIdentite.put("tfLieuDeces", tfLieuDeces);
376
 
377
				left.add(fsDeces);
276 gduche 378
 
376 gduche 379
			tiIdentite.add(main);
283 gduche 380
 
376 gduche 381
				FieldSet fsContactTel = new FieldSet();
382
				fsContactTel.setHeading("Contact - Téléphones");
383
				fsContactTel.setLayout(new RowLayout());
384
 
385
				right.add(fsContactTel);
386
				hmIdentite.put("fsContactTel", fsContactTel);
387
 
388
					LayoutContainer lcTelephone = new LayoutContainer();
389
					lcTelephone.setLayout(new ColumnLayout());
390
 
391
						TextField tfTelephone = new TextField();
392
						tfTelephone.setFieldLabel("tel");
393
						lcTelephone.add(tfTelephone, new ColumnData(0.40));
394
 
395
						hmIdentite.put("tfTelephone", tfTelephone);
396
 
397
						ListStore<Valeur> storeTel = new ListStore<Valeur>();
398
						ComboBox<Valeur> cbTelephone = new ComboBox<Valeur>();
399
						cbTelephone.setDisplayField("nom");
400
						cbTelephone.setEmptyText("Choisissez:");
401
						cbTelephone.setStore(storeTel);
402
 
403
						lcTelephone.add(cbTelephone, new ColumnData(0.40));
404
						hmIdentite.put("cbTelephone", cbTelephone);
283 gduche 405
 
376 gduche 406
						mediateur.obtenirListeValeurEtRafraichir(this, "tel");
276 gduche 407
 
376 gduche 408
						IconButton bAjouter = new IconButton(ComposantClass.ICONE_AJOUTER);
409
						bAjouter.addSelectionListener(
410
								new SelectionListener<ComponentEvent>() {
411
									public void componentSelected(ComponentEvent ce) {
446 gduche 412
 
376 gduche 413
										String strTelephone = ((TextField<String>) hmIdentite.get("tfTelephone")).getValue();
414
										if ((strTelephone==null)||(strTelephone.trim().equals("")))	{
415
											MessageBox.alert("Erreur de saisie", "Vous devez saisir un numéro de téléphone", null);
416
										} else if (hmIdentite.get("tel-" + strTelephone) != null){
417
											MessageBox.alert("Erreur de saisie", "Le numéro saisi est déjà présent dans la liste", null);
418
										} else {
419
												String strValeurTypeTel = "";
420
												String idTel = "";
421
												Valeur valeurTypeTel = ((ComboBox<Valeur>) hmIdentite.get("cbTelephone")).getValue();
422
 
423
												if (valeurTypeTel != null)	{
424
													strValeurTypeTel = valeurTypeTel.getNom();
425
													idTel = valeurTypeTel.get("abreviation");
426
												}	else {
427
													strValeurTypeTel = ((ComboBox<Valeur>) hmIdentite.get("cbTelephone")).getRawValue();
428
													idTel = strValeurTypeTel;
429
												}
446 gduche 430
 
376 gduche 431
												if (strValeurTypeTel.trim().equals(""))	{
432
													MessageBox.alert("Erreur de saisie", "Vous devez saisir un type de téléphone", null);
433
												}	else {
434
													ajouterTelephone(strTelephone, strValeurTypeTel, idTel);
435
												}
436
											}
437
										}
438
									}
439
								);
276 gduche 440
 
376 gduche 441
						lcTelephone.add(bAjouter, new ColumnData(0.15));
442
 
443
						HiddenField<String> hfTelephone = new HiddenField<String>();
444
						add(hfTelephone);
445
						hmIdentite.put("hfTelephone", hfTelephone);
446
 
447
					fsContactTel.add(lcTelephone);
276 gduche 448
 
376 gduche 449
					FieldSet fsContact = new FieldSet();
450
					fsContact.setHeading("Contact - Autres");
451
					fsContact.setId("fsContact");
452
					fsContact.setLayout(new RowLayout());
276 gduche 453
 
376 gduche 454
					right.add(fsContact);
455
					hmIdentite.put("fsContact", fsContact);
276 gduche 456
 
376 gduche 457
					LabelField lfCourriel = new LabelField();
458
					lfCourriel.setText("<b>Courriels:</b>");
276 gduche 459
 
376 gduche 460
					fsContact.add(lfCourriel);
276 gduche 461
 
376 gduche 462
					LayoutContainer lcCourriel = new LayoutContainer();
463
					lcCourriel.setLayout(new ColumnLayout());
276 gduche 464
 
376 gduche 465
						TextField tfCourriel = new TextField();
466
						lcCourriel.add(tfCourriel, new ColumnData(0.80));
467
 
468
						HiddenField hfHiddenCourriel = new HiddenField();
469
						hfHiddenCourriel.setId("tfHiddenCourriel");
470
						hfHiddenCourriel.setValue("");
446 gduche 471
 
376 gduche 472
						add(hfHiddenCourriel);
473
						hmIdentite.put("hfHiddenCourriel", hfHiddenCourriel);
474
						hmIdentite.put("tfCourriel", tfCourriel);
276 gduche 475
 
376 gduche 476
						IconButton bAjouterCourriel = new IconButton(ComposantClass.ICONE_AJOUTER);
477
						bAjouterCourriel.addSelectionListener(
478
								new SelectionListener<ComponentEvent>() {
479
 
480
									public void componentSelected(ComponentEvent ce) {
481
 
482
										String strEmail = ((TextField<String>) hmIdentite.get("tfCourriel")).getValue();
483
										if ((strEmail==null)||(strEmail.trim().equals("")))	{
484
											MessageBox.alert("Erreur de saisie", "Vous devez saisir une adresse", null);
485
										} else if (hmIdentite.get("email-" + strEmail) != null){
486
											MessageBox.alert("Erreur de saisie", "L'adresse saisie est déjà dans la liste", null);
487
										} else {
488
 
489
											if (!strEmail.matches("(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*"))	{
490
												MessageBox.alert("Erreur de saisie", "L'adresse n'est pas au bon format (ex: me@domain.com)", null);
491
											} else if (strEmail.length()>255){
492
												MessageBox.alert("Erreur de saisie", "L'adresse ne peut dépasser 255 caractères", null);
493
											} else {
494
												ajouterCourriel(strEmail);
495
											}
496
 
497
										}
498
 
499
 
500
									}
501
								});
276 gduche 502
 
376 gduche 503
						lcCourriel.add(bAjouterCourriel, new ColumnData(0.15));
504
 
505
					fsContact.add(lcCourriel);
276 gduche 506
 
376 gduche 507
					LayoutContainer lcCourrielContainer = new LayoutContainer(new RowLayout());
508
 
509
					fsContact.add(lcCourrielContainer);
510
					hmIdentite.put("lcCourrielContainer", lcCourrielContainer);
280 gduche 511
 
376 gduche 512
 
513
					LabelField lfUrl = new LabelField();
514
					lfUrl.setText("<b>Sites Web:</b>");
515
 
516
					fsContact.add(lfUrl);
280 gduche 517
 
376 gduche 518
					LayoutContainer lcUrl = new LayoutContainer(new ColumnLayout());
519
					hmIdentite.put("lcUrl", lcUrl);
286 gduche 520
 
386 gduche 521
					HiddenField<String> hfUrl = new HiddenField<String>();
522
					hmIdentite.put("hfUrl", hfUrl);
523
					add(hfUrl);
524
 
376 gduche 525
						TextField tfUrl = new TextField();
526
						tfUrl.setValue("http://");
286 gduche 527
 
376 gduche 528
						lcUrl.add(tfUrl, new ColumnData(0.8));
529
						hmIdentite.put("tfUrl", tfUrl);
286 gduche 530
 
376 gduche 531
						IconButton ibAjouterUrl = new IconButton(ComposantClass.ICONE_AJOUTER);
532
						ibAjouterUrl.addSelectionListener(new SelectionListener<ComponentEvent>() {
533
 
534
							public void componentSelected(ComponentEvent ce) {
293 gduche 535
 
376 gduche 536
								TextField<String> tfUrl = (TextField) hmIdentite.get("tfUrl");
537
								String strUrl = tfUrl.getValue();
293 gduche 538
 
376 gduche 539
								if ((strUrl == null)||(strUrl.trim().equals("http://"))||(strUrl.trim().equals("")))	{
540
									MessageBox.alert("Erreur de saisie", "Vous devez saisir un URL", null);
541
								} else if(hmIdentite.get("url-" + strUrl) != null)	{
542
									MessageBox.alert("Erreur de saisie", "L'url est déjà présente dans la liste.", null);
543
								}	else	{
544
									tfUrl.setValue("");
439 gduche 545
										//if (!strUrl.matches("[a-z]{3,}://[a-z0-9-]+.[.a-z0-9-]+(?::[0-9]*)?"))	{
546
										if (!strUrl.startsWith("http://"))	{
376 gduche 547
											MessageBox.alert("Erreur de saisie", "L'adresse n'est pas au bon format (ex: http://www.domain.com)", null);
548
										} else if (strUrl.length()>255){
549
											MessageBox.alert("Erreur de saisie", "L'adresse ne peut dépasser 255 caractères", null);
550
										} else {
551
											ajouterUrl(strUrl);
552
										}
553
 
293 gduche 554
								}
555
 
556
							}
376 gduche 557
						});
286 gduche 558
 
376 gduche 559
						lcUrl.add(ibAjouterUrl, new ColumnData(0.15));
560
					fsContact.add(lcUrl);
286 gduche 561
 
376 gduche 562
					LayoutContainer lcUrlContainer = new LayoutContainer(new RowLayout());
563
 
564
					fsContact.add(lcUrlContainer);
565
					hmIdentite.put("lcUrlContainer", lcUrlContainer);
566
 
567
					FieldSet fsAutresInfos = new FieldSet();
568
					fsAutresInfos.setHeading("Autres informations");
286 gduche 569
 
376 gduche 570
					formLayout = new FormLayout();
571
					formLayout.setLabelAlign(LabelAlign.LEFT);
572
					fsAutresInfos.setLayout(formLayout);
286 gduche 573
 
376 gduche 574
 
386 gduche 575
			formLayout = new FormLayout();
576
			formLayout.setLabelAlign(LabelAlign.TOP);
577
			LayoutContainer lcAutreInformations1 = new LayoutContainer(formLayout);
578
 
579
			//Civilité
580
			ListStore<Valeur> storeSexe = new ListStore<Valeur>();
581
			ComboBox<Valeur> cbSexe = new ComboBox<Valeur>();
582
			cbSexe.setStore(storeSexe);
583
			cbSexe.setFieldLabel("Sexe");
584
			cbSexe.setDisplayField("nom");
585
			cbSexe.setEmptyText("Choisissez le sexe:");
586
 
587
			lcAutreInformations1.add(cbSexe, fd100);
588
			hmIdentite.put("cbSexe", cbSexe);
589
 
590
			mediateur.obtenirListeValeurEtRafraichir(this, "sexe");
356 gduche 591
 
293 gduche 592
			//Description
593
			TextArea taDescription = new TextArea();
594
			taDescription.setEmptyText("Saisissez une description");
595
			taDescription.setFieldLabel("Description");
319 gduche 596
			taDescription.setWidth("100%");
376 gduche 597
			taDescription.setName("description");
293 gduche 598
 
386 gduche 599
			lcAutreInformations1.add(taDescription, fd100);
293 gduche 600
			hmIdentite.put("taDescription", taDescription);
601
 
386 gduche 602
			fsAutresInfos.add(lcAutreInformations1);
376 gduche 603
 
293 gduche 604
			// Logo
386 gduche 605
			LayoutContainer lcAutreInformations2 = new LayoutContainer();
606
			hmIdentite.put("lcAutreInformations2", lcAutreInformations2);
607
 
608
			LabelField lfUrlLogo = new LabelField();
609
			lfUrlLogo.setText("<b>Logo:</b>");
610
			lcAutreInformations2.add(lfUrlLogo);
611
 
612
			LayoutContainer lcUrlLogo = new LayoutContainer(new ColumnLayout());
613
			hmIdentite.put("lcUrlLogo", lcUrlLogo);
614
 
615
				TextField tfUrlLogo = new TextField();
616
				tfUrlLogo.setValue("http://");
617
 
618
				HiddenField<String> hfUrlLogo = new HiddenField<String>();
619
				hmIdentite.put("hfUrlLogo", hfUrlLogo);
620
 
621
				lcUrlLogo.add(tfUrlLogo, new ColumnData(0.8));
622
				hmIdentite.put("tfUrlLogo", tfUrlLogo);
623
 
624
				IconButton ibAjouterUrlLogo = new IconButton(ComposantClass.ICONE_AJOUTER);
625
				ibAjouterUrlLogo.addSelectionListener(new SelectionListener<ComponentEvent>() {
626
 
627
					public void componentSelected(ComponentEvent ce) {
628
 
629
						TextField<String> tfUrlLogo = (TextField) hmIdentite.get("tfUrlLogo");
630
						String strUrl = tfUrlLogo.getValue();
631
 
632
						if ((strUrl == null)||(strUrl.trim().equals("http://"))||(strUrl.trim().equals("")))	{
633
							MessageBox.alert("Erreur de saisie", "Vous devez saisir un URL", null);
634
						} else if(hmIdentite.get("url-" + strUrl) != null)	{
635
							MessageBox.alert("Erreur de saisie", "L'url est déjà présente dans la liste.", null);
636
						}	else	{
637
							tfUrlLogo.setValue("");
439 gduche 638
							//if (!strUrl.matches("[a-z]{3,}://[a-z0-9-]+.[.a-z0-9-]+(?::[0-9]*)?"))	{
639
							if (!strUrl.startsWith("http://"))	{
386 gduche 640
									MessageBox.alert("Erreur de saisie", "L'adresse n'est pas au bon format (ex: http://www.domain.com)", null);
641
								} else if (strUrl.length()>255){
642
									MessageBox.alert("Erreur de saisie", "L'adresse ne peut dépasser 255 caractères", null);
643
								} else {
644
									ajouterUrlLogo(strUrl);
645
								}
646
 
647
						}
648
 
649
					}
650
				});
651
 
652
				lcUrlLogo.add(ibAjouterUrlLogo, new ColumnData(0.15));
653
				lcAutreInformations2.add(lcUrlLogo);
654
 
655
			fsAutresInfos.add(lcAutreInformations2);
656
 
293 gduche 657
			TextArea taLogo = new TextArea();
658
			taLogo.setFieldLabel("Logos");
319 gduche 659
			taLogo.setWidth("100%");
293 gduche 660
			taLogo.setEmptyText("Saisissez les adresses des logos séparées par un saut de ligne");
386 gduche 661
			//fsAutresInfos.add(taLogo, fd100);
293 gduche 662
 
663
			hmIdentite.put("taLogo", taLogo);
664
 
376 gduche 665
			right.add(fsAutresInfos);
293 gduche 666
 
276 gduche 667
			// Ajout des évènements saisi
668
			KeyListener klNoms = new KeyListener()	{
669
				public void componentKeyUp(ComponentEvent ev)	{
283 gduche 670
					rafraichir(null);
280 gduche 671
				}
276 gduche 672
			};
673
 
283 gduche 674
			SelectionChangedListener<InterneValeur> selectionChange = new SelectionChangedListener<InterneValeur>() {
675
				public void selectionChanged(SelectionChangedEvent se) {
676
						rafraichir(null);
677
					}
678
			};
679
 
319 gduche 680
			cbPrefixe.addSelectionChangedListener(selectionChange);
681
			cbPrefixe.addKeyListener(klNoms);
276 gduche 682
			tfPrenom.addKeyListener(klNoms);
683
			tfNom.addKeyListener(klNoms);
283 gduche 684
			cbSuffixe.addSelectionChangedListener(selectionChange);
276 gduche 685
 
686
	}
687
 
293 gduche 688
	public void creerComposantsAdresse()	{
689
 
690
		// Gauche
691
		LayoutContainer left = new LayoutContainer();
692
		left.setLayout(new FormLayout());
693
 
694
		// Droite
695
		LayoutContainer right = new LayoutContainer();
696
		right.setLayout(new FormLayout());
697
 
698
		// Principal
699
		LayoutContainer main = new LayoutContainer();
700
		main.setLayout(new ColumnLayout());
701
 
702
		// Ajout au principal
703
		main.add(left, new ColumnData(.49));
704
		main.add(right, new ColumnData(.49));
705
 
706
		TextField<String> tfAdresse1 = new TextField();
707
		tfAdresse1.setFieldLabel("Adresse");
376 gduche 708
		tfAdresse1.setName("adresse_01");
319 gduche 709
		left.add(tfAdresse1, fd100);
293 gduche 710
		hmAdresse.put("tfAdresse1", tfAdresse1);
711
 
712
		TextField<String> tfAdresse2 = new TextField();
713
		tfAdresse2.setFieldLabel("Complément d'adresse");
376 gduche 714
		tfAdresse2.setName("adresse_02");
319 gduche 715
		left.add(tfAdresse2, fd100);
293 gduche 716
		hmAdresse.put("tfAdresse2", tfAdresse2);
717
 
718
		ComboBox<Valeur> cbPays = new ComboBox<Valeur>();
719
		cbPays.setFieldLabel("Pays");
720
		cbPays.setDisplayField("nom");
721
		cbPays.setEmptyText("Sélectionnez le pays:");
722
 
723
		ListStore<Valeur> storePays = new ListStore<Valeur>();
724
		cbPays.setStore(storePays);
725
 
319 gduche 726
		right.add(cbPays, fd100);
293 gduche 727
		hmAdresse.put("cbPays", cbPays);
728
 
729
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
730
			public void selectionChanged(SelectionChangedEvent se) {
731
					// Rafraichir avec le pays sélectionné
732
					obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
733
 
734
				}
735
		};
736
 
737
		cbPays.addSelectionChangedListener(selectionChange);
738
 
739
 
740
		ComboBox<Valeur> cbRegion = new ComboBox<Valeur>();
741
		cbRegion.setFieldLabel("Region");
742
		cbRegion.setDisplayField("nom");
743
		cbRegion.setEmptyText("Sélectionnez la région:");
744
		cbRegion.setVisible(false);
745
 
746
		ListStore<Valeur> storeRegion = new ListStore<Valeur>();
747
		cbRegion.setStore(storeRegion);
748
 
352 gduche 749
 
319 gduche 750
		right.add(cbRegion, fd100);
293 gduche 751
		hmAdresse.put("cbRegion", cbRegion);
752
 
753
		TextField<String> tfBoitePostale = new TextField<String>();
754
		tfBoitePostale.setFieldLabel("Boite postale");
376 gduche 755
		tfBoitePostale.setName("bp");
756
 
319 gduche 757
		left.add(tfBoitePostale, fd100);
293 gduche 758
		hmAdresse.put("tfBoitePostale", tfBoitePostale);
759
 
760
		TextField<Integer> tfCodePostal = new TextField<Integer>();
761
		tfCodePostal.setFieldLabel("Code postal");
376 gduche 762
		tfCodePostal.setName("code_postal");
763
 
319 gduche 764
		right.add(tfCodePostal, fd100);
293 gduche 765
		hmAdresse.put("tfCodePostal", tfCodePostal);
766
 
767
		TextField tfVille = new TextField();
768
		tfVille.setFieldLabel("Ville");
376 gduche 769
		tfVille.setName("ville");
293 gduche 770
 
319 gduche 771
		right.add(tfVille, fd100);
293 gduche 772
		hmAdresse.put("tfVille", tfVille);
773
 
774
		// MAJ ComboBox
775
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
776
 
304 gduche 777
		FieldSet fsAdresse = new FieldSet();
778
		fsAdresse.setHeading("Adresse personnelle");
779
		fsAdresse.add(main);
293 gduche 780
 
304 gduche 781
		tiAdresses.add(fsAdresse);
782
 
352 gduche 783
		((ComboBox) hmIdentite.get("cbPrefixe")).setRawValue("ljkhlkj");
784
 
785
 
293 gduche 786
	}
338 gduche 787
 
276 gduche 788
	/**
789
	 * Ajouter le bouton réinitialiser à la barre d'outils donnée
790
	 *
791
	 * @param barreOutils la barre d'outils à modifier
792
	 * */
376 gduche 793
	public void ajouterBoutonReinitialiser(ToolBar barreOutils)	{
276 gduche 794
 
795
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
352 gduche 796
		TextToolItem reinitialiser = new TextToolItem("Réinitialiser le formulaire");
276 gduche 797
		reinitialiser.setIconStyle(ComposantClass.ICONE_RAFRAICHIR);
798
		reinitialiser.addSelectionListener(new SelectionListener<ComponentEvent>() {
799
			public void componentSelected(ComponentEvent ce) {
376 gduche 800
				//((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicAjouterPersonne();
801
				reinitialiser();
802
				//System.out.println(personneSelectionnee);
276 gduche 803
			}
804
		});
805
		barreOutils.add(reinitialiser);
806
	}
807
 
808
	/**
338 gduche 809
	 * Ajouter le bouton Sauvegarder et revenir à la liste à la barre d'outils donnée
810
	 *
811
	 * @param barreOutils la barre d'outils à modifier
812
	 * */
356 gduche 813
	public static void ajouterBoutonEnregistrerEtRevenir(ButtonBar barreOutils)	{
338 gduche 814
 
815
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
356 gduche 816
		Button enregistrer = new Button("Enregistrer et revenir à la liste");
338 gduche 817
		enregistrer.setIconStyle(ComposantClass.ICONE_PREFERENCE);
818
		enregistrer.addSelectionListener(new SelectionListener<ComponentEvent>() {
819
			public void componentSelected(ComponentEvent ce) {
820
				// TODO : Enregistrer le formulaire
821
			}
822
		});
823
		barreOutils.add(enregistrer);
824
	}
825
 
826
	/**
276 gduche 827
	 * Ajouter le bouton Sauvegarder à la barre d'outils donnée
828
	 *
829
	 * @param barreOutils la barre d'outils à modifier
830
	 * */
376 gduche 831
	public void ajouterBoutonEnregistrer(ButtonBar barreOutils)	{
276 gduche 832
 
833
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
356 gduche 834
		Button enregistrer = new Button("Enregistrer");
286 gduche 835
		enregistrer.setIconStyle(ComposantClass.ICONE_PREFERENCE);
352 gduche 836
		enregistrer.setId("main-button");
286 gduche 837
		enregistrer.addSelectionListener(new SelectionListener<ComponentEvent>() {
276 gduche 838
			public void componentSelected(ComponentEvent ce) {
376 gduche 839
				enregistrer();
840
 
841
 
276 gduche 842
			}
843
		});
286 gduche 844
		barreOutils.add(enregistrer);
276 gduche 845
	}
846
 
847
	/**
848
	 * Ajouter le bouton annuler à la barre d'outils donnée
849
	 *
850
	 * @param barreOutils la barre d'outils à modifier
851
	 * */
356 gduche 852
	public static void ajouterBoutonAnnuler(ButtonBar barreOutils)	{
276 gduche 853
 
854
		// Le bouton annuler ne sauvegarde pas les informations et renvoie vers la page précédente
356 gduche 855
		Button annuler = new Button("Revenir à la liste");
276 gduche 856
		annuler.addSelectionListener(new SelectionListener<ComponentEvent>() {
857
			public void componentSelected(ComponentEvent ce) {
858
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicMenu("Personnes");
859
			}
860
		});
861
		annuler.setIconStyle(ComposantClass.ICONE_SUPPRIMER);
862
		barreOutils.add(annuler);
863
	}
864
 
293 gduche 865
	public void obtenirListeRegionParPays(String strPays)	{
866
		mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
867
	}
276 gduche 868
 
869
 
293 gduche 870
 
276 gduche 871
	/*---------------------------------------------------------------------------------------
872
	 * 		RAFRAICHISSEMENT DU PANNEAU
873
	 * --------------------------------------------------------------------------------------
874
	 */
283 gduche 875
	public void rafraichir(Object nouvellesDonnees) {
386 gduche 876
 
877
 
878
 
283 gduche 879
		if (nouvellesDonnees instanceof ValeurListe){
880
 
881
 
882
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
883
 
884
			// Créer une liste de valeurs
885
			List<Valeur> liste = new ArrayList<Valeur>();
886
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
887
				liste.add(listeValeurs.get(it.next()));
888
			}
889
 
890
			if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
891
 
319 gduche 892
				remplirCombobox("cbPrefixe", liste, "hmIdentite");
293 gduche 893
 
894
			} else if (listeValeurs.getId().equals(config.getListeId("suffixes"))) {
895
 
896
				remplirCombobox("cbSuffixe", liste, "hmIdentite");
897
 
898
			} else if (listeValeurs.getId().equals(config.getListeId("sexe"))) {
899
 
900
				remplirCombobox("cbSexe", liste, "hmIdentite");
283 gduche 901
 
293 gduche 902
			} else if (listeValeurs.getId().equals(config.getListeId("tel"))) {
903
 
904
				remplirCombobox("cbTelephone", liste, "hmIdentite");
319 gduche 905
 
906
				//Préselection du tél
907
				ComboBox<Valeur> cbTelephone = (ComboBox<Valeur>) hmIdentite.get("cbTelephone");
908
				cbTelephone.setValue(liste.get(1));
293 gduche 909
 
910
			} else if (listeValeurs.getId().equals(config.getListeId("pays")))	{
283 gduche 911
 
293 gduche 912
				remplirCombobox("cbPays", liste, "hmAdresse");
283 gduche 913
 
293 gduche 914
			} else if (listeValeurs.getId().equals(config.getListeId("region")))	{
283 gduche 915
 
293 gduche 916
				remplirCombobox("cbRegion", liste, "hmAdresse");
283 gduche 917
 
293 gduche 918
				((ComboBox) hmAdresse.get("cbRegion")).setVisible(true);
283 gduche 919
			}
293 gduche 920
 
921
 
352 gduche 922
		} else if (nouvellesDonnees instanceof Information)	{
286 gduche 923
 
352 gduche 924
			Information info = (Information) nouvellesDonnees;
386 gduche 925
			if (info.getType().equals("ajout_personne"))	{
352 gduche 926
 
386 gduche 927
				personneSelectionnee.set("id_personne", info.toString());
928
				GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
376 gduche 929
 
433 gduche 930
				Info.display("Enregistrement", "La personne a été ajoutée (PID:" + personneSelectionnee.getId() + ")");
386 gduche 931
				//Passer en mode modifier
376 gduche 932
 
433 gduche 933
			} else if (info.getType().equals("modification_personne"))	{
934
 
935
				Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
936
 
386 gduche 937
			} else if (info.getType().equals("suppression_personne"))	{
433 gduche 938
 
386 gduche 939
				GWT.log(info.toString(), null);
940
				Info.display("lk", info.getMessages().toString());
941
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
942
 
943
 
944
					Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
945
					Iterator itPersonneListe = colPersonneListe.iterator();
946
					Personne personne = (Personne) itPersonneListe.next();
376 gduche 947
 
386 gduche 948
					personneSauvegarde = new Personne();
949
					personneSauvegarde = (Personne) personne.cloner(personneSauvegarde);
376 gduche 950
 
386 gduche 951
					binderPersonne(personne);
952
					//Mise à jour de la personne
953
					//Personne personne = (Personne) nouvellesDonnees;
954
 
955
 
956
 
957
					//Prefixe
958
					String prefixe = personne.get("ce_truk_prefix");
959
					ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
960
 
961
 
962
					String prefixeCourant = personne.get("ce_truk_prefix");
963
					if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
964
						cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
965
					}	else	{
966
						cbPrefixe.setRawValue(prefixeCourant);
376 gduche 967
					}
968
 
969
 
386 gduche 970
					((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
971
					((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
972
 
973
					//Suffixe
974
					String suffixe = personne.get("ce_truk_suffixe");
975
					ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
976
 
977
					String suffixeCourant = personne.get("ce_truk_suffix");
978
					if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
979
						cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
980
					}	else	{
981
						cbSuffixe.setRawValue(suffixeCourant);
982
					}
983
 
984
					((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre"));
985
					((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
986
					((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre"));
987
 
988
 
989
					(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
990
					((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
991
 
992
					(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
993
					((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
994
 
995
					// Telephone
996
					HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
997
					if (hmTelephone!=null)	{
998
 
999
 
1000
						ListStore storeTelephone = ((ComboBox) hmIdentite.get("cbTelephone")).getStore();
1001
						List lstModelsTelephone = storeTelephone.getModels();
1002
						Iterator<Valeur> itStore = lstModelsTelephone.iterator();
1003
						HashMap<String, String> hmTel = new HashMap();
1004
						while (itStore.hasNext())	{
1005
							Valeur v = itStore.next();
1006
							hmTel.put(v.getAbreviation(), v.getNom());
376 gduche 1007
						}
1008
 
386 gduche 1009
 
1010
						Collection<String> colTelephone = hmTelephone.keySet();
1011
						Iterator<String> itTelephone = colTelephone.iterator();
1012
 
1013
						while (itTelephone.hasNext())	{
1014
							String strTypeTelephone = itTelephone.next();
1015
							String strTelephone = hmTelephone.get(strTypeTelephone);
1016
							String idTel = hmTel.get(strTypeTelephone);
1017
							if (idTel == null)	{
1018
								idTel = strTypeTelephone;
1019
							}
1020
 
1021
							ajouterTelephone(strTelephone, idTel, strTypeTelephone);
1022
						}
376 gduche 1023
					}
352 gduche 1024
 
386 gduche 1025
					//Courriel
1026
					LinkedList<String> lCourriels = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
440 gduche 1027
					if (lCourriels != null) {
1028
						Iterator<String> itCourriels = lCourriels.iterator();
386 gduche 1029
 
440 gduche 1030
						while (itCourriels.hasNext())	{
1031
							String strEmail = itCourriels.next();
1032
							ajouterCourriel(strEmail);
1033
						}
386 gduche 1034
					}
1035
 
1036
					// Sites
1037
					LinkedList<String> lUrl = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_url");
433 gduche 1038
					if (lUrl!=null) {
1039
						Iterator<String> itUrl = lUrl.iterator();
1040
						while (itUrl.hasNext())	{
1041
							String strUrl = itUrl.next();
1042
							ajouterUrl(strUrl);
1043
						}
386 gduche 1044
					}
1045
 
1046
					// Sexe
1047
					String strSexe = personne.get("ce_sexe");
1048
					ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe");
1049
 
1050
 
1051
					//FIXME : le lien avec la bdd ne peut pas se faire
1052
					if (cbSexe.getStore().findModel("abreviation", strSexe) != null)	{
1053
						cbSexe.setValue(cbSexe.getStore().findModel("abreviation", strSexe));
352 gduche 1054
					}	else	{
386 gduche 1055
						cbSexe.setRawValue(strSexe);
352 gduche 1056
					}
386 gduche 1057
 
1058
					((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description"));
1059
 
1060
					// Logos
1061
					TextArea taLogo = (TextArea) hmIdentite.get("taLogo");
1062
					LinkedList<String> lLogo = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_logo");
433 gduche 1063
					if (lLogo!=null)	{
1064
						Iterator<String> itLogo = lLogo.iterator();
1065
						String strValeurLogo = "";
1066
						while (itLogo.hasNext())	{
1067
							strValeurLogo += itLogo.next() + "\n";
1068
						}
386 gduche 1069
 
433 gduche 1070
						if (!strValeurLogo.trim().equals(""))	{
439 gduche 1071
							ajouterUrlLogo(strValeurLogo);
433 gduche 1072
						}
386 gduche 1073
					}
1074
 
1075
					/*--------------------------------------------------
1076
					                      Adresse
1077
					 ---------------------------------------------------*/
1078
 
1079
					// Adresse
1080
					((TextField<String>) hmAdresse.get("tfAdresse1")).setValue((String) personne.get("adresse_01"));
1081
 
1082
					// Complément
1083
					((TextField<String>) hmAdresse.get("tfAdresse2")).setValue((String) personne.get("adresse_02"));
1084
 
1085
					//Boite postale
1086
					((TextField<String>) hmAdresse.get("tfBoitePostale")).setValue((String) personne.get("bp"));
1087
 
1088
					//Pays
1089
					String strPays = personne.get("pays");
1090
					ComboBox<Valeur> cbPays = (ComboBox<Valeur>) hmAdresse.get("cbPays");
1091
 
1092
 
1093
					if (cbPays.getStore().findModel("nom", strPays) != null)	{
1094
						cbPays.setValue(cbPays.getStore().findModel("nom", strPays));
1095
					}	else	{
1096
						cbPays.setRawValue(strPays);
1097
					}
1098
 
1099
 
1100
					//Région
1101
					String strRegion = personne.get("region");
1102
					if ((strRegion!=null)&&(!strRegion.equals("")))	{
1103
						ComboBox<Valeur> cbRegion = (ComboBox<Valeur>) hmAdresse.get("cbRegion");
1104
						cbRegion.setVisible(true);
1105
 
1106
						if (cbRegion.getStore().findModel("nom", strRegion) != null)	{
1107
							cbRegion.setValue(cbRegion.getStore().findModel("nom", strRegion));
1108
						}	else	{
1109
							cbRegion.setRawValue(strRegion);
1110
						}
1111
					}
1112
 
1113
					//Cp
1114
					((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal"));
1115
 
1116
					//Ville
1117
					((TextField) hmAdresse.get("tfVille")).setValue(personne.get("ville"));
1118
 
1119
 
1120
				} else {
1121
					Info.display("messages", info.getMessages().toString());
352 gduche 1122
				}
293 gduche 1123
		}
283 gduche 1124
 
1125
		if (nouvellesDonnees == null)
1126
		{
319 gduche 1127
			ComboBox cb= (ComboBox) hmIdentite.get("cbPrefixe");
293 gduche 1128
 
1129
			//Met à jour le nom Complet du formulaire
283 gduche 1130
			String valeurRetour = "";
1131
 
1132
			// Prefixe
1133
			String prefixe = "";
319 gduche 1134
			Valeur valPrefixe = (Valeur) ((ComboBox) hmIdentite.get("cbPrefixe")).getValue();
283 gduche 1135
 
1136
			if (valPrefixe != null)	{
1137
				prefixe = valPrefixe.getNom();
293 gduche 1138
			} else 	{
319 gduche 1139
				prefixe =  (String) ((ComboBox) hmIdentite.get("cbPrefixe")).getRawValue();
293 gduche 1140
			}
283 gduche 1141
 
293 gduche 1142
 
283 gduche 1143
			// Prénom
1144
			String prenom = (String) ((TextField) hmIdentite.get("tfPrenom")).getValue();
1145
 
1146
			// Nom
1147
			String nom = (String) ((TextField) hmIdentite.get("tfNom")).getValue();
1148
 
1149
			// Suffixe
1150
			String suffixe = "";
1151
			Valeur valSuffixe = (Valeur) ((ComboBox) hmIdentite.get("cbSuffixe")).getValue();
1152
 
1153
			if (valSuffixe != null)	{
1154
				suffixe = valSuffixe.getNom();
293 gduche 1155
			} else 	{
1156
				suffixe =  (String) ((ComboBox) hmIdentite.get("cbSuffixe")).getRawValue();
283 gduche 1157
			}
1158
 
1159
			// Mettre à jour la valeur
1160
			valeurRetour = prefixe + " " + prenom + " " + nom + " " + suffixe;
1161
			valeurRetour = valeurRetour.replaceAll("null", "");
1162
 
1163
			((LabelField) hmIdentite.get("nomComplet")).setValue(valeurRetour);
1164
 
1165
			if (!valeurRetour.trim().equals(""))	{
1166
				((LabelField) hmIdentite.get("nomComplet")).show();
1167
			} else {
1168
				((LabelField) hmIdentite.get("nomComplet")).hide();
1169
			}
1170
		}
338 gduche 1171
 
1172
		mediateur.masquerPopinChargement();
127 gduche 1173
	}
1174
 
352 gduche 1175
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
293 gduche 1176
	public void remplirCombobox(String idComboBox, List liste, String hashMapId)	{
352 gduche 1177
 
293 gduche 1178
		HashMap hm = null;
1179
		if (hashMapId.equals("hmIdentite"))	{
1180
			hm = hmIdentite;
1181
		} else if (hashMapId.equals("hmAdresse")){
1182
			hm = hmAdresse;
1183
		} else {
1184
			hm = hmInfosNat;
1185
		}
1186
 
1187
		ListStore<Valeur> store = ((ComboBox) hm.get(idComboBox)).getStore();
376 gduche 1188
 
293 gduche 1189
		store.removeAll();
1190
		store.add(liste);
1191
		((ComboBox) hm.get(idComboBox)).setStore(store);
376 gduche 1192
 
293 gduche 1193
	}
130 gduche 1194
 
352 gduche 1195
 
376 gduche 1196
	public void ajouterTelephone(String strTelephone, String strValeurTypeTel, String idTel) 	{
352 gduche 1197
 
1198
 
1199
				//Ajout d'un champ à la liste
376 gduche 1200
				String strIdTelephone =  idTel + "##" + strTelephone + ";;";
352 gduche 1201
 
1202
				FieldSet fsContactTel = (FieldSet) hmIdentite.get("fsContactTel");
1203
 
356 gduche 1204
				LayoutContainer lcTelephone = new LayoutContainer();
1205
				lcTelephone.setLayout(new ColumnLayout());
1206
 
352 gduche 1207
				Text tTypeTelephone = new Text();
1208
				tTypeTelephone.setText(strValeurTypeTel+":");
1209
 
376 gduche 1210
				hmIdentite.put("type-" + strIdTelephone, tTypeTelephone);
356 gduche 1211
				lcTelephone.add(tTypeTelephone, new ColumnData(0.40));
352 gduche 1212
 
1213
				Text tTelephone = new Text();
1214
				tTelephone.setText(strTelephone);
376 gduche 1215
				hmIdentite.put("tel-" + strIdTelephone, tTelephone);
356 gduche 1216
				lcTelephone.add(tTelephone, new ColumnData(0.40));
352 gduche 1217
 
1218
				IconButton bSupprimer = new IconButton(ComposantClass.ICONE_SUPPRIMER);
376 gduche 1219
				bSupprimer.setId(strIdTelephone);
352 gduche 1220
 
1221
				bSupprimer.addSelectionListener(new SelectionListener<ComponentEvent>() {
1222
						public void componentSelected(ComponentEvent ce) {
1223
 
376 gduche 1224
							String strIdTelephone = ce.component.getId();
1225
							LayoutContainer lcContactTel = (LayoutContainer) hmIdentite.get("lc-"+strIdTelephone);
352 gduche 1226
 
376 gduche 1227
							lcContactTel.remove(hmIdentite.get("type-" + strIdTelephone));
1228
							hmIdentite.remove("type-" + strIdTelephone);
352 gduche 1229
 
376 gduche 1230
							lcContactTel.remove(hmIdentite.get("tel-" + strIdTelephone));
1231
							hmIdentite.remove("tel-" + strIdTelephone);
352 gduche 1232
 
356 gduche 1233
							lcContactTel.remove(ce.component);
352 gduche 1234
 
356 gduche 1235
							FieldSet fsContactTel = (FieldSet) hmIdentite.get("fsContactTel");
1236
							fsContactTel.remove(lcContactTel);
1237
 
376 gduche 1238
							HiddenField<String> hfTelephone = (HiddenField) hmIdentite.get("hfTelephone");
1239
							String strValeurTelephone = hfTelephone.getValue();
1240
							strValeurTelephone = strValeurTelephone.replace(strIdTelephone, "");
1241
							hfTelephone.setValue(strValeurTelephone);
1242
 
352 gduche 1243
							layout();
1244
 
1245
						}
1246
				});
1247
 
356 gduche 1248
				lcTelephone.add(bSupprimer, new ColumnData(0.15));
352 gduche 1249
 
376 gduche 1250
				hmIdentite.put("lc-"+strIdTelephone, lcTelephone);
356 gduche 1251
				fsContactTel.add(lcTelephone);
1252
 
376 gduche 1253
				HiddenField<String> hfTelephone = (HiddenField) hmIdentite.get("hfTelephone");
1254
				String strValeurTelephone = hfTelephone.getValue();
1255
				if (strValeurTelephone==null)	{
1256
					strValeurTelephone = "";
1257
				}
1258
				strValeurTelephone += strIdTelephone;
1259
				hfTelephone.setValue(strValeurTelephone);
352 gduche 1260
 
1261
				layout();
1262
 
1263
 
1264
 
1265
 
1266
	}
1267
 
376 gduche 1268
	public void ajouterCourriel(String strEmail)	{
1269
 
1270
			TextField<String> tfCourriel = (TextField<String>) hmIdentite.get("tfCourriel");
1271
			tfCourriel.setValue("");
1272
 
1273
			//Ajouter adresse email
1274
			LayoutContainer lcCourrielContainer = (LayoutContainer) hmIdentite.get("lcCourrielContainer");
1275
 
1276
			LayoutContainer lcCourriel = new LayoutContainer();
1277
			lcCourriel.setLayout(new ColumnLayout());
1278
 
1279
			LabelField lfCourriel = new LabelField();
1280
			lfCourriel.setText(strEmail);
1281
 
1282
			lcCourriel.add(lfCourriel, new ColumnData(0.8));
1283
			hmIdentite.put("lc-" + strEmail, lcCourriel);
1284
 
1285
			//Bouton supprimer
1286
			IconButton btnSupprimerCourriel = new IconButton(ComposantClass.ICONE_SUPPRIMER);
1287
			btnSupprimerCourriel.setId(strEmail);
1288
			btnSupprimerCourriel.addSelectionListener(new SelectionListener<ComponentEvent>() {
1289
 
1290
				public void componentSelected(ComponentEvent ce) {
1291
					//Suppression de l'adresse email
1292
					String strEmail = ce.component.getId();
1293
					LayoutContainer lcCourrielContainer = (LayoutContainer) hmIdentite.get("lcCourrielContainer");
1294
					LayoutContainer lcCourriel = (LayoutContainer) hmIdentite.get("lc-" + strEmail);
1295
					lcCourrielContainer.remove(lcCourriel);
1296
 
1297
					hmIdentite.remove("lc-" + strEmail);
1298
					hmIdentite.remove("email-" + strEmail);
1299
 
1300
						HiddenField<String> hfHiddenCourriel = (HiddenField) hmIdentite.get("hfHiddenCourriel");
1301
					String strValeurCourriel = hfHiddenCourriel.getValue();
1302
					strValeurCourriel = strValeurCourriel.replace(strEmail + ";;", "");
1303
					hfHiddenCourriel.setValue(strValeurCourriel);
1304
 
1305
				}
1306
 
1307
			});
1308
 
1309
			lcCourriel.add(btnSupprimerCourriel);
1310
 
1311
 
1312
 
1313
			lcCourrielContainer.add(lcCourriel);
1314
			hmIdentite.put("email-" + strEmail, lfCourriel);
1315
 
1316
			HiddenField<String> hfHiddenCourriel = (HiddenField) hmIdentite.get("hfHiddenCourriel");
1317
			String strHiddenCourrielValue = hfHiddenCourriel.getValue();
1318
			if (strHiddenCourrielValue == null) {
1319
				strHiddenCourrielValue = "";
1320
			}
1321
			hfHiddenCourriel.setRawValue(strHiddenCourrielValue + strEmail + ";;");
1322
 
1323
 
1324
			layout();
1325
 
1326
	}
1327
 
1328
	public void ajouterUrl(String strUrl)	{
1329
 
1330
		LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcUrlContainer");
1331
 
1332
		LayoutContainer lcUrl = new LayoutContainer();
1333
		lcUrl.setLayout(new ColumnLayout());
1334
		hmIdentite.put("lc-" + strUrl, lcUrl);
1335
 
1336
 
1337
		Text tUrl = new Text(strUrl);
1338
		hmIdentite.put("url-"+strUrl, tUrl);
1339
 
1340
		lcUrl.add(tUrl, new ColumnData(0.8));
1341
 
1342
		IconButton ibSupprimerUrl = new IconButton(ComposantClass.ICONE_SUPPRIMER);
1343
		ibSupprimerUrl.setId(strUrl);
1344
		ibSupprimerUrl.addSelectionListener(new SelectionListener<ComponentEvent>() {
130 gduche 1345
 
376 gduche 1346
			public void componentSelected(ComponentEvent ce) {
1347
 
1348
				//Suppression url
1349
				String strUrl = ce.component.getId();
1350
				LayoutContainer lcUrl = (LayoutContainer) hmIdentite.get("lc-" + strUrl);
1351
				LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcUrlContainer");
1352
 
1353
				lcUrlContainer.remove(lcUrl);
1354
 
386 gduche 1355
 
1356
				HiddenField<String> hfUrl = (HiddenField<String>) hmIdentite.get("hfUrl");
1357
				String strValeurUrl = hfUrl.getValue();
1358
				strValeurUrl = strValeurUrl.replace(strUrl, "");
1359
				hfUrl.setValue(strValeurUrl);
1360
 
376 gduche 1361
			}
1362
		});
1363
 
1364
		lcUrl.add(ibSupprimerUrl, new ColumnData(0.15));
1365
		lcUrlContainer.add(lcUrl);
1366
 
386 gduche 1367
		HiddenField<String> hfUrl = (HiddenField<String>) hmIdentite.get("hfUrl");
1368
		String strValeurUrl = hfUrl.getValue();
1369
		if (strValeurUrl == null)	{
1370
			strValeurUrl = "";
1371
		}
1372
 
1373
		strValeurUrl += strUrl + ";;";
1374
		hfUrl.setValue(strValeurUrl);
1375
 
376 gduche 1376
		layout();
1377
 
1378
 
1379
 
1380
	}
1381
 
386 gduche 1382
	public void ajouterUrlLogo(String strUrl)	{
1383
 
1384
		LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcAutreInformations2");
1385
 
1386
		LayoutContainer lcUrl = new LayoutContainer();
1387
		lcUrl.setLayout(new ColumnLayout());
1388
		hmIdentite.put("lc-" + strUrl, lcUrl);
1389
 
1390
 
1391
		Text tUrl = new Text(strUrl);
1392
		hmIdentite.put("url-"+strUrl, tUrl);
1393
 
1394
		lcUrl.add(tUrl, new ColumnData(0.8));
1395
 
1396
		IconButton ibSupprimerUrl = new IconButton(ComposantClass.ICONE_SUPPRIMER);
1397
		ibSupprimerUrl.setId(strUrl);
1398
		ibSupprimerUrl.addSelectionListener(new SelectionListener<ComponentEvent>() {
1399
 
1400
			public void componentSelected(ComponentEvent ce) {
1401
 
1402
				//Suppression url
1403
				String strUrl = ce.component.getId();
1404
				LayoutContainer lcUrl = (LayoutContainer) hmIdentite.get("lc-" + strUrl);
1405
				LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcAutreInformations2");
1406
 
1407
				lcUrlContainer.remove(lcUrl);
1408
 
1409
 
1410
				HiddenField<String> hfUrlLogo = (HiddenField<String>) hmIdentite.get("hfUrlLogo");
1411
				String strValeurUrl = hfUrlLogo.getValue();
1412
				strValeurUrl = strUrl.replace(strUrl, "");
1413
 
1414
				hfUrlLogo.setValue(strValeurUrl);
1415
 
1416
			}
1417
		});
1418
 
1419
		lcUrl.add(ibSupprimerUrl, new ColumnData(0.15));
1420
		lcUrlContainer.add(lcUrl);
1421
 
1422
		HiddenField<String> hfUrlLogo = (HiddenField<String>) hmIdentite.get("hfUrlLogo");
1423
		String strValeurUrl = hfUrlLogo.getValue();
1424
		if (strValeurUrl == null)	{
1425
			strValeurUrl = "";
1426
		}
1427
 
1428
		strValeurUrl += strUrl + ";;";
1429
 
1430
		hfUrlLogo.setValue(strValeurUrl);
1431
 
1432
 
1433
 
1434
		layout();
1435
 
1436
 
1437
 
1438
	}
1439
 
376 gduche 1440
	public void reinitialiser()	{
1441
 
1442
		mediateur.afficherPopinChargement();
1443
 
1444
 
1445
		binderPersonne(personneSauvegarde);
1446
 
1447
 
1448
		layout();
1449
 
1450
		mediateur.masquerPopinChargement();
1451
	}
1452
 
1453
 
1454
 
1455
	public void binderPersonne(Personne personne)	{
1456
 
1457
		binding = new FormBinding(this);
1458
 
1459
		personneSelectionnee = personne;
1460
		binding.autoBind();
1461
		binding.bind(personneSelectionnee);
1462
 
1463
		layout();
1464
	}
130 gduche 1465
 
376 gduche 1466
	/**
1467
	 * Enregistre les information de la personne en cours
1468
	 *
1469
	 */
1470
	public void enregistrer()	{
1471
 
1472
		LinkedList lstMessageErreur = new LinkedList<String>();
1473
 
1474
		//Préparer les données
1475
		ComboBox combo = (ComboBox) hmIdentite.get("cbSexe");
1476
		Valeur valeur;
1477
		String strValeur = "";
1478
 
1479
		if (combo.getValue()!=null)	{
1480
			valeur = (Valeur) combo.getValue();
1481
			strValeur = valeur.getId();
1482
		}
1483
 
1484
		if (!strValeur.trim().equals(""))	{
1485
			personneSelectionnee.set("sexe", strValeur);
1486
		} else {
1487
			lstMessageErreur.add("Le champ Sexe n'a pas été renseigné");
1488
		}
1489
 
1490
		strValeur = obtenirValeurCombo("cbPrefixe");
1491
		personneSelectionnee.set("ce_truk_prefix", strValeur);
1492
 
1493
		strValeur = obtenirValeurCombo("cbSuffixe");
1494
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1495
 
1496
		personneSelectionnee.set("truk_courriel", ((HiddenField<String>) hmIdentite.get("hfHiddenCourriel")).getValue());
1497
 
386 gduche 1498
 
1499
		//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
1500
		String strPrefixe = "";
1501
		combo = (ComboBox) hmIdentite.get("cbPrefixe");
1502
		valeur = (Valeur) combo.getValue();
1503
		if (valeur != null)	{
1504
			strPrefixe = valeur.getNom();
1505
		} else {
1506
			strPrefixe = combo.getRawValue();
1507
		}
1508
 
1509
		String strSuffixe = "";
1510
		combo = (ComboBox) hmIdentite.get("cbSuffixe");
1511
		valeur = (Valeur) combo.getValue();
1512
		if (valeur != null)	{
1513
			strSuffixe = valeur.getNom();
1514
		} else {
1515
			strSuffixe = combo.getRawValue();
1516
		}
1517
		strValeur = strPrefixe
376 gduche 1518
					+ " " + personneSelectionnee.get("prenom")
1519
					+ " " + personneSelectionnee.get("nom")
386 gduche 1520
					+ " " + strSuffixe;
376 gduche 1521
 
1522
		personneSelectionnee.set("fmt_nom_complet", strValeur);
1523
 
1524
		personneSelectionnee.set("naissance_date", (Date) ((DateField) hmIdentite.get("dfDateNaissance")).getValue());
1525
 
1526
 
1527
		strValeur = obtenirValeurCombo("cbPays");
1528
		personneSelectionnee.set("pays", strValeur);
1529
 
1530
		strValeur = obtenirValeurCombo("cbRegion");
1531
		personneSelectionnee.set("region", strValeur);
1532
 
1533
		personneSelectionnee.set("truk_telephone", ((HiddenField<String>) hmIdentite.get("hfTelephone")).getValue());
1534
 
386 gduche 1535
		String logoUrls = ((HiddenField<String>) hmIdentite.get("hfUrlLogo")).getValue();
1536
		if (logoUrls == null)	{
1537
			logoUrls = "";
1538
		}
1539
		personneSelectionnee.set("truk_logo", logoUrls);
376 gduche 1540
 
386 gduche 1541
		personneSelectionnee.set("truk_url", ((HiddenField) hmIdentite.get("hfUrl")).getValue());
376 gduche 1542
 
386 gduche 1543
		//if (lstMessageErreur.size() < 0)	{
1544
			mediateur.enregistrerPersonne(this, personneSelectionnee);
1545
		/*} else {
1546
			String strMessagesErreur = "";
1547
			Iterator<String> itMessagesErreur = lstMessageErreur.iterator();
1548
			while (itMessagesErreur.hasNext())	{
1549
				strMessagesErreur += " - " + itMessagesErreur.next() +" \n";
1550
			}
1551
 
1552
 			MessageBox.alert("Erreurs", "Les erreurs suivantes ont été commises : \n" + strMessagesErreur, null);
1553
		}*/
376 gduche 1554
	}
1555
 
1556
	private String obtenirValeurCombo(String strComboName)	{
1557
 
1558
		String strValeur = "";
1559
		Valeur valeur;
1560
 
1561
		ComboBox combo = (ComboBox) hmIdentite.get(strComboName);
1562
		if (combo == null)	{
1563
			combo = (ComboBox) hmAdresse.get(strComboName);
1564
		}
1565
		if (combo.getValue()!=null)	{
1566
			valeur = (Valeur) combo.getValue();
1567
			strValeur = valeur.getId();
1568
		} else {
1569
			strValeur = combo.getRawValue();
1570
		}
1571
 
1572
		return strValeur;
1573
	}
127 gduche 1574
}