Subversion Repositories eFlore/Applications.coel

Rev

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

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