Subversion Repositories eFlore/Applications.coel

Rev

Rev 724 | Rev 729 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 724 Rev 726
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.Collection;
4
import java.util.Collection;
5
import java.util.Date;
5
import java.util.Date;
6
import java.util.HashMap;
6
import java.util.HashMap;
7
import java.util.Iterator;
7
import java.util.Iterator;
8
import java.util.LinkedList;
8
import java.util.LinkedList;
9
import java.util.List;
9
import java.util.List;
10
 
10
 
11
import org.tela_botanica.client.ComposantClass;
11
import org.tela_botanica.client.ComposantClass;
12
import org.tela_botanica.client.Mediateur;
12
import org.tela_botanica.client.Mediateur;
13
import org.tela_botanica.client.RegistreId;
13
import org.tela_botanica.client.RegistreId;
14
import org.tela_botanica.client.composants.ChampMultiValeurs;
14
import org.tela_botanica.client.composants.ChampMultiValeurs;
15
import org.tela_botanica.client.composants.ChampMultiValeursImage;
15
import org.tela_botanica.client.composants.ChampMultiValeursImage;
16
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
16
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
17
import org.tela_botanica.client.images.Images;
17
import org.tela_botanica.client.images.Images;
18
import org.tela_botanica.client.interfaces.Rafraichissable;
18
import org.tela_botanica.client.interfaces.Rafraichissable;
19
import org.tela_botanica.client.modeles.Configuration;
19
import org.tela_botanica.client.modeles.Configuration;
20
 
20
 
21
import org.tela_botanica.client.modeles.Information;
21
import org.tela_botanica.client.modeles.Information;
22
import org.tela_botanica.client.modeles.Personne;
22
import org.tela_botanica.client.modeles.Personne;
23
import org.tela_botanica.client.modeles.PersonneListe;
23
import org.tela_botanica.client.modeles.PersonneListe;
24
import org.tela_botanica.client.modeles.Projet;
24
import org.tela_botanica.client.modeles.Projet;
25
import org.tela_botanica.client.modeles.ProjetListe;
25
import org.tela_botanica.client.modeles.ProjetListe;
26
import org.tela_botanica.client.modeles.Utilisateur;
26
import org.tela_botanica.client.modeles.Utilisateur;
27
import org.tela_botanica.client.modeles.Valeur;
27
import org.tela_botanica.client.modeles.Valeur;
28
import org.tela_botanica.client.modeles.ValeurListe;
28
import org.tela_botanica.client.modeles.ValeurListe;
29
import org.tela_botanica.client.util.UtilString;
29
import org.tela_botanica.client.util.UtilString;
30
 
30
 
31
import com.extjs.gxt.ui.client.event.Events;
31
import com.extjs.gxt.ui.client.event.Events;
32
import com.extjs.gxt.ui.client.Registry;
32
import com.extjs.gxt.ui.client.Registry;
33
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
33
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
34
import com.extjs.gxt.ui.client.Style.IconAlign;
34
import com.extjs.gxt.ui.client.Style.IconAlign;
35
import com.extjs.gxt.ui.client.Style.Scroll;
35
import com.extjs.gxt.ui.client.Style.Scroll;
36
 
36
 
37
import com.extjs.gxt.ui.client.binding.FormBinding;
37
import com.extjs.gxt.ui.client.binding.FormBinding;
38
 
38
 
39
import com.extjs.gxt.ui.client.event.ButtonEvent;
39
import com.extjs.gxt.ui.client.event.ButtonEvent;
40
import com.extjs.gxt.ui.client.event.ComponentEvent;
40
import com.extjs.gxt.ui.client.event.ComponentEvent;
41
import com.extjs.gxt.ui.client.event.IconButtonEvent;
41
import com.extjs.gxt.ui.client.event.IconButtonEvent;
42
import com.extjs.gxt.ui.client.event.KeyListener;
42
import com.extjs.gxt.ui.client.event.KeyListener;
43
import com.extjs.gxt.ui.client.event.Listener;
43
import com.extjs.gxt.ui.client.event.Listener;
44
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
44
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
45
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
45
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
46
import com.extjs.gxt.ui.client.event.SelectionListener;
46
import com.extjs.gxt.ui.client.event.SelectionListener;
47
import com.extjs.gxt.ui.client.store.ListStore;
47
import com.extjs.gxt.ui.client.store.ListStore;
48
import com.extjs.gxt.ui.client.widget.LayoutContainer;
48
import com.extjs.gxt.ui.client.widget.LayoutContainer;
49
import com.extjs.gxt.ui.client.widget.MessageBox;
49
import com.extjs.gxt.ui.client.widget.MessageBox;
50
 
50
 
51
import com.extjs.gxt.ui.client.widget.Info;
51
import com.extjs.gxt.ui.client.widget.Info;
52
import com.extjs.gxt.ui.client.widget.TabItem;
52
import com.extjs.gxt.ui.client.widget.TabItem;
53
import com.extjs.gxt.ui.client.widget.TabPanel;
53
import com.extjs.gxt.ui.client.widget.TabPanel;
54
import com.extjs.gxt.ui.client.widget.Text;
54
import com.extjs.gxt.ui.client.widget.Text;
55
 
55
 
56
import com.extjs.gxt.ui.client.widget.button.Button;
56
import com.extjs.gxt.ui.client.widget.button.Button;
57
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
57
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
58
import com.extjs.gxt.ui.client.widget.form.ComboBox;
58
import com.extjs.gxt.ui.client.widget.form.ComboBox;
59
import com.extjs.gxt.ui.client.widget.form.DateField;
59
import com.extjs.gxt.ui.client.widget.form.DateField;
60
import com.extjs.gxt.ui.client.widget.form.FieldSet;
60
import com.extjs.gxt.ui.client.widget.form.FieldSet;
61
import com.extjs.gxt.ui.client.widget.form.FormPanel;
61
import com.extjs.gxt.ui.client.widget.form.FormPanel;
62
import com.extjs.gxt.ui.client.widget.form.HiddenField;
62
import com.extjs.gxt.ui.client.widget.form.HiddenField;
63
import com.extjs.gxt.ui.client.widget.form.LabelField;
63
import com.extjs.gxt.ui.client.widget.form.LabelField;
64
import com.extjs.gxt.ui.client.widget.form.Radio;
64
import com.extjs.gxt.ui.client.widget.form.Radio;
65
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
65
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
66
import com.extjs.gxt.ui.client.widget.form.TextArea;
66
import com.extjs.gxt.ui.client.widget.form.TextArea;
67
import com.extjs.gxt.ui.client.widget.form.TextField;
67
import com.extjs.gxt.ui.client.widget.form.TextField;
68
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
68
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
69
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
69
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
70
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
70
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
71
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
71
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
72
import com.extjs.gxt.ui.client.widget.layout.FormData;
72
import com.extjs.gxt.ui.client.widget.layout.FormData;
73
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
73
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
74
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
74
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
75
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
75
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
76
import com.google.gwt.core.client.GWT;
76
import com.google.gwt.core.client.GWT;
77
import com.google.gwt.i18n.client.DateTimeFormat;
77
import com.google.gwt.i18n.client.DateTimeFormat;
78
import com.google.gwt.user.client.ui.Image;
78
import com.google.gwt.user.client.ui.Image;
79
import com.google.gwt.user.client.ui.Widget;
79
import com.google.gwt.user.client.ui.Widget;
80
 
80
 
