Subversion Repositories eFlore/Applications.coel

Rev

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

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