Subversion Repositories eFlore/Applications.coel

Rev

Rev 1343 | 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.personne;
127 gduche 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;
1290 cyprien 14
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
692 gduche 15
import org.tela_botanica.client.composants.ChampMultiValeurs;
701 gduche 16
import org.tela_botanica.client.composants.ChampMultiValeursImage;
722 gduche 17
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
1290 cyprien 18
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypesPaginable;
19
import org.tela_botanica.client.composants.ChampMultiValeursPaginable;
973 gduche 20
import org.tela_botanica.client.composants.HashMapComposants;
907 jpm 21
import org.tela_botanica.client.configuration.Configuration;
991 gduche 22
import org.tela_botanica.client.images.Images;
127 gduche 23
import org.tela_botanica.client.interfaces.Rafraichissable;
293 gduche 24
 
352 gduche 25
import org.tela_botanica.client.modeles.Information;
850 gduche 26
import org.tela_botanica.client.modeles.MenuApplicationId;
280 gduche 27
import org.tela_botanica.client.modeles.Valeur;
283 gduche 28
import org.tela_botanica.client.modeles.ValeurListe;
935 jpm 29
import org.tela_botanica.client.modeles.personne.Personne;
30
import org.tela_botanica.client.modeles.personne.PersonneListe;
31
import org.tela_botanica.client.modeles.projet.Projet;
32
import org.tela_botanica.client.modeles.projet.ProjetListe;
991 gduche 33
import org.tela_botanica.client.modeles.publication.Publication;
34
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
35
import org.tela_botanica.client.modeles.publication.PublicationListe;
1302 cyprien 36
import org.tela_botanica.client.util.Debug;
729 jp_milcent 37
import org.tela_botanica.client.util.Pattern;
622 gduche 38
import org.tela_botanica.client.util.UtilString;
935 jpm 39
import org.tela_botanica.client.vues.Formulaire;
127 gduche 40
 
1290 cyprien 41
import com.extjs.gxt.ui.client.data.ModelData;
42
import com.extjs.gxt.ui.client.data.ModelType;
43
import com.extjs.gxt.ui.client.data.PagingLoadResult;
488 gduche 44
import com.extjs.gxt.ui.client.event.Events;
276 gduche 45
import com.extjs.gxt.ui.client.Registry;
283 gduche 46
import com.extjs.gxt.ui.client.Style.Scroll;
1290 cyprien 47
import com.extjs.gxt.ui.client.Style.SortDir;
821 gduche 48
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
386 gduche 49
 
1187 gduche 50
import com.extjs.gxt.ui.client.binding.FieldBinding;
376 gduche 51
import com.extjs.gxt.ui.client.binding.FormBinding;
386 gduche 52
 
488 gduche 53
import com.extjs.gxt.ui.client.event.ButtonEvent;
276 gduche 54
import com.extjs.gxt.ui.client.event.ComponentEvent;
55
import com.extjs.gxt.ui.client.event.KeyListener;
446 gduche 56
import com.extjs.gxt.ui.client.event.Listener;
280 gduche 57
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
58
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
276 gduche 59
import com.extjs.gxt.ui.client.event.SelectionListener;
280 gduche 60
import com.extjs.gxt.ui.client.store.ListStore;
127 gduche 61
import com.extjs.gxt.ui.client.widget.LayoutContainer;
319 gduche 62
import com.extjs.gxt.ui.client.widget.MessageBox;
338 gduche 63
 
991 gduche 64
import com.extjs.gxt.ui.client.widget.ContentPanel;
1218 cyprien 65
import org.tela_botanica.client.composants.InfoLogger;
1290 cyprien 66
import org.tela_botanica.client.composants.pagination.Proxy;
1327 cyprien 67
import org.tela_botanica.client.composants.pagination.ProxyProjets;
1290 cyprien 68
import org.tela_botanica.client.composants.pagination.ProxyValeur;
69
import org.tela_botanica.client.composants.pagination.TransformateurJSONaModelData;
70
 
276 gduche 71
import com.extjs.gxt.ui.client.widget.TabItem;
72
import com.extjs.gxt.ui.client.widget.TabPanel;
973 gduche 73
import com.extjs.gxt.ui.client.widget.Text;
283 gduche 74
 
356 gduche 75
import com.extjs.gxt.ui.client.widget.button.Button;
76
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
280 gduche 77
import com.extjs.gxt.ui.client.widget.form.ComboBox;
78
import com.extjs.gxt.ui.client.widget.form.DateField;
1327 cyprien 79
import com.extjs.gxt.ui.client.widget.form.Field;
276 gduche 80
import com.extjs.gxt.ui.client.widget.form.FieldSet;
81
import com.extjs.gxt.ui.client.widget.form.LabelField;
446 gduche 82
import com.extjs.gxt.ui.client.widget.form.Radio;
83
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
286 gduche 84
import com.extjs.gxt.ui.client.widget.form.TextArea;
276 gduche 85
import com.extjs.gxt.ui.client.widget.form.TextField;
1327 cyprien 86
import com.extjs.gxt.ui.client.widget.form.Validator;
456 gduche 87
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
850 gduche 88
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
276 gduche 89
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
90
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
991 gduche 91
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
319 gduche 92
import com.extjs.gxt.ui.client.widget.layout.FormData;
276 gduche 93
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
356 gduche 94
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
821 gduche 95
import com.extjs.gxt.ui.client.widget.layout.TableData;
96
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
991 gduche 97
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
98
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
386 gduche 99
import com.google.gwt.core.client.GWT;
339 gduche 100
import com.google.gwt.i18n.client.DateTimeFormat;
1290 cyprien 101
import com.google.gwt.json.client.JSONObject;
991 gduche 102
import com.google.gwt.user.client.Window;
276 gduche 103
import com.google.gwt.user.client.ui.Widget;
127 gduche 104
 
850 gduche 105
public class PersonneForm extends Formulaire implements Rafraichissable {
127 gduche 106
 
730 jp_milcent 107
	// VARIABLES
276 gduche 108
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
991 gduche 109
	PersonneFormPublication tiPubli;
283 gduche 110
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
991 gduche 111
	protected Personne personneSelectionnee, personneSauvegarde = null;
276 gduche 112
 
657 gduche 113
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
973 gduche 114
	private HashMapComposants hmIdentite = new HashMapComposants();
976 gduche 115
	private HashMapComposants hmAdresse = new HashMapComposants();
979 gduche 116
	private HashMapComposants hmInfosNat = new HashMapComposants();
730 jp_milcent 117
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
829 gduche 118
	private FormData fd100 = new FormData("95%");
657 gduche 119
 
668 gduche 120
	private Button enregistrer, enregistrerEtRevenir;
121
 
875 jpm 122
	private Personne personne = null;
123
	private String personneId = null;
376 gduche 124
	private FormBinding binding = null;
125
 
991 gduche 126
	//Publi
127
	private ComboBox<Publication> cbPubli;
128
	private ListStore<Publication> storePubli;
129
 
130
	// CONSTRUCTEUR
915 jpm 131
	public PersonneForm(Mediateur mediateurCourrant, String personneId) {
875 jpm 132
		initialiserPersonneForm(mediateurCourrant, personneId);
133
	}
446 gduche 134
 
875 jpm 135
	public PersonneForm(Mediateur mediateurCourrant, String personneId, Rafraichissable vueARafraichirApresValidation) {
136
		vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
1014 gduche 137
		initialiserPersonneForm(mediateurCourrant, personneId);
875 jpm 138
	}
850 gduche 139
 
875 jpm 140
	private void initialiserPersonneForm(Mediateur mediateurCourrant, String personneIdCourrant) {
1014 gduche 141
 
875 jpm 142
		personne = new Personne();
143
		personne.setId(personneIdCourrant);
144
		personneId = personneIdCourrant;
850 gduche 145
 
884 jpm 146
		String modeDeCreation = (UtilString.isEmpty(personneId) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
875 jpm 147
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PERSONNE);
148
 
386 gduche 149
		initialiserComposants();
875 jpm 150
		genererTitreFormulaire();
850 gduche 151
 
1014 gduche 152
		mediateur.obtenirListeValeurEtRafraichir(this, "relationPersonnePublication");
875 jpm 153
		if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
154
			mediateur.selectionnerPersonne(this, personne, null);
850 gduche 155
		}
352 gduche 156
	}
157
 
875 jpm 158
	private void genererTitreFormulaire() {
159
		String titre = i18nC.personneModeAjout();
160
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
161
			 titre = i18nC.personneModeModifier()+" - "+i18nC.id()+": "+personneId;
162
		}
163
		panneauFormulaire.setHeading(titre);
164
	}
165
 
386 gduche 166
	public void initialiserComposants()	{
376 gduche 167
		personneSelectionnee = new Personne();
168
		personneSauvegarde = new Personne();
169
 
276 gduche 170
		initialiserOnglets();
171
 
172
		creerComposantsIdentite();
293 gduche 173
		creerComposantsAdresse();
821 gduche 174
		creerComposantsInfosNat();
991 gduche 175
		//creerComposantsPubli();
338 gduche 176
 
376 gduche 177
		binderPersonne(personneSelectionnee);
276 gduche 178
	}
