Subversion Repositories eFlore/Applications.coel

Rev

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

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