81
public class PersonneForm extends FormPanel implements Rafraichissable {
81
public class PersonneForm extends FormPanel implements Rafraichissable {
82
 
82
 
83
	/*--------------------------------------------------------------------------------------
83
	/*--------------------------------------------------------------------------------------
84
	 * 		VARIABLES
84
	 * 		VARIABLES
85
	 * -------------------------------------------------------------------------------------
85
	 * -------------------------------------------------------------------------------------
86
	 */
86
	 */
87
	
87
	
88
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
88
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
89
	private Mediateur mediateur = Registry.get(RegistreId.MEDIATEUR);
89
	private Mediateur mediateur = Registry.get(RegistreId.MEDIATEUR);
90
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
90
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
91
	private Personne personneSelectionnee, personneSauvegarde = null;
91
	private Personne personneSelectionnee, personneSauvegarde = null;
92
	private String mode = "";
92
	private String mode = "";
93
	
93
	
94
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
94
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
95
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
95
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
96
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
96
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
97
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
97
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
98
	private FormData fd100 = new FormData("1");
98
	private FormData fd100 = new FormData("1");
99
	
99
	
100
	private Button enregistrer, enregistrerEtRevenir;
100
	private Button enregistrer, enregistrerEtRevenir;
101
	
101
	
102
	public static final String MODE_AJOUTER = "AJOUT";
102
	public static final String MODE_AJOUTER = "AJOUT";
103
	public static final String MODE_MODIFIER = "MODIF";
103
	public static final String MODE_MODIFIER = "MODIF";
104
	
104
	
105
	
105
	
106
	private FormBinding binding = null;
106
	private FormBinding binding = null;
107
	
107
	
108
	/*--------------------------------------------------------------------------------------
108
	/*--------------------------------------------------------------------------------------
109
	 * 		CONSTRUCTEUR 
109
	 * 		CONSTRUCTEUR 
110
	 * -------------------------------------------------------------------------------------
110
	 * -------------------------------------------------------------------------------------
111
	 */
111
	 */
112
	
112
	
113
	/**
113
	/**
114
	 * Constructeur du panneau
114
	 * Constructeur du panneau
115
	 * 
115
	 * 
116
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le 
116
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le 
117
	 * formulaire et annuler la saisie). 
117
	 * formulaire et annuler la saisie). 
118
	 * 
118
	 * 
119
	 * */
119
	 * */
120
	public PersonneForm(String mode) {
120
	public PersonneForm(String mode) {
121
		this.mode = mode;
121
		this.mode = mode;
122
		initialiserComposants();
122
		initialiserComposants();
123
	}
123
	}
124
	
124
	
125
	public void initialiserComposants()	{
125
	public void initialiserComposants()	{
126
		
126
		
127
		personneSelectionnee = new Personne();
127
		personneSelectionnee = new Personne();
128
		personneSauvegarde = new Personne();
128
		personneSauvegarde = new Personne();
129
		
129
		
130
		initialiserPanneau();
130
		initialiserPanneau();
131
		
131
		
132
		ButtonBar barreOutilsBas = new ButtonBar();
132
		ButtonBar barreOutilsBas = new ButtonBar();
133
		//barreOutilsBas.setButtonAlign(HorizontalAlignment.CENTER);
133
		//barreOutilsBas.setButtonAlign(HorizontalAlignment.CENTER);
134
		barreOutilsBas.setAlignment(HorizontalAlignment.CENTER);
134
		barreOutilsBas.setAlignment(HorizontalAlignment.CENTER);
135
		
135
		
136
		ajouterBoutonEnregistrer(barreOutilsBas);
136
		ajouterBoutonEnregistrer(barreOutilsBas);
137
		ajouterBoutonEnregistrerEtRevenir(barreOutilsBas);
137
		ajouterBoutonEnregistrerEtRevenir(barreOutilsBas);
138
		ajouterBoutonAnnuler(barreOutilsBas);
138
		ajouterBoutonAnnuler(barreOutilsBas);
139
		gererEtatActivationBouton();
139
		gererEtatActivationBouton();
140
		
140
		
141
		setBottomComponent(barreOutilsBas);
141
		setBottomComponent(barreOutilsBas);
142
		
142
		
143
		ToolBar barreOutilsHaut = new ToolBar();
143
		ToolBar barreOutilsHaut = new ToolBar();
144
		ajouterBoutonReinitialiser(barreOutilsHaut);
144
		ajouterBoutonReinitialiser(barreOutilsHaut);
145
		setTopComponent(barreOutilsHaut);
145
		setTopComponent(barreOutilsHaut);
146
		
146
		
147
		initialiserOnglets();	
147
		initialiserOnglets();	
148
		
148
		
149
		creerComposantsIdentite();
149
		creerComposantsIdentite();
150
		creerComposantsAdresse();
150
		creerComposantsAdresse();
151
		
151
		
152
		layout();
152
		layout();
153
		
153
		
154
		binderPersonne(personneSelectionnee);
154
		binderPersonne(personneSelectionnee);
155
	}
155
	}
156
	
156
	
157
	/*---------------------------------------------------------------------------------------
157
	/*---------------------------------------------------------------------------------------
158
	 * 		SOUS-METHODES
158
	 * 		SOUS-METHODES
159
	 * --------------------------------------------------------------------------------------
159
	 * --------------------------------------------------------------------------------------
160
	 */
160
	 */
161
	/**
161
	/**
162
	 * Inialise le panneau donné
162
	 * Inialise le panneau donné
163
	 * 
163
	 * 
164
	 * @param contentPanel le panneau à initialiser
164
	 * @param contentPanel le panneau à initialiser
165
	 * */
165
	 * */
166
	public void initialiserPanneau()	{
166
	public void initialiserPanneau()	{
167
		
167
		
168
		setCollapsible(false);  
168
		setCollapsible(false);  
169
		if (this.mode.equals(MODE_AJOUTER))	{
169
		if (this.mode.equals(MODE_AJOUTER))	{
170
			setHeading(mediateur.i18nC.personneModeAjout());
170
			setHeading(mediateur.i18nC.personneModeAjout());
171
			setIcon(Images.ICONES.ajouter());
171
			setIcon(Images.ICONES.ajouter());
172
		} else 	{
172
		} else 	{
173
			setHeading(mediateur.i18nC.personneModeModifier());
173
			setHeading(mediateur.i18nC.personneModeModifier());
174
			setIcon(Images.ICONES.formModifier());
174
			setIcon(Images.ICONES.formModifier());
175
		}
175
		}
176
		setButtonAlign(HorizontalAlignment.CENTER);  
176
		setButtonAlign(HorizontalAlignment.CENTER);  
177
		setLayout(new FitLayout());
177
		setLayout(new FitLayout());
178
		setBodyBorder(false);
178
		setBodyBorder(false);
179
		setBorders(false);
179
		setBorders(false);
180
		setPadding(0);
180
		setPadding(0);
181
		setWidth("100%");
181
		setWidth("100%");
182
	
182
	
183
	}
183
	}
184
	
184
	
185
	/**
185
	/**
186
	 * Crée les onglets identité, adresse et informations naturaliste
186
	 * Crée les onglets identité, adresse et informations naturaliste
187
	 * 
187
	 * 
188
	 * */
188
	 * */
189
	public void initialiserOnglets()	{
189
	public void initialiserOnglets()	{
190
		//TabPanel
190
		//TabPanel
191
		TabPanel formulaireOnglets = new TabPanel();
191
		TabPanel formulaireOnglets = new TabPanel();
192
		
192
		
193
		//Tab 1 : identite
193
		//Tab 1 : identite
194
		tiIdentite = new TabItem(mediateur.i18nC.personneIdentite());
194
		tiIdentite = new TabItem(mediateur.i18nC.personneIdentite());
195
		tiIdentite.setLayout(new FormLayout());
195
		tiIdentite.setLayout(new FormLayout());
196
		tiIdentite.setScrollMode(Scroll.AUTO);
196
		tiIdentite.setScrollMode(Scroll.AUTO);
197
		
197
		
198
		formulaireOnglets.add(tiIdentite);
198
		formulaireOnglets.add(tiIdentite);
199
		hmIdentite.put("tiIdentite", tiIdentite);
199
		hmIdentite.put("tiIdentite", tiIdentite);
200
		
200
		
201
		//Tab 2 : Adresse
201
		//Tab 2 : Adresse
202
		tiAdresses = new TabItem(mediateur.i18nC.adresse());
202
		tiAdresses = new TabItem(mediateur.i18nC.adresse());
203
		tiAdresses.setLayout(new FormLayout());
203
		tiAdresses.setLayout(new FormLayout());
204
		tiAdresses.setScrollMode(Scroll.AUTO);
204
		tiAdresses.setScrollMode(Scroll.AUTO);
205
		
205
		
206
		formulaireOnglets.add(tiAdresses);
206
		formulaireOnglets.add(tiAdresses);
207
		
207
		
208
		//Tab 3 : Infos Naturalistes
208
		//Tab 3 : Infos Naturalistes
209
		tiInfosNat = new TabItem(mediateur.i18nC.personneInfoNat());
209
		tiInfosNat = new TabItem(mediateur.i18nC.personneInfoNat());
210
		tiInfosNat.setLayout(new FormLayout());
210
		tiInfosNat.setLayout(new FormLayout());
211
		tiInfosNat.setScrollMode(Scroll.AUTO);
211
		tiInfosNat.setScrollMode(Scroll.AUTO);
212
		
212
		
213
		formulaireOnglets.add(tiInfosNat);
213
		formulaireOnglets.add(tiInfosNat);
214
		add(formulaireOnglets);
214
		add(formulaireOnglets);
215
	}
215
	}
216
	
216
	
217
	/**
217
	/**
218
	 * Crée les widgets pour l'onglet identité
218
	 * Crée les widgets pour l'onglet identité
219
	 * 
219
	 * 
220
	 * */
220
	 * */
221
	
221
	
222
	
222
	
223
	public void creerComposantsIdentite()	{
223
	public void creerComposantsIdentite()	{
224
		
224
		
225
		// Gestion de l'affichage en colonnes : 3 Layout container : principal, gauche & droite
225
		// Gestion de l'affichage en colonnes : 3 Layout container : principal, gauche & droite
226
		LayoutContainer left = new LayoutContainer();
226
		LayoutContainer left = new LayoutContainer();
227
		left.setLayout(new FormLayout());
227
		left.setLayout(new FormLayout());
228
		LayoutContainer right = new LayoutContainer();
228
		LayoutContainer right = new LayoutContainer();
229
		right.setLayout(new FormLayout());
229
		right.setLayout(new FormLayout());
230
		
230
		
231
		LayoutContainer main = new LayoutContainer();
231
		LayoutContainer main = new LayoutContainer();
232
		
232
		
233
		main.add(left, new ColumnData(.45));
233
		main.add(left, new ColumnData(.45));
234
		main.add(right, new ColumnData(.45));
234
		main.add(right, new ColumnData(.45));
235
		
235
		
236
		main.setLayout(new ColumnLayout());
236
		main.setLayout(new ColumnLayout());
237
		main.setHeight("100%");
237
		main.setHeight("100%");
238
		main.setScrollMode(Scroll.AUTO);
238
		main.setScrollMode(Scroll.AUTO);
239
		
239
		
240
		// Création des champs
240
		// Création des champs
241
		FormLayout formLayout = new FormLayout();
241
		FormLayout formLayout = new FormLayout();
242
		formLayout.setLabelAlign(LabelAlign.LEFT);
242
		formLayout.setLabelAlign(LabelAlign.LEFT);
243
		
243
		
244
		FieldSet fsProjet = new FieldSet();
244
		FieldSet fsProjet = new FieldSet();
245
		fsProjet.setHeading(mediateur.i18nC.menuProjet());
245
		fsProjet.setHeading(mediateur.i18nC.menuProjet());
246
		fsProjet.setLayout(new FormLayout());
246
		fsProjet.setLayout(new FormLayout());
247
		
247
		
248
		ListStore<Projet> storeProjets = new ListStore<Projet>();
248
		ListStore<Projet> storeProjets = new ListStore<Projet>();
249
		ComboBox cbProjets = new ComboBox<Projet>();
249
		ComboBox cbProjets = new ComboBox<Projet>();
250
		cbProjets.setFieldLabel(mediateur.i18nC.personneProjet()+ " :");
250
		cbProjets.setFieldLabel(mediateur.i18nC.personneProjet()+ " :");
251
		cbProjets.setEmptyText(mediateur.i18nC.txtListeProjetDefaut());
251
		cbProjets.setEmptyText(mediateur.i18nC.txtListeProjetDefaut());
252
		cbProjets.setLabelSeparator("");
252
		cbProjets.setLabelSeparator("");
253
		cbProjets.setDisplayField("nom");
253
		cbProjets.setDisplayField("nom");
254
		cbProjets.setEditable(false);
254
		cbProjets.setEditable(false);
255
		cbProjets.setTriggerAction(TriggerAction.ALL);
255
		cbProjets.setTriggerAction(TriggerAction.ALL);
256
		cbProjets.setStore(storeProjets);
256
		cbProjets.setStore(storeProjets);
257
		cbProjets.setAllowBlank(false);
257
		cbProjets.setAllowBlank(false);
258
		fsProjet.add(cbProjets);
258
		fsProjet.add(cbProjets);
259
		
259
		
260
		hmIdentite.put("cbProjets", cbProjets);
260
		hmIdentite.put("cbProjets", cbProjets);
261
		
261
		
262
		mediateur.selectionnerProjets(this);
262
		mediateur.selectionnerProjets(this);
263
				
263
				
264
		left.add(fsProjet);
264
		left.add(fsProjet);
265
					
265
					
266
		FieldSet fsNoms = new FieldSet();
266
		FieldSet fsNoms = new FieldSet();
267
		fsNoms.setHeading("Noms");
267
		fsNoms.setHeading("Noms");
268
		fsNoms.setLayout(formLayout); 
268
		fsNoms.setLayout(formLayout); 
269
					
269
					
270
		// Nom complet : Affiché que si valeurs saisies
270
		// Nom complet : Affiché que si valeurs saisies
271
		LabelField nomComplet = new LabelField();
271
		LabelField nomComplet = new LabelField();
272
		nomComplet.setFieldLabel(mediateur.i18nC.personneNomComplet() +" :");
272
		nomComplet.setFieldLabel(mediateur.i18nC.personneNomComplet() +" :");
273
		nomComplet.hide();
273
		nomComplet.hide();
274
				
274
				
275
		fsNoms.add(nomComplet);
275
		fsNoms.add(nomComplet);
276
		hmIdentite.put("nomComplet", nomComplet);
276
		hmIdentite.put("nomComplet", nomComplet);
277
			
277
			
278
		//Préfixe
278
		//Préfixe
279
		ListStore<Valeur> storePrefixe = new ListStore<Valeur>();
279
		ListStore<Valeur> storePrefixe = new ListStore<Valeur>();
280
		ComboBox<Valeur> cbPrefixe = new ComboBox<Valeur>();
280
		ComboBox<Valeur> cbPrefixe = new ComboBox<Valeur>();
281
		cbPrefixe.setStore(storePrefixe);
281
		cbPrefixe.setStore(storePrefixe);
282
		cbPrefixe.setDisplayField("nom");
282
		cbPrefixe.setDisplayField("nom");
283
		cbPrefixe.setEmptyText("Choisissez le préfixe:");
283
		cbPrefixe.setEmptyText("Choisissez le préfixe:");
284
		cbPrefixe.setFieldLabel("Prefix");
284
		cbPrefixe.setFieldLabel("Prefix");
285
		
285
		
286
		fsNoms.add(cbPrefixe);
286
		fsNoms.add(cbPrefixe);
287
		hmIdentite.put("cbPrefixe", cbPrefixe);
287
		hmIdentite.put("cbPrefixe", cbPrefixe);
288
		
288
		
289
		mediateur.obtenirListeValeurEtRafraichir(this, "prefixe");
289
		mediateur.obtenirListeValeurEtRafraichir(this, "prefixe");
290
 
290
 
291
		//Prénom
291
		//Prénom
292
		TextField<String> tfPrenom = new TextField<String>();
292
		TextField<String> tfPrenom = new TextField<String>();
293
		tfPrenom.setFieldLabel("Prénom");
293
		tfPrenom.setFieldLabel("Prénom");
294
		tfPrenom.setName("prenom");
294
		tfPrenom.setName("prenom");
295
 
295
 
296
		fsNoms.add(tfPrenom);
296
		fsNoms.add(tfPrenom);
297
		hmIdentite.put("tfPrenom", tfPrenom);
297
		hmIdentite.put("tfPrenom", tfPrenom);
298
 
298
 
299
		//Nom
299
		//Nom
300
		TextField<String> tfNom = new TextField<String>();
300
		TextField<String> tfNom = new TextField<String>();
301
		tfNom.setFieldLabel("Nom");
301
		tfNom.setFieldLabel("Nom");
302
		tfNom.setAllowBlank(false);
302
		tfNom.setAllowBlank(false);
303
		tfNom.setName("nom");
303
		tfNom.setName("nom");
304
		
304
		
305
		fsNoms.add(tfNom);
305
		fsNoms.add(tfNom);
306
		hmIdentite.put("tfNom", tfNom);
306
		hmIdentite.put("tfNom", tfNom);
307
		
307
		
308
		//Suffixe
308
		//Suffixe
309
		ListStore<Valeur> storeSuffixe = new ListStore<Valeur>();
309
		ListStore<Valeur> storeSuffixe = new ListStore<Valeur>();
310
		ComboBox<Valeur> cbSuffixe = new ComboBox<Valeur>();
310
		ComboBox<Valeur> cbSuffixe = new ComboBox<Valeur>();
311
		cbSuffixe.setStore(storeSuffixe);
311
		cbSuffixe.setStore(storeSuffixe);
312
		cbSuffixe.setFieldLabel("Suffixe");
312
		cbSuffixe.setFieldLabel("Suffixe");
313
		cbSuffixe.setDisplayField("nom");
313
		cbSuffixe.setDisplayField("nom");
314
		cbSuffixe.setEmptyText("Choisissez un suffixe:");
314
		cbSuffixe.setEmptyText("Choisissez un suffixe:");
315
		
315
		
316
		fsNoms.add(cbSuffixe);			
316
		fsNoms.add(cbSuffixe);			
317
		hmIdentite.put("cbSuffixe", cbSuffixe);
317
		hmIdentite.put("cbSuffixe", cbSuffixe);
318
		
318
		
319
		mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
319
		mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
320
 
320
 
321
		TextField<String> tfNomAutre = new TextField();
321
		TextField<String> tfNomAutre = new TextField();
322
		tfNomAutre.setFieldLabel("Autres noms");
322
		tfNomAutre.setFieldLabel("Autres noms");
323
		tfNomAutre.setName("truk_nom_autre");
323
		tfNomAutre.setName("truk_nom_autre");
324
		
324
		
325
		fsNoms.add(tfNomAutre);
325
		fsNoms.add(tfNomAutre);
326
		hmIdentite.put("tfNomAutre", tfNomAutre);
326
		hmIdentite.put("tfNomAutre", tfNomAutre);
327
		
327
		
328
		TextField<String> tfAbreviation = new TextField<String>();
328
		TextField<String> tfAbreviation = new TextField<String>();
329
		tfAbreviation.setFieldLabel("Abréviation");
329
		tfAbreviation.setFieldLabel("Abréviation");
330
		tfAbreviation.setName("abreviation");
330
		tfAbreviation.setName("abreviation");
331
		
331
		
332
		fsNoms.add(tfAbreviation);
332
		fsNoms.add(tfAbreviation);
333
		hmIdentite.put("tfAbreviation", tfAbreviation);
333
		hmIdentite.put("tfAbreviation", tfAbreviation);
334
 
334
 
335
		//Abréviation autres
335
		//Abréviation autres
336
		TextField<String> tfAbreviationAutre = new TextField<String>();
336
		TextField<String> tfAbreviationAutre = new TextField<String>();
337
		tfAbreviationAutre.setFieldLabel("Autres Abrév.");
337
		tfAbreviationAutre.setFieldLabel("Autres Abrév.");
338
		tfAbreviationAutre.setName("truk_abreviation_autre");
338
		tfAbreviationAutre.setName("truk_abreviation_autre");
339
		
339
		
340
		fsNoms.add(tfAbreviationAutre);
340
		fsNoms.add(tfAbreviationAutre);
341
		hmIdentite.put("tfAbreviationAutre", tfAbreviationAutre);
341
		hmIdentite.put("tfAbreviationAutre", tfAbreviationAutre);
342
										
342
										
343
		left.add(fsNoms);
343
		left.add(fsNoms);
344
		
344
		
345
		formLayout = new FormLayout();
345
		formLayout = new FormLayout();
346
		formLayout.setLabelAlign(LabelAlign.LEFT);
346
		formLayout.setLabelAlign(LabelAlign.LEFT);
347
		
347
		
348
		FieldSet fsNaissance = new FieldSet();
348
		FieldSet fsNaissance = new FieldSet();
349
		fsNaissance.setHeading("Naissance");
349
		fsNaissance.setHeading("Naissance");
350
		fsNaissance.setLayout(formLayout); 
350
		fsNaissance.setLayout(formLayout); 
351
		
351
		
352
		DateField dfDateNaissance = new DateField();
352
		DateField dfDateNaissance = new DateField();
353
		dfDateNaissance.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
353
		dfDateNaissance.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
354
		dfDateNaissance.setFieldLabel("Date");
354
		dfDateNaissance.setFieldLabel("Date");
355
		dfDateNaissance.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
355
		dfDateNaissance.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
356
		
356
		
357
		fsNaissance.add(dfDateNaissance);
357
		fsNaissance.add(dfDateNaissance);
358
		hmIdentite.put("dfDateNaissance", dfDateNaissance);
358
		hmIdentite.put("dfDateNaissance", dfDateNaissance);
359
		
359
		
360
		// Lieu naissance
360
		// Lieu naissance
361
		TextField<String> tfLieuNaissance = new TextField();
361
		TextField<String> tfLieuNaissance = new TextField();
362
		tfLieuNaissance.setFieldLabel("Lieu");
362
		tfLieuNaissance.setFieldLabel("Lieu");
363
		tfLieuNaissance.setName("naissance_lieu");
363
		tfLieuNaissance.setName("naissance_lieu");
364
		
364
		
365
		fsNaissance.add(tfLieuNaissance);
365
		fsNaissance.add(tfLieuNaissance);
366
		hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
366
		hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
367
			
367
			
368
		left.add(fsNaissance);
368
		left.add(fsNaissance);
369
		
369
		
370
		formLayout = new FormLayout();
370
		formLayout = new FormLayout();
371
		formLayout.setLabelAlign(LabelAlign.LEFT);
371
		formLayout.setLabelAlign(LabelAlign.LEFT);
372
		
372
		
373
		FieldSet fsDeces = new FieldSet();
373
		FieldSet fsDeces = new FieldSet();
374
		fsDeces.setHeading("Décès");
374
		fsDeces.setHeading("Décès");
375
		fsDeces.setLayout(formLayout); 
375
		fsDeces.setLayout(formLayout); 
376
			
376
			
377
		Radio rbEstDecedee = new Radio();
377
		Radio rbEstDecedee = new Radio();
378
		rbEstDecedee.setBoxLabel("oui");
378
		rbEstDecedee.setBoxLabel("oui");
379
	
379
	
380
		rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() {
380
		rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() {
381
						
381
						
382
			public void handleEvent(ComponentEvent be) {
382
			public void handleEvent(ComponentEvent be) {
383
				if(((Radio) be.getComponent()).getValue().equals(true))	{
383
				if(((Radio) be.getComponent()).getValue().equals(true))	{
384
					((DateField) hmIdentite.get("dfDateDeces")).setVisible(true);
384
					((DateField) hmIdentite.get("dfDateDeces")).setVisible(true);
385
					((TextField) hmIdentite.get("tfLieuDeces")).setVisible(true);
385
					((TextField) hmIdentite.get("tfLieuDeces")).setVisible(true);
386
				} else	{
386
				} else	{
387
					((DateField) hmIdentite.get("dfDateDeces")).setVisible(false);
387
					((DateField) hmIdentite.get("dfDateDeces")).setVisible(false);
388
					((TextField) hmIdentite.get("tfLieuDeces")).setVisible(false);
388
					((TextField) hmIdentite.get("tfLieuDeces")).setVisible(false);
389
				}
389
				}
390
			}	
390
			}	
391
		});
391
		});
392
					
392
					
393
		hmIdentite.put("rbEstDecedee", rbEstDecedee);
393
		hmIdentite.put("rbEstDecedee", rbEstDecedee);
394
		
394
		
395
		Radio rbNestPasDecedee = new Radio();
395
		Radio rbNestPasDecedee = new Radio();
396
		rbNestPasDecedee.setBoxLabel("non");
396
		rbNestPasDecedee.setBoxLabel("non");
397
		rbNestPasDecedee.setValue(true);
397
		rbNestPasDecedee.setValue(true);
398
		
398
		
399
		RadioGroup rbgDeces = new RadioGroup();
399
		RadioGroup rbgDeces = new RadioGroup();
400
		rbgDeces.setFieldLabel("Est décédée");
400
		rbgDeces.setFieldLabel("Est décédée");
401
		rbgDeces.add(rbEstDecedee);
401
		rbgDeces.add(rbEstDecedee);
402
		rbgDeces.add(rbNestPasDecedee);
402
		rbgDeces.add(rbNestPasDecedee);
403
		
403
		
404
		fsDeces.add(rbgDeces);
404
		fsDeces.add(rbgDeces);
405
		
405
		
406
		DateField dfDateDeces = new DateField();
406
		DateField dfDateDeces = new DateField();
407
		dfDateDeces.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
407
		dfDateDeces.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
408
		dfDateDeces.setFormatValue(true);
408
		dfDateDeces.setFormatValue(true);
409
		dfDateDeces.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
409
		dfDateDeces.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
410
		dfDateDeces.setFieldLabel("Date");
410
		dfDateDeces.setFieldLabel("Date");
411
		dfDateDeces.setVisible(false);
411
		dfDateDeces.setVisible(false);
412
 
412
 
413
		fsDeces.add(dfDateDeces);
413
		fsDeces.add(dfDateDeces);
414
		hmIdentite.put("dfDateDeces", dfDateDeces);
414
		hmIdentite.put("dfDateDeces", dfDateDeces);
415
 
415
 
416
		TextField<String> tfLieuDeces = new TextField();
416
		TextField<String> tfLieuDeces = new TextField();
417
		tfLieuDeces.setFieldLabel("Lieu");
417
		tfLieuDeces.setFieldLabel("Lieu");
418
		tfLieuDeces.setName("deces_lieu");
418
		tfLieuDeces.setName("deces_lieu");
419
		tfLieuDeces.setVisible(false);
419
		tfLieuDeces.setVisible(false);
420
		
420
		
421
		fsDeces.add(tfLieuDeces);
421
		fsDeces.add(tfLieuDeces);
422
		hmIdentite.put("tfLieuDeces", tfLieuDeces);
422
		hmIdentite.put("tfLieuDeces", tfLieuDeces);
423
								
423
								
424
		left.add(fsDeces);
424
		left.add(fsDeces);
425
			
425
			
426
		tiIdentite.add(main);
426
		tiIdentite.add(main);
427
			
427
			
428
		FieldSet fsContactTel = new FieldSet();
428
		FieldSet fsContactTel = new FieldSet();
429
		fsContactTel.setHeading("Contact - Téléphones");
429
		fsContactTel.setHeading("Contact - Téléphones");
430
		fsContactTel.setLayout(new RowLayout());
430
		fsContactTel.setLayout(new RowLayout());
431
		
431
		
432
		
432
		
433
		ChampMultiValeursMultiTypes telephones = new ChampMultiValeursMultiTypes("Téléphones");
433
		ChampMultiValeursMultiTypes telephones = new ChampMultiValeursMultiTypes("Téléphones");
434
		hmIdentite.put("telephones", telephones);
434
		hmIdentite.put("telephones", telephones);
435
		telephones.initialiserType("tel", mediateur);
435
		telephones.initialiserType("tel", mediateur);
436
		fsContactTel.add(telephones);
436
		fsContactTel.add(telephones);
437
		right.add(fsContactTel);
437
		right.add(fsContactTel);
438
		hmIdentite.put("fsContactTel", fsContactTel);
438
		hmIdentite.put("fsContactTel", fsContactTel);
439
				
439
				
440
		
440
		
441
		FieldSet fsContact = new FieldSet();
441
		FieldSet fsContact = new FieldSet();
442
		fsContact.setHeading("Contact - Autres");
442
		fsContact.setHeading("Contact - Autres");
443
		fsContact.setId("fsContact");
443
		fsContact.setId("fsContact");
444
		fsContact.setLayout(new RowLayout());
444
		fsContact.setLayout(new RowLayout());
445
 
445
 
446
		right.add(fsContact);
446
		right.add(fsContact);
447
		hmIdentite.put("fsContact", fsContact);
447
		hmIdentite.put("fsContact", fsContact);
448
 
448
 
449
		ChampMultiValeurs courriels = new ChampMultiValeurs("Courriels");
449
		ChampMultiValeurs courriels = new ChampMultiValeurs("Courriels");
450
		courriels.setValidation("(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*", "moi@domaine.fr");
450
		courriels.setValidation("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", "moi@domaine.fr");
451
		fsContact.add(courriels);
451
		fsContact.add(courriels);
452
		hmIdentite.put("courriels", courriels);
452
		hmIdentite.put("courriels", courriels);
453
		
453
		
454
		LayoutContainer lcCourrielContainer = new LayoutContainer(new RowLayout());
454
		LayoutContainer lcCourrielContainer = new LayoutContainer(new RowLayout());
455
		
455
		
456
		fsContact.add(lcCourrielContainer);
456
		fsContact.add(lcCourrielContainer);
457
		hmIdentite.put("lcCourrielContainer", lcCourrielContainer);
457
		hmIdentite.put("lcCourrielContainer", lcCourrielContainer);
458
 
458
 
459
		ChampMultiValeurs sites = new ChampMultiValeurs("Sites web");
459
		ChampMultiValeurs sites = new ChampMultiValeurs("Sites web");
460
		sites.setValeurParDefaut("http://");
460
		sites.setValeurParDefaut("http://");
461
		sites.setValidation("^http:\\/\\/[^$]+$", "http://www.monsite.com");
461
		sites.setValidation("^http:\\/\\/[^$]+$", "http://www.monsite.com");
462
		fsContact.add(sites);
462
		fsContact.add(sites);
463
		hmIdentite.put("sites", sites);
463
		hmIdentite.put("sites", sites);
464
			
464
			
465
		FieldSet fsAutresInfos = new FieldSet();
465
		FieldSet fsAutresInfos = new FieldSet();
466
		fsAutresInfos.setHeading("Autres informations");
466
		fsAutresInfos.setHeading("Autres informations");
467
	
467
	
468
		formLayout = new FormLayout();
468
		formLayout = new FormLayout();
469
		formLayout.setLabelAlign(LabelAlign.LEFT);
469
		formLayout.setLabelAlign(LabelAlign.LEFT);
470
		fsAutresInfos.setLayout(formLayout); 
470
		fsAutresInfos.setLayout(formLayout); 
471
			
471
			
472
				
472
				
473
		formLayout = new FormLayout();
473
		formLayout = new FormLayout();
474
		formLayout.setLabelAlign(LabelAlign.TOP);
474
		formLayout.setLabelAlign(LabelAlign.TOP);
475
		LayoutContainer lcAutreInformations1 = new LayoutContainer(formLayout);
475
		LayoutContainer lcAutreInformations1 = new LayoutContainer(formLayout);
476
							
476
							
477
		//Civilité				
477
		//Civilité				
478
		ListStore<Valeur> storeSexe = new ListStore<Valeur>();
478
		ListStore<Valeur> storeSexe = new ListStore<Valeur>();
479
		ComboBox<Valeur> cbSexe = new ComboBox<Valeur>();
479
		ComboBox<Valeur> cbSexe = new ComboBox<Valeur>();
480
		cbSexe.setStore(storeSexe);
480
		cbSexe.setStore(storeSexe);
481
		cbSexe.setFieldLabel("Sexe");
481
		cbSexe.setFieldLabel("Sexe");
482
		cbSexe.setDisplayField("nom");
482
		cbSexe.setDisplayField("nom");
483
		cbSexe.setEmptyText("Choisissez le sexe:");
483
		cbSexe.setEmptyText("Choisissez le sexe:");
484
	
484
	
485
		lcAutreInformations1.add(cbSexe, fd100);			
485
		lcAutreInformations1.add(cbSexe, fd100);			
486
		hmIdentite.put("cbSexe", cbSexe);
486
		hmIdentite.put("cbSexe", cbSexe);
487
	
487
	
488
		mediateur.obtenirListeValeurEtRafraichir(this, "sexe");			
488
		mediateur.obtenirListeValeurEtRafraichir(this, "sexe");			
489
		
489
		
490
		//Description
490
		//Description
491
		TextArea taDescription = new TextArea();
491
		TextArea taDescription = new TextArea();
492
		taDescription.setEmptyText("Saisissez une description");
492
		taDescription.setEmptyText("Saisissez une description");
493
		taDescription.setFieldLabel("Description");
493
		taDescription.setFieldLabel("Description");
494
		taDescription.setWidth("100%");
494
		taDescription.setWidth("100%");
495
		taDescription.setName("description");
495
		taDescription.setName("description");
496
		
496
		
497
		lcAutreInformations1.add(taDescription, fd100);
497
		lcAutreInformations1.add(taDescription, fd100);
498
		hmIdentite.put("taDescription", taDescription);
498
		hmIdentite.put("taDescription", taDescription);
499
		
499
		
500
		fsAutresInfos.add(lcAutreInformations1);
500
		fsAutresInfos.add(lcAutreInformations1);
501
		
501
		
502
		// Logo
502
		// Logo
503
		LayoutContainer lcLogoUrl = new LayoutContainer();
503
		LayoutContainer lcLogoUrl = new LayoutContainer();
504
		hmIdentite.put("lcLogoUrl", lcLogoUrl);
504
		hmIdentite.put("lcLogoUrl", lcLogoUrl);
505
		
505
		
506
		ChampMultiValeursImage logo = new ChampMultiValeursImage("Logos");
506
		ChampMultiValeursImage logo = new ChampMultiValeursImage("Logos");
507
		logo.setImageHeight("150px");
507
		logo.setImageHeight("150px");
508
		logo.setValeurParDefaut("http://");
508
		logo.setValeurParDefaut("http://");
509
		logo.setValeurBoutonSupprimer("Supprimer");
509
		logo.setValeurBoutonSupprimer("Supprimer");
510
		hmIdentite.put("logos", logo);
510
		hmIdentite.put("logos", logo);
511
		
511
		
512
		lcLogoUrl.add(logo);
512
		lcLogoUrl.add(logo);
513
		
513
		
514
		fsAutresInfos.add(logo);
514
		fsAutresInfos.add(logo);
515
		
515
		
516
		LayoutContainer lcAutreInformations2 = new LayoutContainer(new ColumnLayout());
516
		LayoutContainer lcAutreInformations2 = new LayoutContainer(new ColumnLayout());
517
		hmIdentite.put("lcAutreInformations2", lcAutreInformations2);
517
		hmIdentite.put("lcAutreInformations2", lcAutreInformations2);
518
		fsAutresInfos.add(lcAutreInformations2);
518
		fsAutresInfos.add(lcAutreInformations2);
519
			
519
			
520
		right.add(fsAutresInfos);
520
		right.add(fsAutresInfos);
521
			
521
			
522
		// Ajout des évènements saisi
522
		// Ajout des évènements saisi
523
		KeyListener klNoms = new KeyListener()	{
523
		KeyListener klNoms = new KeyListener()	{
524
			public void componentKeyUp(ComponentEvent ev)	{
524
			public void componentKeyUp(ComponentEvent ev)	{
525
				rafraichir(null);	
525
				rafraichir(null);	
526
			}				
526
			}				
527
		};
527
		};
528
		
528
		
529
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
529
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
530
			public void selectionChanged(SelectionChangedEvent se) {
530
			public void selectionChanged(SelectionChangedEvent se) {
531
					rafraichir(null);
531
					rafraichir(null);
532
				}
532
				}
533
		};
533
		};