179
 
180
	/**
181
	 * Crée les onglets identité, adresse et informations naturaliste
182
	 *
183
	 * */
184
	public void initialiserOnglets()	{
185
		//TabPanel
186
		TabPanel formulaireOnglets = new TabPanel();
187
 
188
		//Tab 1 : identite
991 gduche 189
		tiIdentite = creerOnglet(i18nC.personneIdentite(), "tiIdentite");
190
		tiIdentite.setStyleAttribute("padding", "0");
276 gduche 191
		formulaireOnglets.add(tiIdentite);
192
 
193
		//Tab 2 : Adresse
991 gduche 194
		tiAdresses = creerOnglet(i18nC.adresse(), "tiAdresses");
276 gduche 195
		formulaireOnglets.add(tiAdresses);
196
 
197
		//Tab 3 : Infos Naturalistes
991 gduche 198
		tiInfosNat = creerOnglet(i18nC.personneInfoNat(), "tiInfosNat");
199
		formulaireOnglets.add(tiInfosNat);
446 gduche 200
 
1218 cyprien 201
		//Tab 4 : Publications
991 gduche 202
		tiPubli = new PersonneFormPublication(this);
203
		formulaireOnglets.add(tiPubli);
204
 
850 gduche 205
		getFormulaire().add(formulaireOnglets);
276 gduche 206
	}
207
 
208
	/**
209
	 * Crée les widgets pour l'onglet identité
210
	 *
211
	 * */
212
 
213
 
214
	public void creerComposantsIdentite()	{
676 gduche 215
		// Gestion de l'affichage en colonnes : 3 Layout container : principal, gauche & droite
216
		LayoutContainer left = new LayoutContainer();
217
		left.setLayout(new FormLayout());
829 gduche 218
		left.setStyleAttribute("padding", "15px");
219
 
676 gduche 220
		LayoutContainer right = new LayoutContainer();
221
		right.setLayout(new FormLayout());
829 gduche 222
		right.setStyleAttribute("padding", "15px");
456 gduche 223
 
676 gduche 224
		LayoutContainer main = new LayoutContainer();
225
 
226
		main.add(left, new ColumnData(.45));
227
		main.add(right, new ColumnData(.45));
228
 
229
		main.setLayout(new ColumnLayout());
230
		main.setHeight("100%");
231
		main.setScrollMode(Scroll.AUTO);
232
 
233
		// Création des champs
234
		FormLayout formLayout = new FormLayout();
235
		formLayout.setLabelAlign(LabelAlign.LEFT);
236
 
1086 jpm 237
		//+------------------------------------------------------------------------------------------------------------+
238
		// Fieldset PROJET
676 gduche 239
		FieldSet fsProjet = new FieldSet();
875 jpm 240
		fsProjet.setHeading(i18nC.menuProjet());
676 gduche 241
		fsProjet.setLayout(new FormLayout());
242
 
1327 cyprien 243
		ModelType modelTypeProjets = new ModelType();
244
		modelTypeProjets.setRoot("projets");
245
		modelTypeProjets.setTotalName("nbElements");
246
		modelTypeProjets.addField("cpr_nom");
247
		modelTypeProjets.addField("cpr_id_projet");
676 gduche 248
 
1327 cyprien 249
		String displayNameProjets = "cpr_nom";
250
		ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>();
251
 
252
		ChampComboBoxRechercheTempsReelPaginable cbProjets = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
253
		cbProjets.setWidth(100, 600);
254
		cbProjets.getCombo().setTabIndex(tabIndex++);
255
		cbProjets.getCombo().setFieldLabel(i18nC.personneProjet());
256
		cbProjets.getCombo().setEmptyText(i18nC.txtListeProjetDefaut());
257
		cbProjets.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
258
		cbProjets.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
259
		cbProjets.getCombo().setAllowBlank(false);
260
		cbProjets.getCombo().setEditable(false);
261
 
262
		fsProjet.add(cbProjets, new FormData(600, 0));
263
 
676 gduche 264
		hmIdentite.put("cbProjets", cbProjets);
456 gduche 265
 
676 gduche 266
		left.add(fsProjet);
1086 jpm 267
 
268
		//+------------------------------------------------------------------------------------------------------------+
269
		// Fieldset NOM
676 gduche 270
		FieldSet fsNoms = new FieldSet();
271
		fsNoms.setHeading("Noms");
272
		fsNoms.setLayout(formLayout);
456 gduche 273
 
676 gduche 274
		// Nom complet : Affiché que si valeurs saisies
275
		LabelField nomComplet = new LabelField();
875 jpm 276
		nomComplet.setFieldLabel(i18nC.personneNomComplet() +" :");
676 gduche 277
		nomComplet.hide();
456 gduche 278
 
676 gduche 279
		fsNoms.add(nomComplet);
280
		hmIdentite.put("nomComplet", nomComplet);
276 gduche 281
 
676 gduche 282
		//Préfixe
283
		ListStore<Valeur> storePrefixe = new ListStore<Valeur>();
284
		ComboBox<Valeur> cbPrefixe = new ComboBox<Valeur>();
285
		cbPrefixe.setStore(storePrefixe);
286
		cbPrefixe.setDisplayField("nom");
287
		cbPrefixe.setEmptyText("Choisissez le préfixe:");
288
		cbPrefixe.setFieldLabel("Prefix");
289
 
290
		fsNoms.add(cbPrefixe);
291
		hmIdentite.put("cbPrefixe", cbPrefixe);
292
 
293
		mediateur.obtenirListeValeurEtRafraichir(this, "prefixe");
294
 
295
		//Prénom
296
		TextField<String> tfPrenom = new TextField<String>();
297
		tfPrenom.setFieldLabel("Prénom");
298
		tfPrenom.setName("prenom");
299
 
1086 jpm 300
		fsNoms.add(tfPrenom, new FormData(300, 0));
676 gduche 301
		hmIdentite.put("tfPrenom", tfPrenom);
302
 
303
		//Nom
304
		TextField<String> tfNom = new TextField<String>();
305
		tfNom.setFieldLabel("Nom");
306
		tfNom.setAllowBlank(false);
307
		tfNom.setName("nom");
981 jpm 308
		tfNom.addStyleName(ComposantClass.OBLIGATOIRE);
309
		tfNom.addListener(Events.Valid, creerEcouteurChampObligatoire());
676 gduche 310
 
1086 jpm 311
		fsNoms.add(tfNom, new FormData(300, 0));
676 gduche 312
		hmIdentite.put("tfNom", tfNom);
313
 
314
		//Suffixe
315
		ListStore<Valeur> storeSuffixe = new ListStore<Valeur>();
316
		ComboBox<Valeur> cbSuffixe = new ComboBox<Valeur>();
317
		cbSuffixe.setStore(storeSuffixe);
318
		cbSuffixe.setFieldLabel("Suffixe");
319
		cbSuffixe.setDisplayField("nom");
320
		cbSuffixe.setEmptyText("Choisissez un suffixe:");
321
 
322
		fsNoms.add(cbSuffixe);
323
		hmIdentite.put("cbSuffixe", cbSuffixe);
324
 
325
		mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
326
 
327
		TextField<String> tfAbreviation = new TextField<String>();
328
		tfAbreviation.setFieldLabel("Abréviation");
329
		tfAbreviation.setName("abreviation");
330
 
331
		fsNoms.add(tfAbreviation);
332
		hmIdentite.put("tfAbreviation", tfAbreviation);
333
 
821 gduche 334
		TableLayout layoutAutreNoms = new TableLayout(2);
335
		layoutAutreNoms.setCellVerticalAlign(VerticalAlignment.TOP);
336
		LayoutContainer autresNoms = new LayoutContainer(layoutAutreNoms);
337
		ChampMultiValeurs nomAutre = new ChampMultiValeurs("Autres noms",150);
338
		hmIdentite.put("nomAutre", nomAutre);
339
		autresNoms.add(nomAutre, new TableData("200px", "15px"));
676 gduche 340
 
821 gduche 341
		ChampMultiValeurs abreviationAutre = new ChampMultiValeurs("Autres abréviation",150);
342
		hmIdentite.put("abreviationAutre", abreviationAutre);
343
		autresNoms.add(abreviationAutre, new TableData("200px", "15px"));
344
		fsNoms.add(autresNoms);
376 gduche 345
 
676 gduche 346
		left.add(fsNoms);
347
 
1086 jpm 348
		//+------------------------------------------------------------------------------------------------------------+
349
		// Fieldset NAISSANCE ET DÉCÈS
973 gduche 350
		FieldSet fsNaissanceEtDeces = new FieldSet();
351
		fsNaissanceEtDeces.setHeading("Naissance et Décès");
352
		fsNaissanceEtDeces.setLayout(new ColumnLayout());
353
 
676 gduche 354
		formLayout = new FormLayout();
973 gduche 355
		formLayout.setLabelAlign(LabelAlign.TOP);
356
		LayoutContainer containerNaissance = new LayoutContainer(formLayout);
357
 
1269 jpm 358
		//Remplacement du DateField par un champ texte
359
		TextField tfDateNaissance = new TextField();
360
		tfDateNaissance.setFieldLabel("Date de naissance");
361
		containerNaissance.add(tfDateNaissance);
362
		hmIdentite.put("tfDateNaissance", tfDateNaissance);
676 gduche 363
 
364
		// Lieu naissance
730 jp_milcent 365
		TextField<String> tfLieuNaissance = new TextField<String>();
973 gduche 366
		tfLieuNaissance.setFieldLabel("Lieu de naissance");
676 gduche 367
		tfLieuNaissance.setName("naissance_lieu");
368
 
973 gduche 369
		containerNaissance.add(tfLieuNaissance);
676 gduche 370
		hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
371
 
973 gduche 372
		fsNaissanceEtDeces.add(containerNaissance, new ColumnData(.5));
373
		left.add(fsNaissanceEtDeces);
374
 
676 gduche 375
		formLayout = new FormLayout();
973 gduche 376
		formLayout.setLabelAlign(LabelAlign.TOP);
377
		LayoutContainer containerDeces = new LayoutContainer(formLayout);
676 gduche 378
 
379
		Radio rbEstDecedee = new Radio();
973 gduche 380
		rbEstDecedee.setId("ce_deces");
381
 
676 gduche 382
		rbEstDecedee.setBoxLabel("oui");
829 gduche 383
		rbEstDecedee.setValueAttribute("1");
973 gduche 384
		rbEstDecedee.setId("rbEstD");
385
 
676 gduche 386
		rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() {
446 gduche 387
 
676 gduche 388
			public void handleEvent(ComponentEvent be) {
389
				if(((Radio) be.getComponent()).getValue().equals(true))	{
1269 jpm 390
					hmIdentite.getTextField("tfDateDeces").setVisible(true);
973 gduche 391
					hmIdentite.getTextField("tfLieuDeces").setVisible(true);
676 gduche 392
				} else	{
1269 jpm 393
					TextField tfDateDeces = hmIdentite.getTextField("tfDateDeces");
394
					tfDateDeces.setValue(null);
395
					tfDateDeces.setVisible(false);
829 gduche 396
 
973 gduche 397
					TextField tfLieuDeces = hmIdentite.getTextField("tfLieuDeces");
829 gduche 398
					tfLieuDeces.setValue(null);
399
					tfLieuDeces.setVisible(false);
676 gduche 400
				}
401
			}
402
		});
