Subversion Repositories eFlore/Applications.coel

Rev

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

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