534
						
534
						
535
		cbPrefixe.addSelectionChangedListener(selectionChange);
535
		cbPrefixe.addSelectionChangedListener(selectionChange);
536
		cbPrefixe.addKeyListener(klNoms);
536
		cbPrefixe.addKeyListener(klNoms);
537
		tfPrenom.addKeyListener(klNoms);
537
		tfPrenom.addKeyListener(klNoms);
538
		tfNom.addKeyListener(klNoms);
538
		tfNom.addKeyListener(klNoms);
539
		cbSuffixe.addSelectionChangedListener(selectionChange);		
539
		cbSuffixe.addSelectionChangedListener(selectionChange);		
540
			
540
			
541
	}
541
	}
542
	
542
	
543
	public void creerComposantsAdresse()	{
543
	public void creerComposantsAdresse()	{
544
		
544
		
545
		// Gauche
545
		// Gauche
546
		LayoutContainer left = new LayoutContainer();
546
		LayoutContainer left = new LayoutContainer();
547
		left.setLayout(new FormLayout());
547
		left.setLayout(new FormLayout());
548
		
548
		
549
		// Droite
549
		// Droite
550
		LayoutContainer right = new LayoutContainer();
550
		LayoutContainer right = new LayoutContainer();
551
		right.setLayout(new FormLayout());
551
		right.setLayout(new FormLayout());
552
		
552
		
553
		// Principal
553
		// Principal
554
		LayoutContainer main = new LayoutContainer();
554
		LayoutContainer main = new LayoutContainer();
555
		main.setLayout(new ColumnLayout());
555
		main.setLayout(new ColumnLayout());
556
		
556
		
557
		// Ajout au principal
557
		// Ajout au principal
558
		main.add(left, new ColumnData(.49));
558
		main.add(left, new ColumnData(.49));
559
		main.add(right, new ColumnData(.49));	
559
		main.add(right, new ColumnData(.49));	
560
		
560
		
561
		TextField<String> tfAdresse1 = new TextField();
561
		TextField<String> tfAdresse1 = new TextField();
562
		tfAdresse1.setFieldLabel("Adresse");
562
		tfAdresse1.setFieldLabel("Adresse");
563
		tfAdresse1.setName("adresse_01");
563
		tfAdresse1.setName("adresse_01");
564
		left.add(tfAdresse1, fd100);
564
		left.add(tfAdresse1, fd100);
565
		hmAdresse.put("tfAdresse1", tfAdresse1);
565
		hmAdresse.put("tfAdresse1", tfAdresse1);
566
		
566
		
567
		TextField<String> tfAdresse2 = new TextField();
567
		TextField<String> tfAdresse2 = new TextField();
568
		tfAdresse2.setFieldLabel("Complément d'adresse");
568
		tfAdresse2.setFieldLabel("Complément d'adresse");
569
		tfAdresse2.setName("adresse_02");
569
		tfAdresse2.setName("adresse_02");
570
		left.add(tfAdresse2, fd100);
570
		left.add(tfAdresse2, fd100);
571
		hmAdresse.put("tfAdresse2", tfAdresse2);
571
		hmAdresse.put("tfAdresse2", tfAdresse2);
572
		
572
		
573
		ComboBox<Valeur> cbPays = new ComboBox<Valeur>();
573
		ComboBox<Valeur> cbPays = new ComboBox<Valeur>();
574
		cbPays.setFieldLabel("Pays");
574
		cbPays.setFieldLabel("Pays");
575
		cbPays.setDisplayField("nom");
575
		cbPays.setDisplayField("nom");
576
		cbPays.setEmptyText("Sélectionnez le pays:");
576
		cbPays.setEmptyText("Sélectionnez le pays:");
577
		
577
		
578
		ListStore<Valeur> storePays = new ListStore<Valeur>();
578
		ListStore<Valeur> storePays = new ListStore<Valeur>();
579
		cbPays.setStore(storePays);
579
		cbPays.setStore(storePays);
580
		
580
		
581
		right.add(cbPays, fd100);
581
		right.add(cbPays, fd100);
582
		hmAdresse.put("cbPays", cbPays);
582
		hmAdresse.put("cbPays", cbPays);
583
		
583
		
584
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
584
		SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
585
			public void selectionChanged(SelectionChangedEvent se) {
585
			public void selectionChanged(SelectionChangedEvent se) {
586
					// Rafraichir avec le pays sélectionné
586
					// Rafraichir avec le pays sélectionné
587
					obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
587
					obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
588
					
588
					
589
				}
589
				}
590
		};
590
		};