446 gduche 403
 
1269 jpm 404
		TextField tfDateDeces = new TextField();
405
		tfDateDeces.setFieldLabel("Date de décès");
406
		tfDateDeces.setVisible(false);
676 gduche 407
 
1269 jpm 408
		containerDeces.add(tfDateDeces);
409
		hmIdentite.put("tfDateDeces", tfDateDeces);
676 gduche 410
 
730 jp_milcent 411
		TextField<String> tfLieuDeces = new TextField<String>();
973 gduche 412
		tfLieuDeces.setFieldLabel("Lieu de décès");
676 gduche 413
		tfLieuDeces.setName("deces_lieu");
414
		tfLieuDeces.setVisible(false);
415
 
973 gduche 416
		containerDeces.add(tfLieuDeces);
676 gduche 417
		hmIdentite.put("tfLieuDeces", tfLieuDeces);
973 gduche 418
		hmIdentite.put("rbEstDecedee", rbEstDecedee);
419
 
420
		Radio rbNestPasDecedee = new Radio();
421
		rbNestPasDecedee.setValueAttribute("0");
422
		rbNestPasDecedee.setBoxLabel("non");
423
		rbNestPasDecedee.setValue(true);
276 gduche 424
 
973 gduche 425
		RadioGroup rbgDeces = new RadioGroup();
1187 gduche 426
		rbgDeces.setId("rbgDeces");
427
 
973 gduche 428
		rbgDeces.setFieldLabel("Est décédée");
429
		rbgDeces.add(rbEstDecedee);
430
		rbgDeces.add(rbNestPasDecedee);
1187 gduche 431
		hmIdentite.put("rbgDeces", rbgDeces);
973 gduche 432
 
433
		containerDeces.add(rbgDeces);
434
 
435
		fsNaissanceEtDeces.add(containerDeces, new ColumnData(.5));
676 gduche 436
		tiIdentite.add(main);
1086 jpm 437
 
438
		//+------------------------------------------------------------------------------------------------------------+
439
		// Fieldset CONTACT
973 gduche 440
		FieldSet fsContact = new FieldSet();
441
		fsContact.setHeading("Contact");
442
		fsContact.setLayout(new RowLayout());
676 gduche 443
 
973 gduche 444
		ChampMultiValeursMultiTypes telephones = new ChampMultiValeursMultiTypes("Téléphones", 180, 100);
1086 jpm 445
		telephones.initialiserType("tel");
446
		fsContact.add(telephones, new FormData(450, 0));
722 gduche 447
		hmIdentite.put("telephones", telephones);
676 gduche 448
 
973 gduche 449
		ChampMultiValeurs courriels = new ChampMultiValeurs("Courriels", 280);
450
		courriels.setValidation(Pattern.email, "moi@domaine.fr");
1086 jpm 451
		fsContact.add(courriels, new FormData(450, 0));
692 gduche 452
		hmIdentite.put("courriels", courriels);
676 gduche 453
 
454
		LayoutContainer lcCourrielContainer = new LayoutContainer(new RowLayout());
455
		fsContact.add(lcCourrielContainer);
456
		hmIdentite.put("lcCourrielContainer", lcCourrielContainer);
457
 
973 gduche 458
		fsContact.add(new Text(""));
459
 
692 gduche 460
		ChampMultiValeurs sites = new ChampMultiValeurs("Sites web");
695 gduche 461
		sites.setValeurParDefaut("http://");
729 jp_milcent 462
		sites.setValidation(Pattern.url, "http://www.monsite.com");
692 gduche 463
		fsContact.add(sites);
464
		hmIdentite.put("sites", sites);
1086 jpm 465
 
466
		right.add(fsContact);
467
 
468
		//+------------------------------------------------------------------------------------------------------------+
469
		// Fieldset AUTRES INFOS
676 gduche 470
		FieldSet fsAutresInfos = new FieldSet();
471
		fsAutresInfos.setHeading("Autres informations");
472
 
473
		formLayout = new FormLayout();
474
		formLayout.setLabelAlign(LabelAlign.LEFT);
475
		fsAutresInfos.setLayout(formLayout);
356 gduche 476
 
386 gduche 477
 
676 gduche 478
		formLayout = new FormLayout();
479
		formLayout.setLabelAlign(LabelAlign.TOP);
480
		LayoutContainer lcAutreInformations1 = new LayoutContainer(formLayout);
1086 jpm 481
 
676 gduche 482
		ListStore<Valeur> storeSexe = new ListStore<Valeur>();
483
		ComboBox<Valeur> cbSexe = new ComboBox<Valeur>();
484
		cbSexe.setStore(storeSexe);
485
		cbSexe.setFieldLabel("Sexe");
486
		cbSexe.setDisplayField("nom");
487
		cbSexe.setEmptyText("Choisissez le sexe:");
1101 gduche 488
		cbSexe.setTypeAhead(true);
489
		cbSexe.setTriggerAction(TriggerAction.ALL);
973 gduche 490
 
491
		FormData fd = new FormData();
492
		fd.setWidth(100);
493
		lcAutreInformations1.add(cbSexe, fd);
676 gduche 494
		hmIdentite.put("cbSexe", cbSexe);
386 gduche 495
 
676 gduche 496
		mediateur.obtenirListeValeurEtRafraichir(this, "sexe");
497
 
498
		//Description
499
		TextArea taDescription = new TextArea();
500
		taDescription.setEmptyText("Saisissez une description");
501
		taDescription.setFieldLabel("Description");
502
		taDescription.setWidth("100%");
503
		taDescription.setName("description");
504
 
1086 jpm 505
		lcAutreInformations1.add(taDescription, new FormData(500, 200));
676 gduche 506
		hmIdentite.put("taDescription", taDescription);
507
 
508
		fsAutresInfos.add(lcAutreInformations1);
509
 
510
		// Logo
689 gduche 511
		LayoutContainer lcLogoUrl = new LayoutContainer();
512
		hmIdentite.put("lcLogoUrl", lcLogoUrl);
676 gduche 513
 
875 jpm 514
		ChampMultiValeursImage logo = new ChampMultiValeursImage(i18nC.personneLogos());
701 gduche 515
		logo.setImageHeight("150px");
