Subversion Repositories eFlore/Applications.coel

Rev

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

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