591
					
591
					
592
		cbPays.addSelectionChangedListener(selectionChange);
592
		cbPays.addSelectionChangedListener(selectionChange);
593
		
593
		
594
		
594
		
595
		ComboBox<Valeur> cbRegion = new ComboBox<Valeur>();
595
		ComboBox<Valeur> cbRegion = new ComboBox<Valeur>();
596
		cbRegion.setFieldLabel("Region");
596
		cbRegion.setFieldLabel("Region");
597
		cbRegion.setDisplayField("nom");
597
		cbRegion.setDisplayField("nom");
598
		cbRegion.setEmptyText("Sélectionnez la région:");
598
		cbRegion.setEmptyText("Sélectionnez la région:");
599
		cbRegion.setVisible(false);
599
		cbRegion.setVisible(false);
600
		
600
		
601
		ListStore<Valeur> storeRegion = new ListStore<Valeur>();
601
		ListStore<Valeur> storeRegion = new ListStore<Valeur>();
602
		cbRegion.setStore(storeRegion);
602
		cbRegion.setStore(storeRegion);
603
		
603
		
604
		
604
		
605
		right.add(cbRegion, fd100);
605
		right.add(cbRegion, fd100);
606
		hmAdresse.put("cbRegion", cbRegion);
606
		hmAdresse.put("cbRegion", cbRegion);