516
		logo.setValeurParDefaut("http://");
729 jp_milcent 517
		logo.setValidation(Pattern.url, "http://www.monsite.com/mon_image.jpg");
701 gduche 518
		logo.setValeurBoutonSupprimer("Supprimer");
519
		hmIdentite.put("logos", logo);
676 gduche 520
 
701 gduche 521
		lcLogoUrl.add(logo);
676 gduche 522
 
701 gduche 523
		fsAutresInfos.add(logo);
689 gduche 524
 
525
		LayoutContainer lcAutreInformations2 = new LayoutContainer(new ColumnLayout());
526
		hmIdentite.put("lcAutreInformations2", lcAutreInformations2);
676 gduche 527
		fsAutresInfos.add(lcAutreInformations2);
386 gduche 528
 
676 gduche 529
		right.add(fsAutresInfos);
1086 jpm 530
 
531
		//+------------------------------------------------------------------------------------------------------------+
676 gduche 532
		// Ajout des évènements saisi
533
		KeyListener klNoms = new KeyListener()	{
534
			public void componentKeyUp(ComponentEvent ev)	{
535
				rafraichir(null);
536
			}
537
		};
538
 
539
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
540
			public void selectionChanged(SelectionChangedEvent se) {
730 jp_milcent 541
				rafraichir(null);
542
			}
676 gduche 543
		};
283 gduche 544
 
676 gduche 545
		cbPrefixe.addSelectionChangedListener(selectionChange);
546
		cbPrefixe.addKeyListener(klNoms);
547
		tfPrenom.addKeyListener(klNoms);
548
		tfNom.addKeyListener(klNoms);
549
		cbSuffixe.addSelectionChangedListener(selectionChange);
276 gduche 550
 
551
	}
552
 
293 gduche 553
	public void creerComposantsAdresse()	{
554
		// Gauche
555
		LayoutContainer left = new LayoutContainer();
556
		left.setLayout(new FormLayout());
821 gduche 557
		left.setStyleAttribute("padding", "15px");
293 gduche 558
		// Droite
559
		LayoutContainer right = new LayoutContainer();
560
		right.setLayout(new FormLayout());
561
 
562
		// Principal
563
		LayoutContainer main = new LayoutContainer();
821 gduche 564
		main.setLayout(new TableLayout(2));
293 gduche 565
 
566
		// Ajout au principal
821 gduche 567
		main.add(left);
568
		main.add(right);
293 gduche 569
 
570
		TextField<String> tfAdresse1 = new TextField();
571
		tfAdresse1.setFieldLabel("Adresse");
376 gduche 572
		tfAdresse1.setName("adresse_01");
319 gduche 573
		left.add(tfAdresse1, fd100);
293 gduche 574
		hmAdresse.put("tfAdresse1", tfAdresse1);
575
 
576
		TextField<String> tfAdresse2 = new TextField();
577
		tfAdresse2.setFieldLabel("Complément d'adresse");
376 gduche 578
		tfAdresse2.setName("adresse_02");
319 gduche 579
		left.add(tfAdresse2, fd100);
293 gduche 580
		hmAdresse.put("tfAdresse2", tfAdresse2);
581
 
582
		ComboBox<Valeur> cbPays = new ComboBox<Valeur>();
583
		cbPays.setFieldLabel("Pays");
584
		cbPays.setDisplayField("nom");
585
		cbPays.setEmptyText("Sélectionnez le pays:");
586
 
587
		ListStore<Valeur> storePays = new ListStore<Valeur>();
588
		cbPays.setStore(storePays);
589
 
319 gduche 590
		right.add(cbPays, fd100);
293 gduche 591
		hmAdresse.put("cbPays", cbPays);
592
 
593
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
594
			public void selectionChanged(SelectionChangedEvent se) {
730 jp_milcent 595
				// Rafraichir avec le pays sélectionné
596
				obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
1036 gduche 597
				//mettreAJourRegion();
730 jp_milcent 598
			}
293 gduche 599
		};
1026 gduche 600
 
293 gduche 601
		cbPays.addSelectionChangedListener(selectionChange);
602
 
603
 
604
		ComboBox<Valeur> cbRegion = new ComboBox<Valeur>();
605
		cbRegion.setFieldLabel("Region");
606
		cbRegion.setDisplayField("nom");
607
		cbRegion.setEmptyText("Sélectionnez la région:");
608
		cbRegion.setVisible(false);
609
 
610
		ListStore<Valeur> storeRegion = new ListStore<Valeur>();
611
		cbRegion.setStore(storeRegion);
612
 
352 gduche 613
 
319 gduche 614
		right.add(cbRegion, fd100);
293 gduche 615
		hmAdresse.put("cbRegion", cbRegion);
616
 
617
		TextField<String> tfBoitePostale = new TextField<String>();
618
		tfBoitePostale.setFieldLabel("Boite postale");
376 gduche 619
		tfBoitePostale.setName("bp");
620
 
319 gduche 621
		left.add(tfBoitePostale, fd100);
293 gduche 622
		hmAdresse.put("tfBoitePostale", tfBoitePostale);
623
 
624
		TextField<Integer> tfCodePostal = new TextField<Integer>();
625
		tfCodePostal.setFieldLabel("Code postal");
376 gduche 626
		tfCodePostal.setName("code_postal");
627
 
319 gduche 628
		right.add(tfCodePostal, fd100);
293 gduche 629
		hmAdresse.put("tfCodePostal", tfCodePostal);
630
 
631
		TextField tfVille = new TextField();
632
		tfVille.setFieldLabel("Ville");
376 gduche 633
		tfVille.setName("ville");
293 gduche 634
 
319 gduche 635
		right.add(tfVille, fd100);
293 gduche 636
		hmAdresse.put("tfVille", tfVille);
637
 
638
		// MAJ ComboBox
639
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
640
 
304 gduche 641
		FieldSet fsAdresse = new FieldSet();
642
		fsAdresse.setHeading("Adresse personnelle");
643
		fsAdresse.add(main);
293 gduche 644
 
304 gduche 645
		tiAdresses.add(fsAdresse);
293 gduche 646
	}
821 gduche 647
 
648
	public void creerComposantsInfosNat()	{
338 gduche 649
 
979 gduche 650
		FormLayout fl = new FormLayout();
651
		fl.setLabelAlign(LabelAlign.TOP);
821 gduche 652
		FieldSet fsInfosNat = new FieldSet();
979 gduche 653
		fsInfosNat.setLayout(fl);
821 gduche 654
		fsInfosNat.setTitle("Informations Naturaliste");
1290 cyprien 655
 
979 gduche 656
		TextArea taBiographie = new TextArea();
657
		taBiographie.setFieldLabel("Vie et renommée de l'auteur");
658
		taBiographie.setWidth("400");
659
		taBiographie.setName("biographie");
1086 jpm 660
		fsInfosNat.add(taBiographie, new FormData(800, 200));
1290 cyprien 661
 
875 jpm 662
		ChampMultiValeurs specialite = new ChampMultiValeurs(i18nC.personneSpecialite());
821 gduche 663
		fsInfosNat.add(specialite);
664
		hmInfosNat.put("specialite", specialite);
1290 cyprien 665
 
666
		ModelType typeTypes = new ModelType();
667
		typeTypes.setRoot("valeurs");
668
		typeTypes.setTotalName("nbElements");
669
		typeTypes.addField("cmlv_nom");
670
		typeTypes.addField("cmlv_id_valeur");
671
		typeTypes.addField("cmlv_abreviation");
672
		typeTypes.addField("cmlv_description");
821 gduche 673
 
1290 cyprien 674
		String displayNameTypes = "cmlv_nom";
675
		String nomListeTypes = "pays";
676
		ProxyValeur<ModelData> proxyTypes = new ProxyValeur<ModelData>(nomListeTypes);
677
 
678
		ChampMultiValeursMultiTypesPaginable recolte = new ChampMultiValeursMultiTypesPaginable(i18nC.personneRecolte(), 450, false, null, null, null, typeTypes, proxyTypes, displayNameTypes);
679
 
821 gduche 680
		hmInfosNat.put("recolte", recolte);
681
		fsInfosNat.add(recolte);
682
		tiInfosNat.add(fsInfosNat);
683
	}
684
 
