Subversion Repositories eFlore/Applications.coel

Rev

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

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