607
		
607
		
608
		TextField<String> tfBoitePostale = new TextField<String>();
608
		TextField<String> tfBoitePostale = new TextField<String>();
609
		tfBoitePostale.setFieldLabel("Boite postale");
609
		tfBoitePostale.setFieldLabel("Boite postale");
610
		tfBoitePostale.setName("bp");
610
		tfBoitePostale.setName("bp");
611
		
611
		
612
		left.add(tfBoitePostale, fd100);
612
		left.add(tfBoitePostale, fd100);
613
		hmAdresse.put("tfBoitePostale", tfBoitePostale);
613
		hmAdresse.put("tfBoitePostale", tfBoitePostale);
614
		
614
		
615
		TextField<Integer> tfCodePostal = new TextField<Integer>();
615
		TextField<Integer> tfCodePostal = new TextField<Integer>();
616
		tfCodePostal.setFieldLabel("Code postal");
616
		tfCodePostal.setFieldLabel("Code postal");
617
		tfCodePostal.setName("code_postal");
617
		tfCodePostal.setName("code_postal");
618
		
618
		
619
		right.add(tfCodePostal, fd100);
619
		right.add(tfCodePostal, fd100);
620
		hmAdresse.put("tfCodePostal", tfCodePostal);
620
		hmAdresse.put("tfCodePostal", tfCodePostal);
621
		
621
		
622
		TextField tfVille = new TextField();
622
		TextField tfVille = new TextField();
623
		tfVille.setFieldLabel("Ville");
623
		tfVille.setFieldLabel("Ville");
624
		tfVille.setName("ville");
624
		tfVille.setName("ville");
625
		
625
		
626
		right.add(tfVille, fd100);
626
		right.add(tfVille, fd100);
627
		hmAdresse.put("tfVille", tfVille);
627
		hmAdresse.put("tfVille", tfVille);
628
		
628
		
629
		// MAJ ComboBox
629
		// MAJ ComboBox
630
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
630
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
631
		
631
		
632
		FieldSet fsAdresse = new FieldSet();
632
		FieldSet fsAdresse = new FieldSet();
633
		fsAdresse.setHeading("Adresse personnelle");
633
		fsAdresse.setHeading("Adresse personnelle");
634
		fsAdresse.add(main);
634
		fsAdresse.add(main);
635
		
635
		
636
		tiAdresses.add(fsAdresse);
636
		tiAdresses.add(fsAdresse);
637
		((ComboBox) hmIdentite.get("cbPrefixe")).setRawValue("ljkhlkj");
637
		((ComboBox) hmIdentite.get("cbPrefixe")).setRawValue("ljkhlkj");
638
	}
638
	}
639
		
639
		
640
	/**
640
	/**
641
	 * Ajouter le bouton réinitialiser à la barre d'outils donnée
641
	 * Ajouter le bouton réinitialiser à la barre d'outils donnée
642
	 * 
642
	 * 
643
	 * @param barreOutils la barre d'outils à modifier
643
	 * @param barreOutils la barre d'outils à modifier
644
	 * */
644
	 * */
645
	public void ajouterBoutonReinitialiser(ToolBar barreOutils)	{
645
	public void ajouterBoutonReinitialiser(ToolBar barreOutils)	{
646
		
646
		
647
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
647
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
648
		Button reinitialiser = new Button("Réinitialiser le formulaire");
648
		Button reinitialiser = new Button("Réinitialiser le formulaire");
649
		reinitialiser.setIcon(Images.ICONES.rafraichir());
649
		reinitialiser.setIcon(Images.ICONES.rafraichir());
650
		reinitialiser.addSelectionListener(new SelectionListener<ButtonEvent>() {  
650
		reinitialiser.addSelectionListener(new SelectionListener<ButtonEvent>() {  
651
			public void componentSelected(ButtonEvent ce) {  
651
			public void componentSelected(ButtonEvent ce) {  
652
				//((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicAjouterPersonne();
652
				//((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicAjouterPersonne();
653
				reinitialiser();
653
				reinitialiser();
654
			}  
654
			}  
655
		});
655
		});
656
		barreOutils.add(reinitialiser);
656
		barreOutils.add(reinitialiser);
657
	}
657
	}
658
	
658
	
659
	/**
659
	/**
660
	 * Ajouter le bouton Sauvegarder et revenir à la liste à la barre d'outils donnée
660
	 * Ajouter le bouton Sauvegarder et revenir à la liste à la barre d'outils donnée
661
	 * 
661
	 * 
662
	 * @param barreOutils la barre d'outils à modifier
662
	 * @param barreOutils la barre d'outils à modifier
663
	 * */
663
	 * */