991 gduche 685
	public void creerComposantsPubli(){
686
		//Création des composants de l'onglet publication
687
 
688
		ContentPanel cp = new ContentPanel();
689
		cp.setHeading("Publications dont la personne est le sujet");
690
		cp.setIcon(Images.ICONES.table());
691
		cp.setLayout(new FitLayout());
692
		cp.setFrame(true);
693
 
694
		ToolBar toolBar = new ToolBar();
695
 
696
		Button ajouterPubli = new Button("Ajouter");
697
		ajouterPubli.setIcon(Images.ICONES.vcardAjouter());
698
		ajouterPubli.addSelectionListener(new SelectionListener<ButtonEvent>() {
699
			@Override
700
			public void componentSelected(ButtonEvent ce) {
701
				/*StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
702
				ajouterMembreAGrillePersonnel(membreDuPersonnel);*/
703
			}
704
		});
705
		toolBar.add(ajouterPubli);
706
 
707
		toolBar.add(new SeparatorToolItem());
708
 
709
		Button supprimerPubli = new Button("Supprimer");
710
		supprimerPubli.setIcon(Images.ICONES.vcardSupprimer());
711
		supprimerPubli.addSelectionListener(new SelectionListener<ButtonEvent>() {
712
			@Override
713
			public void componentSelected(ButtonEvent ce) {
714
				/*StructureAPersonne personne = grillePersonnel.getSelectionModel().getSelectedItem();
715
				if (personne != null) {
716
					// Ajout de la personne supprimée à la liste
717
					if (personne.getIdPersonne() != null && !personne.getIdPersonne().equals("")) {
718
						personnelSupprime.put(personne.getId(), personne);
719
					}
720
 
721
					// Suppression de l'enregistrement de la grille
722
					grillePersonnel.getStore().remove(personne);
723
 
724
					// Désactivation du bouton supprimer si la grille contient plus d'élément
725
					if (grillePersonnel.getStore().getCount() == 0) {
726
						//TODO : check : Item -> component
727
						ce.getComponent().disable();
728
					}
729
				}*/
730
				Window.alert("supprimer");
731
			}
732
		});
733
		toolBar.add(supprimerPubli);
734
 
735
		toolBar.add(new SeparatorToolItem());
736
 
737
		Button rafraichirPersonnelBtn = new Button("Rafraichir");
738
		rafraichirPersonnelBtn.setIcon(Images.ICONES.rafraichir());
739
		rafraichirPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
740
			@Override
741
			public void componentSelected(ButtonEvent ce) {
742
				//rafraichirPersonnel();
743
				Window.alert("rafraichir");
744
			}
745
		});
746
		toolBar.add(rafraichirPersonnelBtn);
747
 
748
		//Ajout d'une ComboBox
749
		storePubli = new ListStore<Publication>();
750
		storePubli.add(new ArrayList<Publication>());
751
 
752
		cbPubli = new ComboBox<Publication>();
753
		cbPubli.setWidth(200);
754
		cbPubli.setEmptyText("Chercher une publication existante...");
755
		cbPubli.setTriggerAction(TriggerAction.ALL);
756
		cbPubli.setEditable(true);
757
		cbPubli.setDisplayField("fmt_nom_complet");
758
		cbPubli.setStore(storePubli);
759
		cbPubli.addKeyListener(new KeyListener() {
760
 
761
			public void componentKeyUp(ComponentEvent ce) {
762
				if (!ce.isNavKeyPress() && cbPubli.getRawValue() != null && cbPubli.getRawValue().length() > 0) {
763
					rafraichirPublicationsExistante(cbPubli.getRawValue());
764
				}
765
			}
766
 
767
		});
768
 
769
		toolBar.add(cbPubli);
770
		toolBar.add(new SeparatorToolItem());
771
		cp.setTopComponent(toolBar);
772
 
773
 
774
		tiPubli.add(cp);
775
	}
776
 
1255 cyprien 777
	public void rafraichirPublicationsExistante(String nomPubli)	{
991 gduche 778
		nomPubli +="%";
779
		mediateur.selectionnerPublicationParNomComplet(this, null, nomPubli);
780
	}
781
 
276 gduche 782
	/**
783
	 * Ajouter le bouton annuler à la barre d'outils donnée
784
	 *
785
	 * @param barreOutils la barre d'outils à modifier
786
	 * */
356 gduche 787
	public static void ajouterBoutonAnnuler(ButtonBar barreOutils)	{
276 gduche 788
 
789
		// Le bouton annuler ne sauvegarde pas les informations et renvoie vers la page précédente
356 gduche 790
		Button annuler = new Button("Revenir à la liste");
488 gduche 791
		annuler.addSelectionListener(new SelectionListener<ButtonEvent>() {
792
			public void componentSelected(ButtonEvent ce) {
276 gduche 793
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicMenu("Personnes");
794
			}
795
		});
796
		annuler.setIconStyle(ComposantClass.ICONE_SUPPRIMER);
797
		barreOutils.add(annuler);
798
	}
799
 
293 gduche 800
	public void obtenirListeRegionParPays(String strPays)	{
801
		mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
802
	}
276 gduche 803
 
730 jp_milcent 804
	// RAFRAICHISSEMENT DU PANNEAU
805
 
283 gduche 806
	public void rafraichir(Object nouvellesDonnees) {
1290 cyprien 807
 
1255 cyprien 808
		if (nouvellesDonnees instanceof PublicationAPersonneListe)	{
991 gduche 809
			Information info = new Information();
810
			info.setType("publication_liees");
811
			info.setDonnee(0, (PublicationAPersonneListe) nouvellesDonnees);
812
			tiPubli.rafraichir(info);
1014 gduche 813
 
1290 cyprien 814
		} else if (nouvellesDonnees instanceof ValeurListe) {
283 gduche 815
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
816
			// Créer une liste de valeurs
817
			List<Valeur> liste = new ArrayList<Valeur>();
818
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
819
				liste.add(listeValeurs.get(it.next()));
820
			}
1014 gduche 821
			if (listeValeurs.getId().equals(config.getListeId("relationPersonnePublication")))	{
1255 cyprien 822
				tiPubli.rafraichir(nouvellesDonnees);
1014 gduche 823
			} else if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
319 gduche 824
				remplirCombobox("cbPrefixe", liste, "hmIdentite");
293 gduche 825
			} else if (listeValeurs.getId().equals(config.getListeId("suffixes"))) {
826
				remplirCombobox("cbSuffixe", liste, "hmIdentite");
827
			} else if (listeValeurs.getId().equals(config.getListeId("sexe"))) {
1101 gduche 828
 
829
				//Ajout de la valeur "Inconnu"
830
				ComboBox<Valeur> cbSexe = hmAdresse.getComboBoxValeur("cbSexe");
831
				Valeur inconnu = new Valeur();
832
				inconnu.set("nom", "Inconnu");
833
				inconnu.set("id", "0");
834
				liste.add(0, inconnu);
835
 
293 gduche 836
				remplirCombobox("cbSexe", liste, "hmIdentite");
1101 gduche 837
 
838
				/*List<Valeur> selection = new LinkedList<Valeur>();
839
				selection.add(inconnu);
840
				cbSexe.setSelection(s);*/
841
 
842
 
293 gduche 843
			} else if (listeValeurs.getId().equals(config.getListeId("tel"))) {
844
				remplirCombobox("cbTelephone", liste, "hmIdentite");
730 jp_milcent 845
 
319 gduche 846
				//Préselection du tél
973 gduche 847
				ComboBox<Valeur> cbTelephone = hmIdentite.getComboBoxValeur("cbTelephone");
319 gduche 848
				cbTelephone.setValue(liste.get(1));
293 gduche 849
			} else if (listeValeurs.getId().equals(config.getListeId("pays")))	{
850
				remplirCombobox("cbPays", liste, "hmAdresse");
851
			} else if (listeValeurs.getId().equals(config.getListeId("region")))	{
1290 cyprien 852
				remplirCombobox("cbRegion", liste, "hmAdresse");
1033 gduche 853
				mettreAJourRegion();
976 gduche 854
				hmAdresse.getComboBox("cbRegion").setVisible(true);
1026 gduche 855
 
283 gduche 856
			}
1255 cyprien 857
		} else if (nouvellesDonnees instanceof ProjetListe) {
456 gduche 858
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
730 jp_milcent 859
			List<Projet> liste = projets.toList();
973 gduche 860
			ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
456 gduche 861
			ListStore<Projet> storeProjets= cbProjets.getStore();
862
			storeProjets.removeAll();
863
			storeProjets.add(liste);
864
			cbProjets.setStore(storeProjets);
991 gduche 865
		} else if (nouvellesDonnees instanceof PublicationListe)	{
866
			PublicationListe publicationListe = (PublicationListe) nouvellesDonnees;
867
			List<Publication> liste = publicationListe.toList();
868
			storePubli.removeAll();
869
			storePubli.add(liste);
870
			cbPubli.setStore(storePubli);
1255 cyprien 871
		} else if (nouvellesDonnees instanceof Information)	{
352 gduche 872
			Information info = (Information) nouvellesDonnees;
386 gduche 873
			if (info.getType().equals("ajout_personne"))	{
884 jpm 874
				if (info.getDonnee(0) != null) {
875
					personneSelectionnee.setId(info.getDonnee(0).toString());
876
					GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
1326 cyprien 877
					this.personne = personneSelectionnee;
878
					this.personneId = personneSelectionnee.getId();
1218 cyprien 879
					InfoLogger.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
884 jpm 880
					repandreRafraichissement();
881
					if (clicBoutonvalidation)	{
882
						mediateur.clicMenu(menuIdCourant);
883
					}
884
				} else {
1218 cyprien 885
					InfoLogger.display("Enregistrement", info.getMessages().toString());
852 gduche 886
				}
433 gduche 887
			} else if (info.getType().equals("modification_personne"))	{
1218 cyprien 888
				InfoLogger.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
884 jpm 889
				repandreRafraichissement();
852 gduche 890
				if (clicBoutonvalidation)	{
891
					mediateur.clicMenu(menuIdCourant);
892
				}
884 jpm 893
			} else if (info.getType().equals("maj_utilisateur"))	{
668 gduche 894
				gererEtatActivationBouton();
386 gduche 895
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
776 gduche 896
 
730 jp_milcent 897
				Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
898
				Iterator itPersonneListe = colPersonneListe.iterator();
899
				Personne personne = (Personne) itPersonneListe.next();
900
 
991 gduche 901
				//TODO : Je vois pas l'intérêt des lignes ci dessous..
730 jp_milcent 902
				personneSauvegarde = new Personne();
903
				personneSauvegarde = (Personne) personne.cloner(personneSauvegarde);
904
 
905
				binderPersonne(personne);
906
 
776 gduche 907
				mettreAJourPersonne(personne);
730 jp_milcent 908
 
1326 cyprien 909
				this.personne = personne;
910
				this.personneId = personne.getId();
911
 
730 jp_milcent 912
				nouvellesDonnees = null;
913
			} else {
1218 cyprien 914
				InfoLogger.display("messages", info.getMessages().toString());
730 jp_milcent 915
			}
776 gduche 916
		}
283 gduche 917
 
1255 cyprien 918
		if (nouvellesDonnees == null) {
973 gduche 919
			ComboBox<Valeur> cb= hmIdentite.getComboBoxValeur("cbPrefixe");
293 gduche 920
 
921
			//Met à jour le nom Complet du formulaire
283 gduche 922
			String valeurRetour = "";
923
 
924
			// Prefixe
925
			String prefixe = "";
973 gduche 926
			Valeur valPrefixe = cb.getValue();
283 gduche 927
 
928
			if (valPrefixe != null)	{
929
				prefixe = valPrefixe.getNom();
293 gduche 930
			} else 	{
973 gduche 931
				prefixe =  (String) cb.getRawValue();
293 gduche 932
			}
283 gduche 933
 
934
			// Prénom
973 gduche 935
			String prenom = (String) hmIdentite.getTextField("tfPrenom").getValue();
283 gduche 936
 
937
			// Nom
973 gduche 938
			String nom = (String) hmIdentite.getTextField("tfNom").getValue();
283 gduche 939
 
940
			// Suffixe
973 gduche 941
			ComboBox<Valeur> cbSuffixe = hmIdentite.getComboBoxValeur("cbSuffixe");
942
 
283 gduche 943
			String suffixe = "";
973 gduche 944
			Valeur valSuffixe = cbSuffixe.getValue();
283 gduche 945
 
946
			if (valSuffixe != null)	{
947
				suffixe = valSuffixe.getNom();
293 gduche 948
			} else 	{
973 gduche 949
				suffixe =  (String) cbSuffixe.getRawValue();
283 gduche 950
			}
951
 
952
			// Mettre à jour la valeur
953
			valeurRetour = prefixe + " " + prenom + " " + nom + " " + suffixe;
954
			valeurRetour = valeurRetour.replaceAll("null", "");
955
 
973 gduche 956
			hmIdentite.getLabelField("nomComplet").setValue(valeurRetour);
283 gduche 957
 
958
			if (!valeurRetour.trim().equals(""))	{
973 gduche 959
				hmIdentite.getLabelField("nomComplet").show();
283 gduche 960
			} else {
973 gduche 961
				hmIdentite.getLabelField("nomComplet").hide();
283 gduche 962
			}
963
		}
338 gduche 964
 
965
		mediateur.masquerPopinChargement();
456 gduche 966
 
461 gduche 967
		if (this.mode.equals(MODE_AJOUTER))	{
668 gduche 968
			gererEtatActivationBouton();
1255 cyprien 969
		}
127 gduche 970
	}
971
 
1255 cyprien 972
	private void repandreRafraichissement() {
884 jpm 973
		if (vueExterneARafraichirApresValidation != null) {
974
			String type = "personne_modifiee";
975
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
976
				type = "personne_ajoutee";
977
			}
978
			Information info = new Information(type);
979
			info.setDonnee(0, personneSelectionnee);
980
			vueExterneARafraichirApresValidation.rafraichir(info);
981
		}
982
	}
983
 
1026 gduche 984
	private void mettreAJourRegion()	{
1033 gduche 985
		//Met à jour la combo box en sélectionnant la valeur enregistrée pour la personne
1026 gduche 986
		ComboBox<Valeur> cbRegion = hmAdresse.getComboBoxValeur("cbRegion");
1036 gduche 987
		if (personneSelectionnee.get("ce_truk_region").toString().startsWith("AUTRE##")) {
988
			cbRegion.setRawValue(personneSelectionnee.get("ce_truk_region").toString().replaceFirst("^AUTRE##", ""));
989
		} else if (personneSelectionnee.get("ce_truk_region") != null && cbRegion.getStore().getCount() > 0)	{
1026 gduche 990
			Valeur valeurRegion = cbRegion.getStore().findModel("id_valeur", personneSelectionnee.get("ce_truk_region"));
991
			if (valeurRegion!=null)	{
992
				cbRegion.setValue(valeurRegion);
993
			}
994
		}
995
	}
1036 gduche 996
 
776 gduche 997
	private void mettreAJourPersonne(Personne personne)	{
1290 cyprien 998
 
1327 cyprien 999
		//Mise à jour de la personne
1000
		ChampComboBoxRechercheTempsReelPaginable cbProjets = hmIdentite.getComboBoxRechercheTempsReelPaginable("cbProjets");
1001
		cbProjets.getCombo().setValue(cbProjets.getStore().findModel("cpr_id_projet", personne.get("ce_projet")));
776 gduche 1002
 
1003
		//Prefixe
1004
		String prefixe = personne.get("ce_truk_prefix");
973 gduche 1005
		ComboBox<Valeur> cbPrefixe = hmIdentite.getComboBoxValeur("cbPrefixe");
776 gduche 1006
 
1007
 
1008
		String prefixeCourant = personne.get("ce_truk_prefix");
1009
		if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
1010
			cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
1011
		}	else	{
1012
			cbPrefixe.setRawValue(prefixeCourant);
1013
		}
1014
 
973 gduche 1015
		hmIdentite.getTextField("tfPrenom").setValue(personne.get("prenom"));
1016
		hmIdentite.getTextField("tfNom").setValue(personne.get("nom"));
776 gduche 1017
 
1018
		//Suffixe
1019
		String suffixe = personne.get("ce_truk_suffixe");
973 gduche 1020
		ComboBox<Valeur> cbSuffixe = hmIdentite.getComboBoxValeur("cbSuffixe");
776 gduche 1021
 
1022
		String suffixeCourant = personne.get("ce_truk_suffix");
1023
		if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
1024
			cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
1025
		}	else	{
1026
			cbSuffixe.setRawValue(suffixeCourant);
1027
		}
1028
 
973 gduche 1029
		hmIdentite.getChampMultiValeurs("nomAutre").peupler(personne.getString("truk_nom_autre"));
1030
		hmIdentite.getTextField("tfAbreviation").setValue(personne.get("abreviation"));
1031
		hmIdentite.getChampMultiValeurs("abreviationAutre").peupler(personne.getString("truk_abreviation_autre"));
776 gduche 1032
 
1269 jpm 1033
		hmIdentite.getTextField("tfDateNaissance").setValue(personne.getAnneeOuDateNaiss());
973 gduche 1034
		hmIdentite.getTextField("tfLieuNaissance").setValue(personne.get("naissance_lieu"));
776 gduche 1035
 
1187 gduche 1036
 
829 gduche 1037
		if (personne.estDecedee())	{
1269 jpm 1038
			hmIdentite.getTextField("tfDateDeces").setValue(personne.getAnneeOuDateDeces());
973 gduche 1039
			hmIdentite.getTextField("tfLieuDeces").setValue(personne.get("deces_lieu"));
1040
			Radio rbEstDecede = hmIdentite.getRadio("rbEstDecedee");
829 gduche 1041
			rbEstDecede.setValue(true);
1042
		}
776 gduche 1043
 
973 gduche 1044
		hmIdentite.getChampMultiValeurs("telephones").peupler(personne.getString("truk_telephone"));
776 gduche 1045
 
1046
		//Courriel
973 gduche 1047
		hmIdentite.getChampMultiValeurs("courriels").peupler(personne.getCourriel());
776 gduche 1048
 
1049
		//Sites web
973 gduche 1050
		hmIdentite.getChampMultiValeurs("sites").peupler(personne.getString("truk_url"));
776 gduche 1051
 
1052
		// Sexe