664
	private void ajouterBoutonEnregistrerEtRevenir(ButtonBar barreOutils)	{
664
	private void ajouterBoutonEnregistrerEtRevenir(ButtonBar barreOutils)	{
665
		
665
		
666
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
666
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
667
		enregistrerEtRevenir = new Button("Enregistrer et revenir à la liste");
667
		enregistrerEtRevenir = new Button("Enregistrer et revenir à la liste");
668
		enregistrerEtRevenir.setIcon(Images.ICONES.scriptGo());
668
		enregistrerEtRevenir.setIcon(Images.ICONES.scriptGo());
669
		enregistrerEtRevenir.setIconAlign(IconAlign.LEFT);
669
		enregistrerEtRevenir.setIconAlign(IconAlign.LEFT);
670
		enregistrerEtRevenir.addSelectionListener(new SelectionListener<ButtonEvent>() {  
670
		enregistrerEtRevenir.addSelectionListener(new SelectionListener<ButtonEvent>() {  
671
			public void componentSelected(ButtonEvent ce) {  
671
			public void componentSelected(ButtonEvent ce) {  
672
				if (enregistrer() == true)	{
672
				if (enregistrer() == true)	{
673
					((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicMenu("Personnes");
673
					((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicMenu("Personnes");
674
				}
674
				}
675
			}  
675
			}  
676
		});
676
		});
677
		
677
		
678
		hmIdentite.put("btnEnregistrerRevenir", enregistrerEtRevenir);
678
		hmIdentite.put("btnEnregistrerRevenir", enregistrerEtRevenir);
679
		barreOutils.add(enregistrerEtRevenir);
679
		barreOutils.add(enregistrerEtRevenir);
680
		enregistrerEtRevenir.setEnabled(false);
680
		enregistrerEtRevenir.setEnabled(false);
681
		
681
		
682
	}
682
	}
683
	
683
	
684
	/**
684
	/**
685
	 * Ajouter le bouton Sauvegarder à la barre d'outils donnée
685
	 * Ajouter le bouton Sauvegarder à la barre d'outils donnée
686
	 * 
686
	 * 
687
	 * @param barreOutils la barre d'outils à modifier
687
	 * @param barreOutils la barre d'outils à modifier
688
	 * */
688
	 * */
689
	private void ajouterBoutonEnregistrer(ButtonBar barreOutils)	{
689
	private void ajouterBoutonEnregistrer(ButtonBar barreOutils)	{
690
		
690
		
691
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
691
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
692
		enregistrer = new Button("Enregistrer");
692
		enregistrer = new Button("Enregistrer");
693
		enregistrer.setIcon(Images.ICONES.scriptSave());
693
		enregistrer.setIcon(Images.ICONES.scriptSave());
694
		enregistrer.setIconAlign(IconAlign.LEFT);
694
		enregistrer.setIconAlign(IconAlign.LEFT);
695
		enregistrer.setId("main-button");
695
		enregistrer.setId("main-button");
696
		enregistrer.addSelectionListener(new SelectionListener<ButtonEvent>() {  
696
		enregistrer.addSelectionListener(new SelectionListener<ButtonEvent>() {  
697
			public void componentSelected(ButtonEvent ce) {  
697
			public void componentSelected(ButtonEvent ce) {  
698
				enregistrer();
698
				enregistrer();
699
			}  
699
			}  
700
		});
700
		});
701
		enregistrer.setEnabled(false);
701
		enregistrer.setEnabled(false);
702
		hmIdentite.put("btnEnregistrer", enregistrer);
702
		hmIdentite.put("btnEnregistrer", enregistrer);
703
		barreOutils.add(enregistrer);
703
		barreOutils.add(enregistrer);
704
	}
704
	}
705
	
705
	
706
	/**
706
	/**
707
	 * Ajouter le bouton annuler à la barre d'outils donnée
707
	 * Ajouter le bouton annuler à la barre d'outils donnée
708
	 * 
708
	 * 
709
	 * @param barreOutils la barre d'outils à modifier
709
	 * @param barreOutils la barre d'outils à modifier
710
	 * */
710
	 * */
711
	public static void ajouterBoutonAnnuler(ButtonBar barreOutils)	{
711
	public static void ajouterBoutonAnnuler(ButtonBar barreOutils)	{
712
		
712
		
713
		// Le bouton annuler ne sauvegarde pas les informations et renvoie vers la page précédente
713
		// Le bouton annuler ne sauvegarde pas les informations et renvoie vers la page précédente
714
		Button annuler = new Button("Revenir à la liste");
714
		Button annuler = new Button("Revenir à la liste");
715
		annuler.addSelectionListener(new SelectionListener<ButtonEvent>() {  
715
		annuler.addSelectionListener(new SelectionListener<ButtonEvent>() {  
716
			public void componentSelected(ButtonEvent ce) {  
716
			public void componentSelected(ButtonEvent ce) {  
717
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicMenu("Personnes");
717
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicMenu("Personnes");
718
			}  
718
			}  
719
		});
719
		});
720
		annuler.setIconStyle(ComposantClass.ICONE_SUPPRIMER);
720
		annuler.setIconStyle(ComposantClass.ICONE_SUPPRIMER);
721
		barreOutils.add(annuler);
721
		barreOutils.add(annuler);
722
	}
722
	}
723
	
723
	
724
	public void obtenirListeRegionParPays(String strPays)	{
724
	public void obtenirListeRegionParPays(String strPays)	{
725
		mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
725
		mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
726
	}
726
	}
727
	
727
	
728
	
728
	
729
	
729
	
730
	/*---------------------------------------------------------------------------------------
730
	/*---------------------------------------------------------------------------------------
731
	 * 		RAFRAICHISSEMENT DU PANNEAU
731
	 * 		RAFRAICHISSEMENT DU PANNEAU
732
	 * --------------------------------------------------------------------------------------
732
	 * --------------------------------------------------------------------------------------
733
	 */	
733
	 */	
734
	public void rafraichir(Object nouvellesDonnees) {
734
	public void rafraichir(Object nouvellesDonnees) {
735
		
735
		
736
		
736
		
737
		
737
		
738
		if (nouvellesDonnees instanceof ValeurListe) {
738
		if (nouvellesDonnees instanceof ValeurListe) {
739
			
739
			
740
			
740
			
741
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
741
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
742
			
742
			
743
			// Créer une liste de valeurs
743
			// Créer une liste de valeurs
744
			List<Valeur> liste = new ArrayList<Valeur>();
744
			List<Valeur> liste = new ArrayList<Valeur>();
745
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
745
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
746
				liste.add(listeValeurs.get(it.next()));
746
				liste.add(listeValeurs.get(it.next()));
747
			}
747
			}
748
			
748
			
749
			if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
749
			if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
750
 
750
 
751
				remplirCombobox("cbPrefixe", liste, "hmIdentite");
751
				remplirCombobox("cbPrefixe", liste, "hmIdentite");
752
								
752
								
753
			} else if (listeValeurs.getId().equals(config.getListeId("suffixes"))) {
753
			} else if (listeValeurs.getId().equals(config.getListeId("suffixes"))) {
754
			
754
			
755
				remplirCombobox("cbSuffixe", liste, "hmIdentite");
755
				remplirCombobox("cbSuffixe", liste, "hmIdentite");
756
								
756
								
757
			} else if (listeValeurs.getId().equals(config.getListeId("sexe"))) {
757
			} else if (listeValeurs.getId().equals(config.getListeId("sexe"))) {
758
 
758
 
759
				remplirCombobox("cbSexe", liste, "hmIdentite");
759
				remplirCombobox("cbSexe", liste, "hmIdentite");
760
				
760
				
761
			} else if (listeValeurs.getId().equals(config.getListeId("tel"))) {
761
			} else if (listeValeurs.getId().equals(config.getListeId("tel"))) {
762
			
762
			
763
				remplirCombobox("cbTelephone", liste, "hmIdentite");
763
				remplirCombobox("cbTelephone", liste, "hmIdentite");
764
				
764
				
765
				//Préselection du tél
765
				//Préselection du tél
766
				ComboBox<Valeur> cbTelephone = (ComboBox<Valeur>) hmIdentite.get("cbTelephone");
766
				ComboBox<Valeur> cbTelephone = (ComboBox<Valeur>) hmIdentite.get("cbTelephone");
767
				cbTelephone.setValue(liste.get(1));
767
				cbTelephone.setValue(liste.get(1));
768
			
768
			
769
			} else if (listeValeurs.getId().equals(config.getListeId("pays")))	{
769
			} else if (listeValeurs.getId().equals(config.getListeId("pays")))	{
770
				
770
				
771
				remplirCombobox("cbPays", liste, "hmAdresse");
771
				remplirCombobox("cbPays", liste, "hmAdresse");
772
				
772
				
773
			} else if (listeValeurs.getId().equals(config.getListeId("region")))	{
773
			} else if (listeValeurs.getId().equals(config.getListeId("region")))	{
774
				
774
				
775
				remplirCombobox("cbRegion", liste, "hmAdresse");
775
				remplirCombobox("cbRegion", liste, "hmAdresse");
776
				
776
				
777
				((ComboBox) hmAdresse.get("cbRegion")).setVisible(true);
777
				((ComboBox) hmAdresse.get("cbRegion")).setVisible(true);
778
			}
778
			}
779
			
779
			
780
			
780
			
781
		} else if (nouvellesDonnees instanceof ProjetListe) {
781
		} else if (nouvellesDonnees instanceof ProjetListe) {
782
			
782
			
783
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
783
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
784
			
784
			
785
			List<Projet> liste = new ArrayList<Projet>();
785
			List<Projet> liste = new ArrayList<Projet>();
786
			for (Iterator<String> it = projets.keySet().iterator(); it.hasNext();) {
786
			for (Iterator<String> it = projets.keySet().iterator(); it.hasNext();) {
787
				liste.add(projets.get(it.next()));
787
				liste.add(projets.get(it.next()));
788
			}
788
			}
789
			ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
789
			ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
790
			ListStore<Projet> storeProjets= cbProjets.getStore();
790
			ListStore<Projet> storeProjets= cbProjets.getStore();
791
			storeProjets.removeAll();
791
			storeProjets.removeAll();
792
			storeProjets.add(liste);
792
			storeProjets.add(liste);
793
			cbProjets.setStore(storeProjets);
793
			cbProjets.setStore(storeProjets);
794
			
794
			
795
		} else if (nouvellesDonnees instanceof Information)	{
795
		} else if (nouvellesDonnees instanceof Information)	{
796
			
796
			
797
			Information info = (Information) nouvellesDonnees;
797
			Information info = (Information) nouvellesDonnees;
798
			if (info.getType().equals("ajout_personne"))	{
798
			if (info.getType().equals("ajout_personne"))	{
799
				
799
				
800
				GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
800
				GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
801
				Info.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
801
				Info.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
802
				
802
				
803
			} else if (info.getType().equals("modification_personne"))	{
803
			} else if (info.getType().equals("modification_personne"))	{
804
				
804
				
805
				Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
805
				Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées.");
806
			}
806
			}
807
			else if (info.getType().equals("maj_utilisateur"))	{
807
			else if (info.getType().equals("maj_utilisateur"))	{
808
				gererEtatActivationBouton();
808
				gererEtatActivationBouton();
809
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
809
			} else if (info.getDonnee(0) instanceof PersonneListe)	{
810
			
810
			
811
					Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
811
					Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
812
					Iterator itPersonneListe = colPersonneListe.iterator();
812
					Iterator itPersonneListe = colPersonneListe.iterator();
813
					Personne personne = (Personne) itPersonneListe.next();
813
					Personne personne = (Personne) itPersonneListe.next();
814
					
814
					
815
					personneSauvegarde = new Personne();
815
					personneSauvegarde = new Personne();
816
					personneSauvegarde = (Personne) personne.cloner(personneSauvegarde);
816
					personneSauvegarde = (Personne) personne.cloner(personneSauvegarde);
817
					
817
					
818
					binderPersonne(personne);
818
					binderPersonne(personne);
819
					//Mise à jour de la personne		
819
					//Mise à jour de la personne		
820
					//Personne personne = (Personne) nouvellesDonnees;
820
					//Personne personne = (Personne) nouvellesDonnees;
821
					
821
					
822
					ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
822
					ComboBox cbProjets = (ComboBox) hmIdentite.get("cbProjets");
823
					cbProjets.setValue(cbProjets.getStore().findModel("id_projet", personne.get("ce_projet")));
823
					cbProjets.setValue(cbProjets.getStore().findModel("id_projet", personne.get("ce_projet")));
824
					
824
					
825
					//Prefixe
825
					//Prefixe
826
					String prefixe = personne.get("ce_truk_prefix");
826
					String prefixe = personne.get("ce_truk_prefix");
827
					ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
827
					ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
828
					
828
					
829
					
829
					
830
					String prefixeCourant = personne.get("ce_truk_prefix");
830
					String prefixeCourant = personne.get("ce_truk_prefix");
831
					if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
831
					if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null)	{
832
						cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
832
						cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant));
833
					}	else	{
833
					}	else	{
834
						cbPrefixe.setRawValue(prefixeCourant);
834
						cbPrefixe.setRawValue(prefixeCourant);
835
					}
835
					}
836
					
836
					
837
					
837
					
838
					((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
838
					((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
839
					((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
839
					((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
840
					
840
					
841
					//Suffixe
841
					//Suffixe
842
					String suffixe = personne.get("ce_truk_suffixe");
842
					String suffixe = personne.get("ce_truk_suffixe");
843
					ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
843
					ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
844
					
844
					
845
					String suffixeCourant = personne.get("ce_truk_suffix");
845
					String suffixeCourant = personne.get("ce_truk_suffix");
846
					if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
846
					if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
847
						cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
847
						cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
848
					}	else	{
848
					}	else	{
849
						cbSuffixe.setRawValue(suffixeCourant);
849
						cbSuffixe.setRawValue(suffixeCourant);
850
					}
850
					}
851
					
851
					
852
					((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre"));
852
					((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre"));
853
					((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
853
					((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
854
					((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre"));
854
					((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre"));
855
					
855
					
856
					
856
					
857
					(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
857
					(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
858
					((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
858
					((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
859
					
859
					
860
					(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
860
					(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
861
					((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
861
					((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
862
					
862
					
863
					
863
					
864
					// Telephone
864
					// Telephone
865
					/*HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
865
					/*HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
866
					if (hmTelephone!=null)	{
866
					if (hmTelephone!=null)	{
867
						
867
						
868
						ListStore storeTelephone = ((ComboBox) hmIdentite.get("cbTelephone")).getStore();
868
						ListStore storeTelephone = ((ComboBox) hmIdentite.get("cbTelephone")).getStore();
869
						List lstModelsTelephone = storeTelephone.getModels();
869
						List lstModelsTelephone = storeTelephone.getModels();
870
						Iterator<Valeur> itStore = lstModelsTelephone.iterator();
870
						Iterator<Valeur> itStore = lstModelsTelephone.iterator();
871
						HashMap<String, String> hmTel = new HashMap();
871
						HashMap<String, String> hmTel = new HashMap();
872
						while (itStore.hasNext())	{
872
						while (itStore.hasNext())	{
873
							Valeur v = itStore.next();
873
							Valeur v = itStore.next();
874
							hmTel.put(v.getAbreviation(), v.getNom());
874
							hmTel.put(v.getAbreviation(), v.getNom());
875
						}
875
						}
876
						
876
						
877
						Collection<String> colTelephone = hmTelephone.keySet();
877
						Collection<String> colTelephone = hmTelephone.keySet();
878
						Iterator<String> itTelephone = colTelephone.iterator();
878
						Iterator<String> itTelephone = colTelephone.iterator();
879
					
879
					
880
						while (itTelephone.hasNext())	{
880
						while (itTelephone.hasNext())	{
881
							String strTelephone = itTelephone.next();
881
							String strTelephone = itTelephone.next();
882
							String strTypeTelephone = hmTelephone.get(strTelephone);
882
							String strTypeTelephone = hmTelephone.get(strTelephone);
883
							String idTel = hmTel.get(strTypeTelephone);
883
							String idTel = hmTel.get(strTypeTelephone);
884
							if (idTel == null)	{
884
							if (idTel == null)	{
885
								idTel = strTypeTelephone;
885
								idTel = strTypeTelephone;
886
							}
886
							}
887
							
887
							
888
							ajouterTelephone(strTelephone, idTel, strTypeTelephone);
888
							ajouterTelephone(strTelephone, idTel, strTypeTelephone);
889
						}
889
						}
890
					}*/
890
					}*/
891
					
891
					
892
					((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).peupler(personne.getString("truk_telephone"));
892
					((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).peupler(personne.getString("truk_telephone"));
893
					
893
					
894
					//Courriel
894
					//Courriel
895
					((ChampMultiValeurs) hmIdentite.get("courriels")).peupler(personne.getCourriel());
895
					((ChampMultiValeurs) hmIdentite.get("courriels")).peupler(personne.getCourriel());
896
					
896
					
897
					//Sites web
897
					//Sites web
898
					((ChampMultiValeurs) hmIdentite.get("sites")).peupler(personne.getString("truk_url"));
898
					((ChampMultiValeurs) hmIdentite.get("sites")).peupler(personne.getString("truk_url"));
899
					
899
					
900
					
900
					
901
					// Sexe
901
					// Sexe
902
					String strSexe = personne.get("ce_sexe");
902
					String strSexe = personne.get("ce_sexe");
903
					ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe");
903
					ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe");
904
 
904
 
905
					if (cbSexe.getStore().findModel("id_valeur", strSexe) != null)	{
905
					if (cbSexe.getStore().findModel("id_valeur", strSexe) != null)	{
906
						cbSexe.setValue(cbSexe.getStore().findModel("id_valeur", strSexe));
906
						cbSexe.setValue(cbSexe.getStore().findModel("id_valeur", strSexe));
907
					}	else	{
907
					}	else	{
908
						cbSexe.setRawValue(strSexe);
908
						cbSexe.setRawValue(strSexe);
909
					}
909
					}
910
					
910
					
911
					((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description"));
911
					((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description"));
912
					
912
					
913
					//Logo
913
					//Logo
914
					((ChampMultiValeurs) hmIdentite.get("logos")).peupler(personne.getString("truk_logo"));
914
					((ChampMultiValeurs) hmIdentite.get("logos")).peupler(personne.getString("truk_logo"));
915
					
915
					
916
					/*--------------------------------------------------
916
					/*--------------------------------------------------
917
					                      Adresse
917
					                      Adresse
918
					 ---------------------------------------------------*/
918
					 ---------------------------------------------------*/
919
					
919
					
920
					// Adresse
920
					// Adresse
921
					((TextField<String>) hmAdresse.get("tfAdresse1")).setValue((String) personne.get("adresse_01"));
921
					((TextField<String>) hmAdresse.get("tfAdresse1")).setValue((String) personne.get("adresse_01"));
922
	
922
	
923
					// Complément
923
					// Complément
924
					((TextField<String>) hmAdresse.get("tfAdresse2")).setValue((String) personne.get("adresse_02"));
924
					((TextField<String>) hmAdresse.get("tfAdresse2")).setValue((String) personne.get("adresse_02"));
925
					
925
					
926
					//Boite postale
926
					//Boite postale
927
					((TextField<String>) hmAdresse.get("tfBoitePostale")).setValue((String) personne.get("bp"));
927
					((TextField<String>) hmAdresse.get("tfBoitePostale")).setValue((String) personne.get("bp"));
928
					
928
					
929
					//Pays
929
					//Pays
930
					String strPays = personne.get("pays");
930
					String strPays = personne.get("pays");
931
					ComboBox<Valeur> cbPays = (ComboBox<Valeur>) hmAdresse.get("cbPays");
931
					ComboBox<Valeur> cbPays = (ComboBox<Valeur>) hmAdresse.get("cbPays");
932
					
932
					
933
					
933
					
934
					if (cbPays.getStore().findModel("nom", strPays) != null)	{
934
					if (cbPays.getStore().findModel("nom", strPays) != null)	{
935
						cbPays.setValue(cbPays.getStore().findModel("nom", strPays));
935
						cbPays.setValue(cbPays.getStore().findModel("nom", strPays));
936
					}	else	{
936
					}	else	{
937
						cbPays.setRawValue(strPays);
937
						cbPays.setRawValue(strPays);
938
					}
938
					}
939
					
939
					
940
					
940
					
941
					//Région
941
					//Région
942
					String strRegion = personne.get("region");
942
					String strRegion = personne.get("region");
943
					if ((strRegion!=null)&&(!strRegion.equals("")))	{
943
					if ((strRegion!=null)&&(!strRegion.equals("")))	{
944
						ComboBox<Valeur> cbRegion = (ComboBox<Valeur>) hmAdresse.get("cbRegion");
944
						ComboBox<Valeur> cbRegion = (ComboBox<Valeur>) hmAdresse.get("cbRegion");
945
						cbRegion.setVisible(true);
945
						cbRegion.setVisible(true);
946
						
946
						
947
						if (cbRegion.getStore().findModel("nom", strRegion) != null)	{
947
						if (cbRegion.getStore().findModel("nom", strRegion) != null)	{
948
							cbRegion.setValue(cbRegion.getStore().findModel("nom", strRegion));
948
							cbRegion.setValue(cbRegion.getStore().findModel("nom", strRegion));
949
						}	else	{
949
						}	else	{
950
							cbRegion.setRawValue(strRegion);
950
							cbRegion.setRawValue(strRegion);
951
						}
951
						}
952
					}
952
					}
953
					
953
					
954
					//Cp
954
					//Cp
955
					((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal"));
955
					((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal"));
956
					
956
					
957
					//Ville
957
					//Ville
958
					((TextField) hmAdresse.get("tfVille")).setValue(personne.get("ville"));
958
					((TextField) hmAdresse.get("tfVille")).setValue(personne.get("ville"));
959
					
959
					
960
					
960
					
961
					gererEtatActivationBouton();
961
					gererEtatActivationBouton();
962
					
962
					
963
					nouvellesDonnees = null;
963
					nouvellesDonnees = null;
964
				} else {
964
				} else {
965
					Info.display("messages", info.getMessages().toString());
965
					Info.display("messages", info.getMessages().toString());
966
				}
966
				}
967
		} 
967
		} 
968
		
968
		
969
		if (nouvellesDonnees == null)
969
		if (nouvellesDonnees == null)
970
		{
970
		{
971
			ComboBox cb= (ComboBox) hmIdentite.get("cbPrefixe");
971
			ComboBox cb= (ComboBox) hmIdentite.get("cbPrefixe");
972
			
972
			
973
			//Met à jour le nom Complet du formulaire
973
			//Met à jour le nom Complet du formulaire
974
			String valeurRetour = "";
974
			String valeurRetour = "";
975
			
975
			
976
			// Prefixe
976
			// Prefixe
977
			String prefixe = "";
977
			String prefixe = "";
978
			Valeur valPrefixe = (Valeur) ((ComboBox) hmIdentite.get("cbPrefixe")).getValue();
978
			Valeur valPrefixe = (Valeur) ((ComboBox) hmIdentite.get("cbPrefixe")).getValue();
979
			
979
			
980
			if (valPrefixe != null)	{
980
			if (valPrefixe != null)	{
981
				prefixe = valPrefixe.getNom();
981
				prefixe = valPrefixe.getNom();
982
			} else 	{
982
			} else 	{
983
				prefixe =  (String) ((ComboBox) hmIdentite.get("cbPrefixe")).getRawValue();
983
				prefixe =  (String) ((ComboBox) hmIdentite.get("cbPrefixe")).getRawValue();
984
			}		
984
			}		
985
			
985
			
986
			
986
			
987
			// Prénom
987
			// Prénom
988
			String prenom = (String) ((TextField) hmIdentite.get("tfPrenom")).getValue();
988
			String prenom = (String) ((TextField) hmIdentite.get("tfPrenom")).getValue();
989
			
989
			
990
			// Nom
990
			// Nom
991
			String nom = (String) ((TextField) hmIdentite.get("tfNom")).getValue();
991
			String nom = (String) ((TextField) hmIdentite.get("tfNom")).getValue();
992
			
992
			
993
			// Suffixe
993
			// Suffixe
994
			String suffixe = "";
994
			String suffixe = "";
995
			Valeur valSuffixe = (Valeur) ((ComboBox) hmIdentite.get("cbSuffixe")).getValue();
995
			Valeur valSuffixe = (Valeur) ((ComboBox) hmIdentite.get("cbSuffixe")).getValue();
996
			
996
			
997
			if (valSuffixe != null)	{
997
			if (valSuffixe != null)	{
998
				suffixe = valSuffixe.getNom();
998
				suffixe = valSuffixe.getNom();
999
			} else 	{
999
			} else 	{
1000
				suffixe =  (String) ((ComboBox) hmIdentite.get("cbSuffixe")).getRawValue();
1000
				suffixe =  (String) ((ComboBox) hmIdentite.get("cbSuffixe")).getRawValue();
1001
			}
1001
			}
1002
			
1002
			
1003
			// Mettre à jour la valeur
1003
			// Mettre à jour la valeur
1004
			valeurRetour = prefixe + " " + prenom + " " + nom + " " + suffixe;
1004
			valeurRetour = prefixe + " " + prenom + " " + nom + " " + suffixe;
1005
			valeurRetour = valeurRetour.replaceAll("null", "");
1005
			valeurRetour = valeurRetour.replaceAll("null", "");
1006
			
1006
			
1007
			((LabelField) hmIdentite.get("nomComplet")).setValue(valeurRetour);
1007
			((LabelField) hmIdentite.get("nomComplet")).setValue(valeurRetour);
1008
			
1008
			
1009
			if (!valeurRetour.trim().equals(""))	{
1009
			if (!valeurRetour.trim().equals(""))	{
1010
				((LabelField) hmIdentite.get("nomComplet")).show();
1010
				((LabelField) hmIdentite.get("nomComplet")).show();
1011
			} else {
1011
			} else {
1012
				((LabelField) hmIdentite.get("nomComplet")).hide();
1012
				((LabelField) hmIdentite.get("nomComplet")).hide();
1013
			}
1013
			}
1014
		}
1014
		}
1015
		
1015
		
1016
		mediateur.masquerPopinChargement();
1016
		mediateur.masquerPopinChargement();
1017
		
1017
		
1018
		if (this.mode.equals(MODE_AJOUTER))	{
1018
		if (this.mode.equals(MODE_AJOUTER))	{
1019
			gererEtatActivationBouton();
1019
			gererEtatActivationBouton();
1020
		}
1020
		}
1021
	}
1021
	}
1022
 
1022
 
1023
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap(); 
1023
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap(); 
1024
	public void remplirCombobox(String idComboBox, List liste, String hashMapId)	{
1024
	public void remplirCombobox(String idComboBox, List liste, String hashMapId)	{
1025
	
1025
	
1026
		HashMap hm = null;
1026
		HashMap hm = null;
1027
		if (hashMapId.equals("hmIdentite"))	{
1027
		if (hashMapId.equals("hmIdentite"))	{
1028
			hm = hmIdentite;
1028
			hm = hmIdentite;
1029
		} else if (hashMapId.equals("hmAdresse")){
1029
		} else if (hashMapId.equals("hmAdresse")){
1030
			hm = hmAdresse;
1030
			hm = hmAdresse;
1031
		} else {
1031
		} else {
1032
			hm = hmInfosNat;
1032
			hm = hmInfosNat;
1033
		}
1033
		}
1034
		
1034
		
1035
		ListStore<Valeur> store = ((ComboBox) hm.get(idComboBox)).getStore();
1035
		ListStore<Valeur> store = ((ComboBox) hm.get(idComboBox)).getStore();
1036
		
1036
		
1037
		store.removeAll();
1037
		store.removeAll();
1038
		store.add(liste);
1038
		store.add(liste);
1039
		((ComboBox) hm.get(idComboBox)).setStore(store);
1039
		((ComboBox) hm.get(idComboBox)).setStore(store);
1040
		
1040
		
1041
	}
1041
	}
1042
	
1042
	
1043
	
1043
	
1044
	private void gererEtatActivationBouton()	{
1044
	private void gererEtatActivationBouton()	{
1045
		
1045
		
1046
		if (((Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT)).isIdentifie() == false)	{			
1046
		if (((Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT)).isIdentifie() == false)	{			
1047
			enregistrer.setEnabled(false);
1047
			enregistrer.setEnabled(false);
1048
			enregistrerEtRevenir.setEnabled(false);
1048
			enregistrerEtRevenir.setEnabled(false);
1049
		} else	{
1049
		} else	{
1050
			enregistrer.setEnabled(true);
1050
			enregistrer.setEnabled(true);
1051
			enregistrerEtRevenir.setEnabled(true);
1051
			enregistrerEtRevenir.setEnabled(true);
1052
		}
1052
		}
1053
			
1053
			
1054
	}
1054
	}
1055
	
1055
	
1056
	public void reinitialiser()	{
1056
	public void reinitialiser()	{
1057
	 
1057
	 
1058
		mediateur.afficherPopinChargement();
1058
		mediateur.afficherPopinChargement();
1059
		
1059
		
1060
		binderPersonne(personneSauvegarde);
1060
		binderPersonne(personneSauvegarde);
1061
		layout();
1061
		layout();
1062
		
1062
		
1063
		mediateur.masquerPopinChargement();
1063
		mediateur.masquerPopinChargement();
1064
	}
1064
	}
1065
	
1065
	
1066
	
1066
	
1067
	
1067
	
1068
	public void binderPersonne(Personne personne)	{
1068
	public void binderPersonne(Personne personne)	{
1069
		
1069
		
1070
		binding = new FormBinding(this);
1070
		binding = new FormBinding(this);
1071
			
1071
			
1072
		personneSelectionnee = personne;
1072
		personneSelectionnee = personne;
1073
		binding.autoBind();
1073
		binding.autoBind();
1074
		binding.bind(personneSelectionnee);
1074
		binding.bind(personneSelectionnee);
1075
		
1075
		
1076
		layout();
1076
		layout();
1077
	}
1077
	}
1078
 
1078
 
1079
	/**
1079
	/**
1080
	 * Enregistre les information de la personne en cours 
1080
	 * Enregistre les information de la personne en cours 
1081
	 * 
1081
	 * 
1082
	 */
1082
	 */
1083
	public boolean enregistrer()	{
1083
	public boolean enregistrer()	{
1084
		
1084
		
1085
		boolean success = false;
1085
		boolean success = false;
1086
		LinkedList lstMessageErreur = new LinkedList<String>();
1086
		LinkedList lstMessageErreur = new LinkedList<String>();
1087
		
1087
		
1088
		ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
1088
		ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets");
1089
		Projet projet = cbProjets.getValue();
1089
		Projet projet = cbProjets.getValue();
1090
		if (projet == null)	{
1090
		if (projet == null)	{
1091
			lstMessageErreur.add("Le projet n'a pas été renseigné");
1091
			lstMessageErreur.add("Le projet n'a pas été renseigné");
1092
		} else {
1092
		} else {
1093
			personneSelectionnee.set("ce_projet", projet.getId());
1093
			personneSelectionnee.set("ce_projet", projet.getId());
1094
		}
1094
		}
1095
		
1095
		
1096
		String strTfNom = ((TextField<String>) hmIdentite.get("tfNom")).getValue();
1096
		String strTfNom = ((TextField<String>) hmIdentite.get("tfNom")).getValue();
1097
		if ((strTfNom == null)||(strTfNom.trim().equals("")))	{
1097
		if ((strTfNom == null)||(strTfNom.trim().equals("")))	{
1098
			lstMessageErreur.add("Le nom n'a pas été saisi");
1098
			lstMessageErreur.add("Le nom n'a pas été saisi");
1099
		} else {
1099
		} else {
1100
			strTfNom = UtilString.ucFirst(strTfNom);
1100
			strTfNom = UtilString.ucFirst(strTfNom);
1101
			personneSelectionnee.set("nom", strTfNom);
1101
			personneSelectionnee.set("nom", strTfNom);
1102
		}
1102
		}
1103
		
1103
		
1104
		String strTfPrenom = ((TextField<String>) hmIdentite.get("tfPrenom")).getValue();
1104
		String strTfPrenom = ((TextField<String>) hmIdentite.get("tfPrenom")).getValue();
1105
		personneSelectionnee.set("prenom", UtilString.ucFirst(strTfPrenom));
1105
		personneSelectionnee.set("prenom", UtilString.ucFirst(strTfPrenom));
1106
		
1106
		
1107
		//Préparer les données
1107
		//Préparer les données
1108
		ComboBox combo = (ComboBox) hmIdentite.get("cbSexe");
1108
		ComboBox combo = (ComboBox) hmIdentite.get("cbSexe");
1109
		Valeur valeur;
1109
		Valeur valeur;
1110
		String strValeur = "";
1110
		String strValeur = "";
1111
		
1111
		
1112
		valeur = (Valeur) combo.getValue();
1112
		valeur = (Valeur) combo.getValue();
1113
		if (valeur!=null)	{
1113
		if (valeur!=null)	{
1114
			personneSelectionnee.set("ce_sexe", valeur.getId());
1114
			personneSelectionnee.set("ce_sexe", valeur.getId());
1115
		}
1115
		}
1116
		
1116
		
1117
		strValeur = obtenirValeurCombo("cbPrefixe");
1117
		strValeur = obtenirValeurCombo("cbPrefixe");
1118
		personneSelectionnee.set("ce_truk_prefix", strValeur);
1118
		personneSelectionnee.set("ce_truk_prefix", strValeur);
1119
		
1119
		
1120
		strValeur = obtenirValeurCombo("cbSuffixe"); 
1120
		strValeur = obtenirValeurCombo("cbSuffixe"); 
1121
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1121
		personneSelectionnee.set("ce_truk_suffix", strValeur);
1122
		
1122
		
1123
		personneSelectionnee.set("truk_courriel", ((ChampMultiValeurs) hmIdentite.get("courriels")).getValeurs());
1123
		personneSelectionnee.set("truk_courriel", ((ChampMultiValeurs) hmIdentite.get("courriels")).getValeurs());
1124
		
1124
		
1125
		
1125
		
1126
		//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
1126
		//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id
1127
		String strPrefixe = "";
1127
		String strPrefixe = "";
1128
		combo = (ComboBox) hmIdentite.get("cbPrefixe");
1128
		combo = (ComboBox) hmIdentite.get("cbPrefixe");
1129
		valeur = (Valeur) combo.getValue();
1129
		valeur = (Valeur) combo.getValue();
1130
		if (valeur != null)	{
1130
		if (valeur != null)	{
1131
			strPrefixe = valeur.getNom();
1131
			strPrefixe = valeur.getNom();
1132
		} else {
1132
		} else {
1133
			strPrefixe = combo.getRawValue();
1133
			strPrefixe = combo.getRawValue();
1134
		}
1134
		}
1135
		
1135
		
1136
		String strSuffixe = "";
1136
		String strSuffixe = "";
1137
		combo = (ComboBox) hmIdentite.get("cbSuffixe");
1137
		combo = (ComboBox) hmIdentite.get("cbSuffixe");
1138
		valeur = (Valeur) combo.getValue();
1138
		valeur = (Valeur) combo.getValue();
1139
		if (valeur != null)	{
1139
		if (valeur != null)	{
1140
			strSuffixe = valeur.getNom() + " ";
1140
			strSuffixe = valeur.getNom() + " ";
1141
		} else {
1141
		} else {
1142
			strSuffixe = combo.getRawValue() +" ";
1142
			strSuffixe = combo.getRawValue() +" ";
1143
		}
1143
		}
1144
		
1144
		
1145
		personneSelectionnee.setFmtNomComplet(strPrefixe, strSuffixe);
1145
		personneSelectionnee.setFmtNomComplet(strPrefixe, strSuffixe);
1146
		
1146
		
1147
		
1147
		
1148
		DateField dfDateNaissance = (DateField) hmIdentite.get("dfDateNaissance");
1148
		DateField dfDateNaissance = (DateField) hmIdentite.get("dfDateNaissance");
1149
		Date naissanceDate = dfDateNaissance.getValue();
1149
		Date naissanceDate = dfDateNaissance.getValue();
1150
		personneSelectionnee.setNaissanceDate(naissanceDate);
1150
		personneSelectionnee.setNaissanceDate(naissanceDate);
1151
		
1151
		
1152
		Radio rbEstDecedee = (Radio) hmIdentite.get("rbEstDecedee");
1152
		Radio rbEstDecedee = (Radio) hmIdentite.get("rbEstDecedee");
1153
		if (rbEstDecedee.getValue().equals(true))	{
1153
		if (rbEstDecedee.getValue().equals(true))	{
1154
			
1154
			
1155
			DateField dfDecesDate = (DateField) hmIdentite.get("dfDateDeces");
1155
			DateField dfDecesDate = (DateField) hmIdentite.get("dfDateDeces");
1156
			Date decesDate = dfDecesDate.getValue();
1156
			Date decesDate = dfDecesDate.getValue();
1157
			if (decesDate == null)	{
1157
			if (decesDate == null)	{
1158
				decesDate = new Date();
1158
				decesDate = new Date();
1159
			}
1159
			}
1160
			personneSelectionnee.setDecesDate(decesDate);
1160
			personneSelectionnee.setDecesDate(decesDate);
1161
			personneSelectionnee.set("deces_lieu", ((TextField<String>) hmIdentite.get("tfLieuDeces")).getValue());
1161
			personneSelectionnee.set("deces_lieu", ((TextField<String>) hmIdentite.get("tfLieuDeces")).getValue());
1162
		}
1162
		}
1163
		
1163
		
1164
		personneSelectionnee.setDecesDate(new Date());
1164
		personneSelectionnee.setDecesDate(new Date());
1165
		
1165
		
1166
		strValeur = obtenirValeurCombo("cbPays");
1166
		strValeur = obtenirValeurCombo("cbPays");
1167
		personneSelectionnee.set("ce_truk_pays", strValeur);
1167
		personneSelectionnee.set("ce_truk_pays", strValeur);
1168
		
1168
		
1169
		strValeur = obtenirValeurCombo("cbRegion");
1169
		strValeur = obtenirValeurCombo("cbRegion");
1170
		personneSelectionnee.set("ce_truk_region", strValeur);
1170
		personneSelectionnee.set("ce_truk_region", strValeur);
1171
		
1171
		
1172
		personneSelectionnee.set("truk_telephone", ((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).getValeurs());
1172
		personneSelectionnee.set("truk_telephone", ((ChampMultiValeursMultiTypes) hmIdentite.get("telephones")).getValeurs());
1173
		
1173
		
1174
		String logoUrls = ((ChampMultiValeursImage) hmIdentite.get("logos")).getValeurs();
1174
		String logoUrls = ((ChampMultiValeursImage) hmIdentite.get("logos")).getValeurs();
1175
		personneSelectionnee.set("truk_logo", logoUrls);
1175
		personneSelectionnee.set("truk_logo", logoUrls);
1176
		
1176
		
1177
		personneSelectionnee.set("truk_url", ((ChampMultiValeurs) hmIdentite.get("sites")).getValeurs());
1177
		personneSelectionnee.set("truk_url", ((ChampMultiValeurs) hmIdentite.get("sites")).getValeurs());
1178
		
1178
		
1179
		if (lstMessageErreur.size() == 0)	{
1179
		if (lstMessageErreur.size() == 0)	{
1180
			mediateur.enregistrerPersonne(this, personneSelectionnee);
1180
			mediateur.enregistrerPersonne(this, personneSelectionnee);
1181
			success = true;
1181
			success = true;
1182
		} else {
1182
		} else {
1183
			String strMessagesErreur = "<span><br />";
1183
			String strMessagesErreur = "<span><br />";
1184
			Iterator<String> itMessagesErreur = lstMessageErreur.iterator();
1184
			Iterator<String> itMessagesErreur = lstMessageErreur.iterator();
1185
			while (itMessagesErreur.hasNext())	{
1185
			while (itMessagesErreur.hasNext())	{
1186
				strMessagesErreur += "<br /> - " + itMessagesErreur.next();
1186
				strMessagesErreur += "<br /> - " + itMessagesErreur.next();
1187
			}
1187
			}
1188
			strMessagesErreur += "</span>";
1188
			strMessagesErreur += "</span>";
1189
			
1189
			
1190
 			MessageBox.alert("Erreurs", "Les erreurs suivantes ont été commises : \n" + strMessagesErreur, null);
1190
 			MessageBox.alert("Erreurs", "Les erreurs suivantes ont été commises : \n" + strMessagesErreur, null);
1191
 			success = false;
1191
 			success = false;
1192
		}
1192
		}
1193
		
1193
		
1194
		return success;
1194
		return success;
1195
	}
1195
	}
1196
	
1196
	
1197
	private String obtenirValeurCombo(String strComboName)	{
1197
	private String obtenirValeurCombo(String strComboName)	{
1198
		
1198
		
1199
		String strValeur = "";
1199
		String strValeur = "";
1200
		Valeur valeur;
1200
		Valeur valeur;
1201
		
1201
		
1202
		ComboBox combo = (ComboBox) hmIdentite.get(strComboName);
1202
		ComboBox combo = (ComboBox) hmIdentite.get(strComboName);
1203
		if (combo == null)	{
1203
		if (combo == null)	{
1204
			combo = (ComboBox) hmAdresse.get(strComboName);
1204
			combo = (ComboBox) hmAdresse.get(strComboName);
1205
		}
1205
		}
1206
		if (combo.getValue()!=null)	{
1206
		if (combo.getValue()!=null)	{
1207
			valeur = (Valeur) combo.getValue();
1207
			valeur = (Valeur) combo.getValue();
1208
			strValeur = valeur.getId();
1208
			strValeur = valeur.getId();
1209
		} else {
1209
		} else {
1210
			strValeur = combo.getRawValue();
1210
			strValeur = combo.getRawValue();
1211
		}
1211
		}
1212
		
1212
		
1213
		return strValeur;
1213
		return strValeur;
1214
	}
1214
	}
1215
}
1215
}