1053
		String strSexe = personne.get("ce_sexe");
973 gduche 1054
		ComboBox<Valeur> cbSexe = hmIdentite.getComboBoxValeur("cbSexe");
776 gduche 1055
 
1056
		if (cbSexe.getStore().findModel("id_valeur", strSexe) != null)	{
1057
			cbSexe.setValue(cbSexe.getStore().findModel("id_valeur", strSexe));
1058
		}
1059
 
973 gduche 1060
		hmIdentite.getTextArea("taDescription").setRawValue((String) personne.get("description"));
776 gduche 1061
 
1062
		//Logo
973 gduche 1063
		hmIdentite.getChampMultiValeurs("logos").peupler(personne.getString("truk_logo"));
776 gduche 1064
 
1065
		/*--------------------------------------------------
1066
		                      Adresse
1067
		 ---------------------------------------------------*/
1068
 
1069
		// Adresse
976 gduche 1070
		hmAdresse.getTextField("tfAdresse1").setValue((String) personne.get("adresse_01"));
776 gduche 1071
 
1072
		// Complément
976 gduche 1073
		hmAdresse.getTextField("tfAdresse2").setValue((String) personne.get("adresse_02"));
776 gduche 1074
 
1075
		//Boite postale
976 gduche 1076
		hmAdresse.getTextField("tfBoitePostale").setValue((String) personne.get("bp"));
776 gduche 1077
 
1078
		//Pays
1026 gduche 1079
		String strPays = personne.get("ce_truk_pays");
976 gduche 1080
		ComboBox<Valeur> cbPays = hmAdresse.getComboBoxValeur("cbPays");
1290 cyprien 1081
		cbPays.getStore().sort("nom", SortDir.ASC);
1082
 
1026 gduche 1083
		if (cbPays.getStore().findModel("id_valeur", strPays) != null)	{
1084
			cbPays.setValue(cbPays.getStore().findModel("id_valeur", strPays));
1085
			cbPays.fireEvent(Events.OnChange);
776 gduche 1086
		}	else	{
1087
			cbPays.setRawValue(strPays);
1088
		}
1089
 
1026 gduche 1090
		//Région : doit être chargé après chargement de la liste des régions...
1091
		String strRegion = personne.get("ce_truk_region");
1092
 
776 gduche 1093
		if ((strRegion!=null)&&(!strRegion.equals("")))	{
976 gduche 1094
			ComboBox<Valeur> cbRegion = hmAdresse.getComboBoxValeur("cbRegion");
776 gduche 1095
			cbRegion.setVisible(true);
1096
 
1026 gduche 1097
			if (cbRegion.getStore().findModel("id_valeur", strRegion) != null)	{
1098
				cbRegion.setValue(cbRegion.getStore().findModel("id_valeur", strRegion));
776 gduche 1099
			}	else	{
1100
				cbRegion.setRawValue(strRegion);
1101
			}
1102
		}
1103
 
1104
		//Cp
976 gduche 1105
		hmAdresse.getTextField("tfCodePostal").setValue(personne.get("code_postal"));
776 gduche 1106
 
1107
		//Ville
976 gduche 1108
		hmAdresse.getTextField("tfVille").setValue(personne.get("ville"));
776 gduche 1109
 
821 gduche 1110
		/*--------------------------------------------------------
1111
		 * 					Infos naturalistes
1112
		 * -----------------------------------------------------*/
1113
 
979 gduche 1114
		hmInfosNat.getChampMultiValeurs("specialite").peupler(personne.getString("ce_truk_specialite"));
1290 cyprien 1115
		String tr = personne.getString("truk_recolte");
1116
		hmInfosNat.getChampMultiValeursMultiTypesPaginable("recolte").peupler(tr);
991 gduche 1117
 
1255 cyprien 1118
		//Onglet publi
991 gduche 1119
		tiPubli.mettreAJourPersonne();
776 gduche 1120
		gererEtatActivationBouton();
1121
	}
730 jp_milcent 1122
 
293 gduche 1123
	public void remplirCombobox(String idComboBox, List liste, String hashMapId)	{
1124
		HashMap hm = null;
1125
		if (hashMapId.equals("hmIdentite"))	{
1126
			hm = hmIdentite;
1127
		} else if (hashMapId.equals("hmAdresse")){
1128
			hm = hmAdresse;
1129
		} else {
1130
			hm = hmInfosNat;
1131
		}
1132
 
1133
		ListStore<Valeur> store = ((ComboBox) hm.get(idComboBox)).getStore();
376 gduche 1134
 
293 gduche 1135
		store.removeAll();
1136
		store.add(liste);
1137
		((ComboBox) hm.get(idComboBox)).setStore(store);
1138
	}
130 gduche 1139
 
668 gduche 1140
	private void gererEtatActivationBouton()	{
850 gduche 1141
	/*	if (((Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT)).isIdentifie() == false)	{
668 gduche 1142
			enregistrer.setEnabled(false);
1143
			enregistrerEtRevenir.setEnabled(false);
1144
		} else	{
1145
			enregistrer.setEnabled(true);
1146
			enregistrerEtRevenir.setEnabled(true);
850 gduche 1147
		}*/
668 gduche 1148
	}
1149
 
850 gduche 1150
	public void reinitialiserFormulaire()	{
461 gduche 1151
		mediateur.afficherPopinChargement();
776 gduche 1152
		mettreAJourPersonne(personneSauvegarde);
376 gduche 1153
		mediateur.masquerPopinChargement();
1154
	}
1290 cyprien 1155
 
376 gduche 1156
	public void binderPersonne(Personne personne)	{
850 gduche 1157
		binding = new FormBinding(getFormulaire());
731 jp_milcent 1158
 
376 gduche 1159
		personneSelectionnee = personne;
1187 gduche 1160
 
1161
		FieldBinding f = new FieldBinding((RadioGroup) hmIdentite.get("rbgDeces"), null);
376 gduche 1162
		binding.autoBind();
1187 gduche 1163
		binding.removeFieldBinding(f);
1164
 
376 gduche 1165
		binding.bind(personneSelectionnee);
1166
		layout();
1167
	}
1290 cyprien 1168
 
376 gduche 1169
	private String obtenirValeurCombo(String strComboName)	{
1170
		String strValeur = "";
1171
		Valeur valeur;
1172
 
973 gduche 1173
		ComboBox<Valeur> combo = hmIdentite.getComboBoxValeur(strComboName);
376 gduche 1174
		if (combo == null)	{
976 gduche 1175
			combo = hmAdresse.getComboBoxValeur(strComboName);
376 gduche 1176
		}
829 gduche 1177
		strValeur = combo.getRawValue();
1026 gduche 1178
		valeur = combo.getValue();
829 gduche 1179
		if (valeur != null)	{
1180
			strValeur = valeur.getId();
1181
		}
1182
 
376 gduche 1183
		return strValeur;
1184
	}
850 gduche 1185
 
934 jpm 1186
	public boolean soumettreFormulaire() {
1014 gduche 1187
		tiPubli.collecter();
850 gduche 1188
		if (verifierFormulaire())	{
991 gduche 1189
			tiPubli.soumettre();
850 gduche 1190
			mediateur.enregistrerPersonne(this, personneSelectionnee);
1261 cyprien 1191
			return true;
850 gduche 1192
		}
1261 cyprien 1193
		else return false;
850 gduche 1194
	}
1195
 
934 jpm 1196
	public boolean verifierFormulaire() {
884 jpm 1197
		boolean success = true;
1198
		LinkedList<String> lstMessageErreur = new LinkedList<String>();
850 gduche 1199
 
1327 cyprien 1200
		ChampComboBoxRechercheTempsReelPaginable cbProjets = hmIdentite.getComboBoxRechercheTempsReelPaginable("cbProjets");
1201
		if (cbProjets.getValeur() == null)	{
850 gduche 1202
			lstMessageErreur.add("Le projet n'a pas été renseigné");
1203
		} else {
1327 cyprien 1204
			Projet projet = new Projet(cbProjets.getValeur());
850 gduche 1205
			personneSelectionnee.set("ce_projet", projet.getId());
1206
		}
1207
 
973 gduche 1208
		String strTfNom = (String) hmIdentite.getTextField("tfNom").getValue();
850 gduche 1209
		if ((strTfNom == null)||(strTfNom.trim().equals("")))	{
1210
			lstMessageErreur.add("Le nom n'a pas été saisi");
1211
		} else {
1212
			strTfNom = UtilString.ucFirst(strTfNom);
1213
			personneSelectionnee.set("nom", strTfNom);
1214
		}
1215
 
973 gduche 1216
		String strTfPrenom = (String) hmIdentite.getTextField("tfPrenom").getValue();
850 gduche 1217
		personneSelectionnee.set("prenom", UtilString.ucFirst(strTfPrenom));
1218
 
1219
		//Préparer les données
973 gduche 1220
		ComboBox<Valeur> combo = hmIdentite.getComboBoxValeur("cbSexe");
850 gduche 1221
		Valeur valeur;
1222
		String strValeur = "";
1223
 
973 gduche 1224
		valeur = combo.getValue();
850 gduche 1225
		if (valeur!=null)	{
1226
			personneSelectionnee.set("ce_sexe", valeur.getId());
1227
		}
1228
 
1229
		strValeur = obtenirValeurCombo("cbPrefixe");
1230
		personneSelectionnee.set("ce_truk_prefix", strValeur);
1231
 
1232
		strValeur = obtenirValeurCombo("cbSuffixe");
1233
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1234
 
973 gduche 1235
		String nomAutre = hmIdentite.getChampMultiValeurs("nomAutre").getValeurs();
850 gduche 1236
		personneSelectionnee.set("truk_nom_autre", nomAutre);
1237
 
973 gduche 1238
		String abreviationAutre = hmIdentite.getChampMultiValeurs("abreviationAutre").getValeurs();
850 gduche 1239
		personneSelectionnee.set("truk_abreviation_autre", abreviationAutre);
1240
 
973 gduche 1241
		personneSelectionnee.set("truk_courriel", hmIdentite.getChampMultiValeurs("courriels").getValeurs());
850 gduche 1242
 
1243
 
1244
		//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
1245
		String strPrefixe = "";
973 gduche 1246
		combo = hmIdentite.getComboBoxValeur("cbPrefixe");
1247
		valeur = combo.getValue();
850 gduche 1248
		if (valeur != null)	{
1249
			strPrefixe = valeur.getNom();
1250
		} else {
1251
			strPrefixe = combo.getRawValue();
1252
		}
1253
 
1254
		String strSuffixe = "";
973 gduche 1255
		combo = hmIdentite.getComboBox("cbSuffixe");
1256
		valeur = combo.getValue();
850 gduche 1257
		if (valeur != null)	{
1258
			strSuffixe = valeur.getNom() + " ";
1259
		} else {
1260
			strSuffixe = combo.getRawValue() +" ";
1261
		}
1262
 
1263
		personneSelectionnee.setFmtNomComplet(strPrefixe, strSuffixe);
1309 cyprien 1264
 
1265
		/** NAISSANCE **/
1269 jpm 1266
		String valeurDateNaissance = (String) hmIdentite.getTextField("tfDateNaissance").getValue();
1309 cyprien 1267
		traiterDate("naissance", valeurDateNaissance, personneSelectionnee, lstMessageErreur);
850 gduche 1268
 
1309 cyprien 1269
		/** DECES **/
973 gduche 1270
		Radio rbEstDecedee = hmIdentite.getRadio("rbEstDecedee");
1309 cyprien 1271
		if (rbEstDecedee.getValue() == true) {
1272
			// date
1343 cyprien 1273
			String valeurDateDeces = (String) hmIdentite.getTextField("tfDateDeces").getValue();
1309 cyprien 1274
			traiterDate("décès", valeurDateDeces, personneSelectionnee, lstMessageErreur);
1275
			// lieu
973 gduche 1276
			String decesLieu = (String) hmIdentite.getTextField("tfLieuDeces").getValue();
1309 cyprien 1277
			personneSelectionnee.setDecesLieu(decesLieu);
1278
		} else {
850 gduche 1279
			personneSelectionnee.setNonDecedee();
1280
		}
1281
 
1290 cyprien 1282
		strValeur = obtenirValeurCombo("cbPays");
850 gduche 1283
		personneSelectionnee.set("ce_truk_pays", strValeur);
1284
 
1026 gduche 1285
		strValeur = obtenirValeurCombo("cbRegion");
1036 gduche 1286
		ComboBox<Valeur> cbRegions = hmAdresse.getComboBoxValeur("cbRegion");
1290 cyprien 1287
 
1288
		if (cbRegions.getStore().findModel("id_valeur", strValeur) == null)	{
1036 gduche 1289
			strValeur = "AUTRE##" + strValeur;
1290
		}
850 gduche 1291
		personneSelectionnee.set("ce_truk_region", strValeur);
1292
 
973 gduche 1293
		personneSelectionnee.set("truk_telephone", hmIdentite.getChampMultiValeursMultiTypes("telephones").getValeurs());
850 gduche 1294
 
973 gduche 1295
		String logoUrls = hmIdentite.getChampMultiValeursImage("logos").getValeurs();
850 gduche 1296
		personneSelectionnee.set("truk_logo", logoUrls);
1297
 
973 gduche 1298
		personneSelectionnee.set("truk_url", hmIdentite.getChampMultiValeurs("sites").getValeurs());
850 gduche 1299
 
1300
		//Infos Naturalistes
1290 cyprien 1301
		String recolte = ((ChampMultiValeursMultiTypesPaginable) hmInfosNat.get("recolte")).getValeurs();
850 gduche 1302
		personneSelectionnee.set("truk_recolte", recolte);
1303
 
1304
		String specialite = ((ChampMultiValeurs) hmInfosNat.get("specialite")).getValeurs();
1305
		personneSelectionnee.set("ce_truk_specialite", specialite);
1306
 
1014 gduche 1307
		lstMessageErreur.addAll(tiPubli.verifier());
850 gduche 1308
 
884 jpm 1309
		if (lstMessageErreur.size() != 0)	{
850 gduche 1310
			String strMessagesErreur = "<span><br />";
1311
			Iterator<String> itMessagesErreur = lstMessageErreur.iterator();
1312
			while (itMessagesErreur.hasNext())	{
1313
				strMessagesErreur += "<br /> - " + itMessagesErreur.next();
1314
			}
1315
			strMessagesErreur += "</span>";
1316
 
1317
 			MessageBox.alert("Erreurs", "Les erreurs suivantes ont été commises : \n" + strMessagesErreur, null);
1318
 			success = false;
1319
		}
1320
 
1321
		return success;
1322
	}
1309 cyprien 1323
 
1324
	private void traiterDate(String typeDate, String date, Personne personneSelectionnee, LinkedList<String> lstMessageErreur) {
1325
		String valeurDate = date;
1326
		if (!UtilString.isEmpty(valeurDate)){
1327
 
1328
			String jour = "";
1329
			String mois = "";
1330
			String annee = "";
1331
 
1332
			/**  JJ/MM/AAAA  **/
1333
			if (valeurDate.matches("\\d{2}/\\d{2}/\\d{4}")) {
1334
				jour = valeurDate.substring(0,2);
1335
				mois = valeurDate.substring(3,5);
1336
				annee = valeurDate.substring(6,10);
1337
				String dateComplete = annee+"-"+mois+"-"+jour;
1338
				if (jour == "00" || mois == "00" || annee == "0000") {
1339
					lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA.");
1340
				}
1341
				else {
1342
					if (typeDate=="naissance") {
1343
						Date naissanceDate = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDate);
1344
						personneSelectionnee.setNaissanceDate(naissanceDate);
1345
					} else if (typeDate=="décès") {
1346
						Date decesDate = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDate);
1347
						personneSelectionnee.setDecesDate(decesDate);
1343 cyprien 1348
						personneSelectionnee.set("ce_deces", personneSelectionnee.ETRE_DECEDE);
1309 cyprien 1349
					}
1350
				}
1351
 
1352
			/**  MM/AAAA  **/
1353
			} else if (valeurDate.matches("\\d{2}/\\d{4}")) {
1354
				jour = "00";
1355
				mois = valeurDate.substring(0,2);
1356
				annee = valeurDate.substring(3,7);
1357
				String dateComplete = annee+"-"+mois+"-"+jour;
1358
				if (mois == "00" || annee == "0000") {
1359
					lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA.");
1360
				}
1361
				else {
1362
					if (typeDate=="naissance") personneSelectionnee.set("naissance_date", dateComplete);
1363
					else if (typeDate=="décès") {
1364
						personneSelectionnee.set("deces_date", dateComplete);
1365
						personneSelectionnee.set("ce_deces", personneSelectionnee.ETRE_DECEDE);
1366
					}
1367
				}
1368
			}
1369
 
1370
			/**  AAAA  **/
1371
			else if (valeurDate.matches("\\d{4}"))	{
1372
				if (valeurDate == "0000") {
1373
					lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA.");
1374
				}
1375
				else {
1376
					if (typeDate=="naissance") personneSelectionnee.set("naissance_date", valeurDate + "-00-00");
1377
					else if (typeDate=="décès") {
1378
						personneSelectionnee.set("deces_date", valeurDate + "-00-00");
1379
						personneSelectionnee.set("ce_deces", personneSelectionnee.ETRE_DECEDE);
1380
					}
1381
				}
1382
			} else {
1383
				lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA.");
1384
			}
1385
		}
1386
	}
1326 cyprien 1387
 
1388
	public Personne getPersonne() {
1389
		return this.personne;
1390
	}
1391
 
1392
	public String getPersonneId() {
1393
		return this.personneId;
1394
	}
127 gduche 1395
}