Subversion Repositories eFlore/Applications.coel

Rev

Rev 356 | Rev 386 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 356 Rev 376
Line 1... Line 1...
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
Line 2... Line 2...
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.HashMap;
6
import java.util.HashMap;
6
import java.util.Iterator;
7
import java.util.Iterator;
7
import java.util.LinkedList;
8
import java.util.LinkedList;
Line 22... Line 23...
22
 
23
 
23
 
24
 
24
import com.extjs.gxt.ui.client.Registry;
25
import com.extjs.gxt.ui.client.Registry;
-
 
26
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
-
 
27
import com.extjs.gxt.ui.client.Style.Scroll;
-
 
28
import com.extjs.gxt.ui.client.binding.FieldBinding;
25
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
29
import com.extjs.gxt.ui.client.binding.FormBinding;
26
import com.extjs.gxt.ui.client.Style.Scroll;
30
import com.extjs.gxt.ui.client.binding.SimpleComboBoxFieldBinding;
27
import com.extjs.gxt.ui.client.event.ComponentEvent;
31
import com.extjs.gxt.ui.client.event.ComponentEvent;
28
import com.extjs.gxt.ui.client.event.KeyListener;
32
import com.extjs.gxt.ui.client.event.KeyListener;
29
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
33
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
Line 45... Line 49...
45
import com.extjs.gxt.ui.client.widget.form.DateField;
49
import com.extjs.gxt.ui.client.widget.form.DateField;
46
import com.extjs.gxt.ui.client.widget.form.FieldSet;
50
import com.extjs.gxt.ui.client.widget.form.FieldSet;
47
import com.extjs.gxt.ui.client.widget.form.FormPanel;
51
import com.extjs.gxt.ui.client.widget.form.FormPanel;
48
import com.extjs.gxt.ui.client.widget.form.HiddenField;
52
import com.extjs.gxt.ui.client.widget.form.HiddenField;
49
import com.extjs.gxt.ui.client.widget.form.LabelField;
53
import com.extjs.gxt.ui.client.widget.form.LabelField;
-
 
54
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
50
import com.extjs.gxt.ui.client.widget.form.TextArea;
55
import com.extjs.gxt.ui.client.widget.form.TextArea;
51
import com.extjs.gxt.ui.client.widget.form.TextField;
56
import com.extjs.gxt.ui.client.widget.form.TextField;
52
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
57
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
53
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
58
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
54
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
59
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
Line 65... Line 70...
65
import com.google.gwt.user.client.Window;
70
import com.google.gwt.user.client.Window;
66
import com.google.gwt.user.client.ui.Widget;
71
import com.google.gwt.user.client.ui.Widget;
Line -... Line 72...
-
 
72
 
67
 
73
 
Line 68... Line 74...
68
 
74
 
69
 
75
 
70
public class FormPersonneVue extends ContentPanel implements Rafraichissable {
76
public class FormPersonneVue extends FormPanel implements Rafraichissable {
71
	
77
	
Line 72... Line 78...
72
	
78
	
73
	/*--------------------------------------------------------------------------------------
79
	/*--------------------------------------------------------------------------------------
74
	 * 		VARIABLES
80
	 * 		VARIABLES
75
	 * -------------------------------------------------------------------------------------
81
	 * -------------------------------------------------------------------------------------
-
 
82
	 */
-
 
83
	
-
 
84
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
Line 76... Line 85...
76
	 */
85
	private Mediateur mediateur = Registry.get(RegistreId.MEDIATEUR);
77
	
86
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
78
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
87
	private Personne personneSelectionnee, personneSauvegarde = null;
79
	private Mediateur mediateur = Registry.get(RegistreId.MEDIATEUR);
88
	
Line 90... Line 99...
90
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le 
99
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le 
91
	 * formulaire et annuler la saisie). 
100
	 * formulaire et annuler la saisie). 
92
	 * 
101
	 * 
93
	 * */
102
	 * */
94
	public FormPersonneVue() {
103
	public FormPersonneVue() {
95
		
-
 
96
		initialiserComposants(null);
104
		initialiserComposants(null);
97
		
-
 
98
	}
105
	}
Line 99... Line 106...
99
	
106
	
Line 100... Line 107...
100
	public FormPersonneVue(Personne personne)	{
107
	public FormPersonneVue(Personne personne)	{
101
		
108
		
Line 102... Line 109...
102
		initialiserComposants(personne);		
109
		initialiserComposants(personne);		
Line -... Line 110...
-
 
110
	}
-
 
111
	
-
 
112
	public void initialiserComposants(Personne personne)	{
103
	}
113
		
Line 104... Line 114...
104
	
114
		personneSelectionnee = new Personne();
105
	public void initialiserComposants(Personne personne)	{
115
		personneSauvegarde = new Personne();
Line 126... Line 136...
126
		creerComposantsAdresse();
136
		creerComposantsAdresse();
Line 127... Line 137...
127
		
137
		
Line 128... Line 138...
128
		layout();
138
		layout();
-
 
139
		
-
 
140
		rafraichir(personne);
129
		
141
		binderPersonne(personneSelectionnee);
Line 130... Line 142...
130
		rafraichir(personne);
142
		
131
	}
143
	}
Line 140... Line 152...
140
	 * 
152
	 * 
141
	 * @param contentPanel le panneau à initialiser
153
	 * @param contentPanel le panneau à initialiser
142
	 * */
154
	 * */
143
	public void initialiserPanneau()	{
155
	public void initialiserPanneau()	{
Line 144... Line -...
144
		
-
 
-
 
156
		
145
		setLayout(new FitLayout());
157
		
146
		setIconStyle("icone-form-ajouter");  
158
		setIconStyle("icone-form-ajouter");  
147
		setCollapsible(false);  
159
		setCollapsible(false);  
148
		setHeading("Ajouter une personne");
160
		setHeading("Ajouter une personne");
149
		setButtonAlign(HorizontalAlignment.CENTER);  
161
		setButtonAlign(HorizontalAlignment.CENTER);  
-
 
162
		setLayout(new FormLayout());
-
 
163
		setBodyBorder(false);
-
 
164
		setBorders(false);
-
 
165
		
-
 
166
		
-
 
167
		setPadding(0);
150
		setLayout(new FormLayout());
168
		setWidth("100%");
Line 151... Line 169...
151
	}
169
	}
152
	
170
	
153
	/**
171
	/**
154
	 * Crée les onglets identité, adresse et informations naturaliste
172
	 * Crée les onglets identité, adresse et informations naturaliste
155
	 * 
173
	 * 
156
	 * */
174
	 * */
157
	public void initialiserOnglets()	{
175
	public void initialiserOnglets()	{
-
 
176
		//TabPanel
-
 
177
		TabPanel formulaireOnglets = new TabPanel();
Line 158... Line 178...
158
		//TabPanel
178
		formulaireOnglets.setBodyBorder(true);
159
		TabPanel formulaireOnglets = new TabPanel();
179
		
160
		
180
		
161
		//Tab 1 : identite
181
		//Tab 1 : identite
Line 191... Line 211...
191
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
211
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
192
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
212
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
193
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
213
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
194
	private FormData fd100 = new FormData("1");
214
	private FormData fd100 = new FormData("1");
Line 195... Line -...
195
	
-
 
196
	
215
	
Line 197... Line -...
197
	public void creerComposantsIdentite()	{
-
 
198
		
216
	public void creerComposantsIdentite()	{
199
		// Gestion de l'affichage en colonnes
-
 
200
			// On crée 3 Layout container : un principal, un pour la colonne de gauche, un pour la colonne de droite
-
 
201
		
217
		
202
			// Gauche
218
			// Gestion de l'affichage en colonnes : 3 Layout container : principal, gauche & droite
Line 203... Line -...
203
			LayoutContainer left = new LayoutContainer();
-
 
204
			left.setLayout(new FormLayout());
219
			LayoutContainer left = new LayoutContainer();
205
			
220
			left.setLayout(new FormLayout());
Line 206... Line -...
206
			// Droite
-
 
207
			LayoutContainer right = new LayoutContainer();
221
			
208
			right.setLayout(new FormLayout());
222
			LayoutContainer right = new LayoutContainer();
Line 209... Line -...
209
			
-
 
210
			// Principal
223
			right.setLayout(new FormLayout());
211
			LayoutContainer main = new LayoutContainer();
224
			
Line 212... Line 225...
212
			main.setLayout(new ColumnLayout());
225
			LayoutContainer main = new LayoutContainer();
213
			
-
 
214
			// Ajout au principal
-
 
215
			main.add(left, new ColumnData(.49));
226
			main.setLayout(new ColumnLayout());
216
			main.add(right, new ColumnData(.49));			
-
 
217
			
-
 
218
			// Création des champs
-
 
219
			
-
 
220
			//FormLayout sera utilisé à plusieurs reprises
227
			
221
			FormLayout formLayout = new FormLayout();
-
 
222
			
-
 
223
			FieldSet fsNoms = new FieldSet();
-
 
224
			fsNoms.setHeading("Noms");
-
 
225
			
-
 
226
			formLayout.setLabelAlign(LabelAlign.LEFT);
-
 
227
			fsNoms.setLayout(formLayout); 
-
 
228
			
-
 
229
			// Nom complet
-
 
230
			// Affiché que si valeurs saisies
-
 
231
			LabelField nomComplet = new LabelField();
-
 
232
			nomComplet.setFieldLabel("Nom complet:");
-
 
233
			nomComplet.hide();
-
 
234
			fsNoms.add(nomComplet);
-
 
235
			
-
 
236
			hmIdentite.put("nomComplet", nomComplet);
-
 
237
			
-
 
238
			
-
 
239
			
-
 
240
			//Préfixe
-
 
241
			ComboBox<Valeur> cbPrefixe = new ComboBox<Valeur>();
-
 
242
			
-
 
243
			// Remplir la liste des préfixe
-
 
244
			mediateur.obtenirListeValeurEtRafraichir(this, "prefixe");
-
 
245
			
-
 
246
			
-
 
247
			ListStore<Valeur> storePrefixe = new ListStore<Valeur>();
-
 
248
			cbPrefixe.setStore(storePrefixe);
-
 
249
			cbPrefixe.setDisplayField("nom");
-
 
250
			cbPrefixe.setEmptyText("Choisissez le préfixe:");
-
 
251
			cbPrefixe.setFieldLabel("Prefix");
-
 
252
			fsNoms.add(cbPrefixe);			
-
 
253
			
-
 
254
			hmIdentite.put("cbPrefixe", cbPrefixe);
-
 
255
			
-
 
256
			
-
 
257
			
-
 
258
			//Prénom
-
 
259
			TextField<String> tfPrenom = new TextField<String>();
-
 
260
			tfPrenom.setFieldLabel("Prénom");
-
 
261
			fsNoms.add(tfPrenom);
-
 
262
			
-
 
263
			hmIdentite.put("tfPrenom", tfPrenom);
-
 
264
			
-
 
265
			//Nom
-
 
266
			TextField<String> tfNom = new TextField<String>();
-
 
267
			tfNom.setFieldLabel("Nom");
-
 
268
			fsNoms.add(tfNom);
-
 
269
			
-
 
270
			hmIdentite.put("tfNom", tfNom);
-
 
271
			
-
 
272
			//Suffixe
-
 
273
			ComboBox<Valeur> cbSuffixe = new ComboBox<Valeur>();
-
 
Line 274... Line 228...
274
			ListStore<Valeur> storeSuffixe = new ListStore<Valeur>();
228
			main.add(left, new ColumnData(.49));
275
			cbSuffixe.setStore(storeSuffixe);
-
 
276
			cbSuffixe.setFieldLabel("Suffixe");
229
			main.add(right, new ColumnData(.49));			
277
			cbSuffixe.setDisplayField("nom");
230
			
278
			cbSuffixe.setEmptyText("Choisissez un suffixe:");
231
			// Création des champs
279
			fsNoms.add(cbSuffixe);			
232
			FormLayout formLayout = new FormLayout();
280
			
233
			formLayout.setLabelAlign(LabelAlign.LEFT);
281
			hmIdentite.put("cbSuffixe", cbSuffixe);
234
			
282
			
235
				FieldSet fsNoms = new FieldSet();
283
			// Remplir la liste des suffixes:
-
 
284
			mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
-
 
285
			
236
				fsNoms.setHeading("Noms");
286
			// Nom : autre
-
 
287
			TextField<String> tfNomAutre = new TextField();
-
 
288
			tfNomAutre.setFieldLabel("Autres noms");
-
 
289
			fsNoms.add(tfNomAutre);
237
				fsNoms.setLayout(formLayout); 
290
			
-
 
291
			hmIdentite.put("tfNomAutre", tfNomAutre);
238
			
292
			
239
					// Nom complet : Affiché que si valeurs saisies
293
			//Abréviation
240
					LabelField nomComplet = new LabelField();
294
			TextField<String> tfAbreviation = new TextField<String>();
241
					nomComplet.setFieldLabel("Nom complet:");
295
			tfAbreviation.setFieldLabel("Abréviation");
242
					nomComplet.hide();
296
			fsNoms.add(tfAbreviation);
243
				
297
			
-
 
298
			hmIdentite.put("tfAbreviation", tfAbreviation);
-
 
299
			
-
 
300
			//Abréviation autres
-
 
301
			TextField<String> tfAbreviationAutre = new TextField<String>();
244
					fsNoms.add(nomComplet);
302
			tfAbreviationAutre.setFieldLabel("Autres Abrév.");
-
 
303
			fsNoms.add(tfAbreviationAutre);
-
 
304
			
245
					hmIdentite.put("nomComplet", nomComplet);
305
			hmIdentite.put("tfAbreviationAutre", tfAbreviationAutre);
246
			
306
			
247
					//Préfixe
307
			
-
 
308
			left.add(fsNoms);
-
 
309
			
-
 
310
			// Naissance
248
					ListStore<Valeur> storePrefixe = new ListStore<Valeur>();
311
			FieldSet fsNaissance = new FieldSet();
249
					ComboBox<Valeur> cbPrefixe = new ComboBox<Valeur>();
312
			fsNaissance.setHeading("Naissance");
250
					cbPrefixe.setStore(storePrefixe);
313
			
-
 
314
			formLayout = new FormLayout();
251
					cbPrefixe.setDisplayField("nom");
315
			formLayout.setLabelAlign(LabelAlign.LEFT);
252
					cbPrefixe.setEmptyText("Choisissez le préfixe:");
316
			fsNaissance.setLayout(formLayout); 
-
 
Line -... Line 253...
-
 
253
					cbPrefixe.setFieldLabel("Prefix");
-
 
254
					
-
 
255
					
-
 
256
					fsNoms.add(cbPrefixe);
-
 
257
					hmIdentite.put("cbPrefixe", cbPrefixe);
-
 
258
					
317
			
259
					mediateur.obtenirListeValeurEtRafraichir(this, "prefixe");
-
 
260
			
-
 
261
					//Prénom
-
 
262
					TextField<String> tfPrenom = new TextField<String>();
-
 
263
					tfPrenom.setFieldLabel("Prénom");
-
 
264
					tfPrenom.setName("prenom");
-
 
265
			
-
 
266
					fsNoms.add(tfPrenom);
-
 
267
					hmIdentite.put("tfPrenom", tfPrenom);
-
 
268
			
Line 318... Line 269...
318
			// Date naissance
269
					//Nom
319
			DateField dfDateNaissance = new DateField();
270
					TextField<String> tfNom = new TextField<String>();
-
 
271
					tfNom.setFieldLabel("Nom");
-
 
272
					tfNom.setName("nom");
320
			dfDateNaissance.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
273
					
-
 
274
					fsNoms.add(tfNom);
-
 
275
					hmIdentite.put("tfNom", tfNom);
-
 
276
					
321
			
277
			
-
 
278
					//Suffixe
-
 
279
					ListStore<Valeur> storeSuffixe = new ListStore<Valeur>();
-
 
280
					ComboBox<Valeur> cbSuffixe = new ComboBox<Valeur>();
Line -... Line 281...
-
 
281
					cbSuffixe.setStore(storeSuffixe);
-
 
282
					cbSuffixe.setFieldLabel("Suffixe");
-
 
283
					cbSuffixe.setDisplayField("nom");
-
 
284
					cbSuffixe.setEmptyText("Choisissez un suffixe:");
-
 
285
					
-
 
286
					fsNoms.add(cbSuffixe);			
-
 
287
					hmIdentite.put("cbSuffixe", cbSuffixe);
-
 
288
					
-
 
289
					mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
-
 
290
			
-
 
291
					
-
 
292
					TextField<String> tfNomAutre = new TextField();
-
 
293
					tfNomAutre.setFieldLabel("Autres noms");
-
 
294
					
-
 
295
					fsNoms.add(tfNomAutre);
-
 
296
					hmIdentite.put("tfNomAutre", tfNomAutre);
-
 
297
					
-
 
298
					TextField<String> tfAbreviation = new TextField<String>();
-
 
299
					tfAbreviation.setFieldLabel("Abréviation");
-
 
300
					tfAbreviation.setName("abreviation");
-
 
301
					
-
 
302
					fsNoms.add(tfAbreviation);
-
 
303
					hmIdentite.put("tfAbreviation", tfAbreviation);
-
 
304
					
-
 
305
					
-
 
306
					//Abréviation autres
-
 
307
					TextField<String> tfAbreviationAutre = new TextField<String>();
-
 
308
					tfAbreviationAutre.setFieldLabel("Autres Abrév.");
-
 
309
					tfAbreviationAutre.setName("truk_abreviation_autre");
-
 
310
					
-
 
311
					fsNoms.add(tfAbreviationAutre);
-
 
312
					hmIdentite.put("tfAbreviationAutre", tfAbreviationAutre);
-
 
313
										
-
 
314
				left.add(fsNoms);
-
 
315
			
-
 
316
				formLayout = new FormLayout();
-
 
317
				formLayout.setLabelAlign(LabelAlign.LEFT);
-
 
318
			
-
 
319
			
-
 
320
				FieldSet fsNaissance = new FieldSet();
-
 
321
				fsNaissance.setHeading("Naissance");
-
 
322
				fsNaissance.setLayout(formLayout); 
-
 
323
			
-
 
324
					DateField dfDateNaissance = new DateField();
-
 
325
					dfDateNaissance.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
-
 
326
					dfDateNaissance.setFieldLabel("Date");
-
 
327
					dfDateNaissance.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
322
			dfDateNaissance.setFieldLabel("Date");
328
					
-
 
329
					fsNaissance.add(dfDateNaissance);
-
 
330
					hmIdentite.put("dfDateNaissance", dfDateNaissance);
Line 323... Line 331...
323
			fsNaissance.add(dfDateNaissance);
331
					
-
 
332
					// Lieu naissance
Line 324... Line -...
324
			
-
 
325
			hmIdentite.put("dfDateNaissance", dfDateNaissance);
333
					TextField<String> tfLieuNaissance = new TextField();
326
			
334
					tfLieuNaissance.setFieldLabel("Lieu");
-
 
335
					tfLieuNaissance.setName("naissance_lieu");
-
 
336
					
-
 
337
					fsNaissance.add(tfLieuNaissance);
-
 
338
					hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
-
 
339
					
-
 
340
				left.add(fsNaissance);
-
 
341
			
Line 327... Line 342...
327
			// Lieu naissance
342
				formLayout = new FormLayout();
-
 
343
				formLayout.setLabelAlign(LabelAlign.LEFT);
-
 
344
			
-
 
345
				FieldSet fsDeces = new FieldSet();
-
 
346
				fsDeces.setHeading("Décès");
328
			TextField<String> tfLieuNaissance = new TextField();
347
				fsDeces.setLayout(formLayout); 
-
 
348
			
-
 
349
					DateField dfDateDeces = new DateField();
329
			tfLieuNaissance.setFieldLabel("Lieu");
350
					dfDateDeces.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
-
 
351
					dfDateDeces.setFormatValue(true);
-
 
352
					dfDateDeces.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
-
 
353
					dfDateDeces.setFieldLabel("Date");
Line 330... Line 354...
330
			fsNaissance.add(tfLieuNaissance);
354
			
331
			
-
 
332
			hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
-
 
333
			
-
 
334
			left.add(fsNaissance);
-
 
Line -... Line 355...
-
 
355
					fsDeces.add(dfDateDeces);
-
 
356
					hmIdentite.put("dfDateDeces", dfDateDeces);
-
 
357
					
-
 
358
 
-
 
359
					TextField<String> tfLieuDeces = new TextField();
-
 
360
					tfLieuDeces.setFieldLabel("Lieu");
-
 
361
					tfLieuDeces.setName("deces_lieu");
-
 
362
					
-
 
363
					fsDeces.add(tfLieuDeces);
-
 
364
					hmIdentite.put("tfLieuDeces", tfLieuDeces);
-
 
365
								
335
			
366
				left.add(fsDeces);
-
 
367
			
-
 
368
			tiIdentite.add(main);
-
 
369
			
-
 
370
				FieldSet fsContactTel = new FieldSet();
-
 
371
				fsContactTel.setHeading("Contact - Téléphones");
-
 
372
				fsContactTel.setLayout(new RowLayout());
-
 
373
				
-
 
374
				right.add(fsContactTel);
336
			// Deces
375
				hmIdentite.put("fsContactTel", fsContactTel);
-
 
376
				
-
 
377
					LayoutContainer lcTelephone = new LayoutContainer();
-
 
378
					lcTelephone.setLayout(new ColumnLayout());
Line 337... Line 379...
337
			FieldSet fsDeces = new FieldSet();
379
					
Line -... Line 380...
-
 
380
						TextField tfTelephone = new TextField();
-
 
381
						tfTelephone.setFieldLabel("tel");
-
 
382
						lcTelephone.add(tfTelephone, new ColumnData(0.40));
-
 
383
				
-
 
384
						hmIdentite.put("tfTelephone", tfTelephone);
-
 
385
				
-
 
386
						ListStore<Valeur> storeTel = new ListStore<Valeur>();
-
 
387
						ComboBox<Valeur> cbTelephone = new ComboBox<Valeur>();
-
 
388
						cbTelephone.setDisplayField("nom");
-
 
389
						cbTelephone.setEmptyText("Choisissez:");
-
 
390
						cbTelephone.setStore(storeTel);
338
			fsDeces.setHeading("Décès");
391
						
-
 
392
						lcTelephone.add(cbTelephone, new ColumnData(0.40));
339
			
393
						hmIdentite.put("cbTelephone", cbTelephone);
340
			formLayout = new FormLayout();
394
			
-
 
395
						mediateur.obtenirListeValeurEtRafraichir(this, "tel");
-
 
396
			
-
 
397
						IconButton bAjouter = new IconButton(ComposantClass.ICONE_AJOUTER);
-
 
398
						bAjouter.addSelectionListener(
-
 
399
								new SelectionListener<ComponentEvent>() {
-
 
400
						
-
 
401
									public void componentSelected(ComponentEvent ce) {
341
			formLayout.setLabelAlign(LabelAlign.LEFT);
402
							
-
 
403
										String strTelephone = ((TextField<String>) hmIdentite.get("tfTelephone")).getValue();
-
 
404
										if ((strTelephone==null)||(strTelephone.trim().equals("")))	{
-
 
405
											MessageBox.alert("Erreur de saisie", "Vous devez saisir un numéro de téléphone", null);
-
 
406
										} else if (hmIdentite.get("tel-" + strTelephone) != null){
-
 
407
											MessageBox.alert("Erreur de saisie", "Le numéro saisi est déjà présent dans la liste", null);							
-
 
408
										} else {
-
 
409
								
-
 
410
												String strValeurTypeTel = "";
-
 
411
												String idTel = "";
-
 
412
												Valeur valeurTypeTel = ((ComboBox<Valeur>) hmIdentite.get("cbTelephone")).getValue();
-
 
413
									
-
 
414
												if (valeurTypeTel != null)	{
Line -... Line 415...
-
 
415
													strValeurTypeTel = valeurTypeTel.getNom();
-
 
416
													idTel = valeurTypeTel.get("abreviation");
-
 
417
												}	else {
-
 
418
													strValeurTypeTel = ((ComboBox<Valeur>) hmIdentite.get("cbTelephone")).getRawValue();
342
			fsDeces.setLayout(formLayout); 
419
													idTel = strValeurTypeTel;
-
 
420
												}
-
 
421
									
Line 343... Line -...
343
			
-
 
Line -... Line 422...
-
 
422
									
-
 
423
												if (strValeurTypeTel.trim().equals(""))	{
344
			// Date décès
424
													MessageBox.alert("Erreur de saisie", "Vous devez saisir un type de téléphone", null);
-
 
425
												}	else {
Line 345... Line 426...
345
			DateField dfDateDeces = new DateField();
426
													ajouterTelephone(strTelephone, strValeurTypeTel, idTel);
346
			dfDateDeces.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
-
 
347
			dfDateDeces.setFormatValue(true);
-
 
348
			dfDateDeces.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
-
 
349
			
427
												}
Line -... Line 428...
-
 
428
											}
350
			dfDateDeces.setFieldLabel("Date");
429
										}
-
 
430
									}			
Line 351... Line -...
351
			fsDeces.add(dfDateDeces);
-
 
352
			
-
 
353
			hmIdentite.put("dfDateDeces", dfDateDeces);
431
								);
Line -... Line 432...
-
 
432
			
-
 
433
						lcTelephone.add(bAjouter, new ColumnData(0.15));
Line 354... Line 434...
354
			
434
						
-
 
435
						HiddenField<String> hfTelephone = new HiddenField<String>();
-
 
436
						add(hfTelephone);
-
 
437
						hmIdentite.put("hfTelephone", hfTelephone);
-
 
438
					
-
 
439
					fsContactTel.add(lcTelephone);
-
 
440
			
-
 
441
			
-
 
442
					FieldSet fsContact = new FieldSet();
355
			// Lieu décès
443
					fsContact.setHeading("Contact - Autres");
-
 
444
					fsContact.setId("fsContact");
-
 
445
					fsContact.setLayout(new RowLayout());
-
 
446
			
356
			TextField<String> tfLieuDeces = new TextField();
447
					right.add(fsContact);
Line -... Line 448...
-
 
448
					hmIdentite.put("fsContact", fsContact);
357
			tfLieuDeces.setFieldLabel("Lieu");
449
			
-
 
450
 
-
 
451
					LabelField lfCourriel = new LabelField();
-
 
452
					lfCourriel.setText("<b>Courriels:</b>");
-
 
453
			
-
 
454
					fsContact.add(lfCourriel);
-
 
455
			
-
 
456
			
-
 
457
					LayoutContainer lcCourriel = new LayoutContainer();
-
 
458
					lcCourriel.setLayout(new ColumnLayout());
-
 
459
			
-
 
460
						TextField tfCourriel = new TextField();
-
 
461
						lcCourriel.add(tfCourriel, new ColumnData(0.80));
-
 
462
						
-
 
463
						HiddenField hfHiddenCourriel = new HiddenField();
-
 
464
						hfHiddenCourriel.setId("tfHiddenCourriel");
-
 
465
						hfHiddenCourriel.setValue("");
-
 
466
						add(hfHiddenCourriel);
-
 
467
						hmIdentite.put("hfHiddenCourriel", hfHiddenCourriel);
-
 
468
						
-
 
469
						//tfHiddenCourriel.setVisible(true);
-
 
470
						
-
 
471
						
-
 
472
						
-
 
473
						hmIdentite.put("tfCourriel", tfCourriel);
-
 
474
			
Line 358... Line 475...
358
			fsDeces.add(tfLieuDeces);
475
						IconButton bAjouterCourriel = new IconButton(ComposantClass.ICONE_AJOUTER);
-
 
476
						bAjouterCourriel.addSelectionListener(
359
			
477
								new SelectionListener<ComponentEvent>() {
Line 360... Line 478...
360
			hmIdentite.put("tfLieuDeces", tfLieuDeces);
478
						
-
 
479
									public void componentSelected(ComponentEvent ce) {
361
			
480
										
362
			left.add(fsDeces);
481
										String strEmail = ((TextField<String>) hmIdentite.get("tfCourriel")).getValue();
363
			
-
 
Line -... Line 482...
-
 
482
										
364
			tiIdentite.add(main);
483
										if ((strEmail==null)||(strEmail.trim().equals("")))	{
-
 
484
											MessageBox.alert("Erreur de saisie", "Vous devez saisir une adresse", null);
-
 
485
										} else if (hmIdentite.get("email-" + strEmail) != null){
-
 
486
											MessageBox.alert("Erreur de saisie", "L'adresse saisie est déjà dans la liste", null);							
Line -... Line 487...
-
 
487
										} else {
365
			
488
											
Line 366... Line 489...
366
			// Contact - Téléphone
489
											if (!strEmail.matches("(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*"))	{
-
 
490
												MessageBox.alert("Erreur de saisie", "L'adresse n'est pas au bon format (ex: me@domain.com)", null);			
Line 367... Line 491...
367
			FieldSet fsContactTel = new FieldSet();
491
											} else if (strEmail.length()>255){
368
			fsContactTel.setHeading("Contact - Téléphones");
492
												MessageBox.alert("Erreur de saisie", "L'adresse ne peut dépasser 255 caractères", null);
Line 369... Line -...
369
			fsContactTel.setLayout(new RowLayout());
-
 
370
			hmIdentite.put("fsContactTel", fsContactTel);
493
											} else {
371
			
494
												ajouterCourriel(strEmail);
372
			right.add(fsContactTel);
495
											}
373
			
496
											
374
			//Téléphone
-
 
375
			LayoutContainer lcTelephone = new LayoutContainer();
-
 
376
			lcTelephone.setLayout(new ColumnLayout());
-
 
377
			
-
 
378
			
-
 
379
			
-
 
380
			TextField tfTelephone = new TextField();
-
 
Line 381... Line 497...
381
			tfTelephone.setFieldLabel("tel");
497
										}
382
			lcTelephone.add(tfTelephone, new ColumnData(0.40));
498
										
Line -... Line 499...
-
 
499
										
-
 
500
									}
383
			
501
								});
384
			hmIdentite.put("tfTelephone", tfTelephone);
502
			
385
			
503
						lcCourriel.add(bAjouterCourriel, new ColumnData(0.15));
-
 
504
					
-
 
505
					fsContact.add(lcCourriel);
-
 
506
			
-
 
507
					LayoutContainer lcCourrielContainer = new LayoutContainer(new RowLayout());
386
			//Type de téléphone
508
					
-
 
509
					fsContact.add(lcCourrielContainer);
-
 
510
					hmIdentite.put("lcCourrielContainer", lcCourrielContainer);
-
 
511
			
-
 
512
 
387
			ComboBox<Valeur> cbTelephone = new ComboBox<Valeur>();
513
					LabelField lfUrl = new LabelField();
Line 388... Line -...
388
			
-
 
389
			cbTelephone.setDisplayField("nom");
-
 
390
			cbTelephone.setEmptyText("Choisissez:");
-
 
391
			ListStore<Valeur> storeTel = new ListStore<Valeur>();
-
 
392
			cbTelephone.setStore(storeTel);
-
 
393
			
-
 
394
			lcTelephone.add(cbTelephone, new ColumnData(0.40));
514
					lfUrl.setText("<b>Sites Web:</b>");
395
			
515
					
396
			hmIdentite.put("cbTelephone", cbTelephone);
-
 
397
			
-
 
398
			mediateur.obtenirListeValeurEtRafraichir(this, "tel");
-
 
399
			
-
 
400
			// Bouton ajouter
-
 
401
			IconButton bAjouter = new IconButton(ComposantClass.ICONE_AJOUTER);
-
 
402
			
-
 
403
			// Evenement bouton
-
 
404
			bAjouter.addSelectionListener(
-
 
405
					new SelectionListener<ComponentEvent>() {
-
 
406
						
-
 
407
						public void componentSelected(ComponentEvent ce) {
-
 
408
							
-
 
409
							String strTelephone = ((TextField<String>) hmIdentite.get("tfTelephone")).getValue();
-
 
410
							if ((strTelephone==null)||(strTelephone.trim().equals("")))	{
-
 
411
								MessageBox.alert("Erreur de saisie", "Vous devez saisir un numéro de téléphone", null);
-
 
412
							} else if (hmIdentite.get("tel-" + strTelephone) != null){
-
 
413
								MessageBox.alert("Erreur de saisie", "Le numéro saisi est déjà présent dans la liste", null);							
-
 
414
							} else {
-
 
415
								
-
 
416
								String strValeurTypeTel = "";
-
 
417
								Valeur valeurTypeTel = ((ComboBox<Valeur>) hmIdentite.get("cbTelephone")).getValue();
-
 
418
								
-
 
419
								if (valeurTypeTel != null)	{
-
 
420
									strValeurTypeTel = valeurTypeTel.getNom();									
-
 
421
								}	else {
-
 
422
									strValeurTypeTel = ((ComboBox<Valeur>) hmIdentite.get("cbTelephone")).getRawValue();
-
 
423
								}
-
 
424
								
-
 
425
								
-
 
426
								if (strValeurTypeTel.trim().equals(""))	{
-
 
427
									MessageBox.alert("Erreur de saisie", "Vous devez saisir un type de téléphone", null);
-
 
428
								}	else {
-
 
429
									ajouterTelephone(strTelephone, strValeurTypeTel);
-
 
430
								}
-
 
Line 431... Line 516...
431
							}
516
					fsContact.add(lfUrl);
432
						}
517
			
433
					}			
-
 
Line 434... Line -...
434
			);
-
 
435
			
-
 
436
			lcTelephone.add(bAjouter, new ColumnData(0.15));
518
					LayoutContainer lcUrl = new LayoutContainer(new ColumnLayout());
437
			fsContactTel.add(lcTelephone);
519
					hmIdentite.put("lcUrl", lcUrl);
438
			
-
 
439
			//Contact - autres
-
 
440
			FieldSet fsContact = new FieldSet();
-
 
441
			fsContact.setHeading("Contact - Autres");
-
 
442
			fsContact.setId("fsContact");
-
 
443
			fsContact.setLayout(new RowLayout());
520
			
444
			
-
 
445
			right.add(fsContact);
521
						TextField tfUrl = new TextField();
446
			
-
 
447
			// Courriels
522
						tfUrl.setValue("http://");
448
			LabelField lfCourriel = new LabelField();
-
 
449
			lfCourriel.setFieldLabel("Courriel:");
523
			
450
			lfCourriel.setText("<b>Courriels:</b>");
524
						lcUrl.add(tfUrl, new ColumnData(0.8));
451
			
-
 
452
			fsContact.add(lfCourriel);
-
 
453
			
-
 
454
			
-
 
455
			LayoutContainer lcCourriel = new LayoutContainer();
-
 
456
			ColumnLayout clLayout = new ColumnLayout();
-
 
457
			
-
 
458
			
-
 
459
			lcCourriel.setLayout(clLayout);
-
 
460
			TextField tfCourriel = new TextField();
-
 
461
			lcCourriel.add(tfCourriel, new ColumnData(0.80));
-
 
462
			
-
 
463
			// Bouton ajouter
-
 
464
			IconButton bAjouterCourriel = new IconButton(ComposantClass.ICONE_AJOUTER);
-
 
465
			lcCourriel.add(bAjouterCourriel, new ColumnData(0.15));
-
 
Line -... Line 525...
-
 
525
						hmIdentite.put("tfUrl", tfUrl);
-
 
526
			
466
			
527
						IconButton ibAjouterUrl = new IconButton(ComposantClass.ICONE_AJOUTER);
-
 
528
						ibAjouterUrl.addSelectionListener(new SelectionListener<ComponentEvent>() {
-
 
529
 
-
 
530
							public void componentSelected(ComponentEvent ce) {
-
 
531
								
-
 
532
								TextField<String> tfUrl = (TextField) hmIdentite.get("tfUrl");
-
 
533
								String strUrl = tfUrl.getValue();
-
 
534
								
-
 
535
								if ((strUrl == null)||(strUrl.trim().equals("http://"))||(strUrl.trim().equals("")))	{
-
 
536
									MessageBox.alert("Erreur de saisie", "Vous devez saisir un URL", null);
Line -... Line 537...
-
 
537
								} else if(hmIdentite.get("url-" + strUrl) != null)	{
467
			fsContact.add(lcCourriel);
538
									MessageBox.alert("Erreur de saisie", "L'url est déjà présente dans la liste.", null);
Line 468... Line 539...
468
			
539
								}	else	{
Line 469... Line 540...
469
			TextArea taCourriel = new TextArea();
540
									tfUrl.setValue("");
470
			taCourriel.setFieldLabel("Courriels");
541
										if (!strUrl.matches("[a-z]{3,}://[a-z0-9-]+.[.a-z0-9-]+(?::[0-9]*)?"))	{
471
			taCourriel.setEmptyText("Saisissez les adresses courriels séparées par un saut de ligne");
542
											MessageBox.alert("Erreur de saisie", "L'adresse n'est pas au bon format (ex: http://www.domain.com)", null);			
472
			
543
										} else if (strUrl.length()>255){
473
			//fsContact.add(taCourriel, fd100);
544
											MessageBox.alert("Erreur de saisie", "L'adresse ne peut dépasser 255 caractères", null);
-
 
545
										} else {
474
			
546
											ajouterUrl(strUrl);
Line 475... Line 547...
475
			hmIdentite.put("taCourriel", taCourriel);
547
										}
Line -... Line 548...
-
 
548
									
476
			
549
								}
477
			// URLS
550
								
478
			TextArea taUrl = new TextArea();
551
							}
479
			taUrl.setFieldLabel("Sites");
552
						});
480
			taUrl.setWidth("100%");
553
			
481
			taUrl.setEmptyText("Saisissez les adresses des sites séparées par un saut de ligne");
554
						lcUrl.add(ibAjouterUrl, new ColumnData(0.15));
Line 482... Line 555...
482
			//fsContact.add(taUrl, fd100);
555
					fsContact.add(lcUrl);
Line 483... Line -...
483
			
-
 
-
 
556
			
Line 484... Line 557...
484
			hmIdentite.put("taUrl", taUrl);
557
					LayoutContainer lcUrlContainer = new LayoutContainer(new RowLayout());
485
			
558
					
486
			
559
					fsContact.add(lcUrlContainer);
487
			// Autres informations
560
					hmIdentite.put("lcUrlContainer", lcUrlContainer);
Line 568... Line 641...
568
		main.add(left, new ColumnData(.49));
641
		main.add(left, new ColumnData(.49));
569
		main.add(right, new ColumnData(.49));	
642
		main.add(right, new ColumnData(.49));	
Line 570... Line 643...
570
		
643
		
571
		TextField<String> tfAdresse1 = new TextField();
644
		TextField<String> tfAdresse1 = new TextField();
-
 
645
		tfAdresse1.setFieldLabel("Adresse");
572
		tfAdresse1.setFieldLabel("Adresse");
646
		tfAdresse1.setName("adresse_01");
573
		left.add(tfAdresse1, fd100);
647
		left.add(tfAdresse1, fd100);
Line 574... Line 648...
574
		hmAdresse.put("tfAdresse1", tfAdresse1);
648
		hmAdresse.put("tfAdresse1", tfAdresse1);
575
		
649
		
-
 
650
		TextField<String> tfAdresse2 = new TextField();
576
		TextField<String> tfAdresse2 = new TextField();
651
		tfAdresse2.setFieldLabel("Complément d'adresse");
577
		tfAdresse2.setFieldLabel("Complément d'adresse");
652
		tfAdresse2.setName("adresse_02");
Line 578... Line 653...
578
		left.add(tfAdresse2, fd100);
653
		left.add(tfAdresse2, fd100);
579
		hmAdresse.put("tfAdresse2", tfAdresse2);
654
		hmAdresse.put("tfAdresse2", tfAdresse2);
Line 613... Line 688...
613
		right.add(cbRegion, fd100);
688
		right.add(cbRegion, fd100);
614
		hmAdresse.put("cbRegion", cbRegion);
689
		hmAdresse.put("cbRegion", cbRegion);
Line 615... Line 690...
615
		
690
		
616
		TextField<String> tfBoitePostale = new TextField<String>();
691
		TextField<String> tfBoitePostale = new TextField<String>();
-
 
692
		tfBoitePostale.setFieldLabel("Boite postale");
-
 
693
		tfBoitePostale.setName("bp");
617
		tfBoitePostale.setFieldLabel("Boite postale");
694
		
618
		left.add(tfBoitePostale, fd100);
695
		left.add(tfBoitePostale, fd100);
Line 619... Line 696...
619
		hmAdresse.put("tfBoitePostale", tfBoitePostale);
696
		hmAdresse.put("tfBoitePostale", tfBoitePostale);
620
		
697
		
-
 
698
		TextField<Integer> tfCodePostal = new TextField<Integer>();
-
 
699
		tfCodePostal.setFieldLabel("Code postal");
621
		TextField<Integer> tfCodePostal = new TextField<Integer>();
700
		tfCodePostal.setName("code_postal");
622
		tfCodePostal.setFieldLabel("Code postal");
701
		
Line 623... Line 702...
623
		right.add(tfCodePostal, fd100);
702
		right.add(tfCodePostal, fd100);
624
		hmAdresse.put("tfCodePostal", tfCodePostal);
703
		hmAdresse.put("tfCodePostal", tfCodePostal);
-
 
704
		
Line 625... Line 705...
625
		
705
		TextField tfVille = new TextField();
626
		TextField tfVille = new TextField();
706
		tfVille.setFieldLabel("Ville");
Line 627... Line 707...
627
		tfVille.setFieldLabel("Ville");
707
		tfVille.setName("ville");
Line 646... Line 726...
646
	/**
726
	/**
647
	 * Ajouter le bouton réinitialiser à la barre d'outils donnée
727
	 * Ajouter le bouton réinitialiser à la barre d'outils donnée
648
	 * 
728
	 * 
649
	 * @param barreOutils la barre d'outils à modifier
729
	 * @param barreOutils la barre d'outils à modifier
650
	 * */
730
	 * */
651
	public static void ajouterBoutonReinitialiser(ToolBar barreOutils)	{
731
	public void ajouterBoutonReinitialiser(ToolBar barreOutils)	{
Line 652... Line 732...
652
		
732
		
653
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
733
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
654
		TextToolItem reinitialiser = new TextToolItem("Réinitialiser le formulaire");
734
		TextToolItem reinitialiser = new TextToolItem("Réinitialiser le formulaire");
655
		reinitialiser.setIconStyle(ComposantClass.ICONE_RAFRAICHIR);
735
		reinitialiser.setIconStyle(ComposantClass.ICONE_RAFRAICHIR);
656
		reinitialiser.addSelectionListener(new SelectionListener<ComponentEvent>() {  
736
		reinitialiser.addSelectionListener(new SelectionListener<ComponentEvent>() {  
657
			public void componentSelected(ComponentEvent ce) {  
737
			public void componentSelected(ComponentEvent ce) {  
-
 
738
				//((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicAjouterPersonne();
-
 
739
				reinitialiser();
658
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicAjouterPersonne();
740
				//System.out.println(personneSelectionnee);
659
			}  
741
			}  
660
		});
742
		});
661
		barreOutils.add(reinitialiser);
743
		barreOutils.add(reinitialiser);
Line 682... Line 764...
682
	/**
764
	/**
683
	 * Ajouter le bouton Sauvegarder à la barre d'outils donnée
765
	 * Ajouter le bouton Sauvegarder à la barre d'outils donnée
684
	 * 
766
	 * 
685
	 * @param barreOutils la barre d'outils à modifier
767
	 * @param barreOutils la barre d'outils à modifier
686
	 * */
768
	 * */
687
	public static void ajouterBoutonEnregistrer(ButtonBar barreOutils)	{
769
	public void ajouterBoutonEnregistrer(ButtonBar barreOutils)	{
Line 688... Line 770...
688
		
770
		
689
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
771
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
690
		Button enregistrer = new Button("Enregistrer");
772
		Button enregistrer = new Button("Enregistrer");
691
		enregistrer.setIconStyle(ComposantClass.ICONE_PREFERENCE);
773
		enregistrer.setIconStyle(ComposantClass.ICONE_PREFERENCE);
692
		enregistrer.setId("main-button");
774
		enregistrer.setId("main-button");
693
		enregistrer.addSelectionListener(new SelectionListener<ComponentEvent>() {  
775
		enregistrer.addSelectionListener(new SelectionListener<ComponentEvent>() {  
694
			public void componentSelected(ComponentEvent ce) {  
776
			public void componentSelected(ComponentEvent ce) {  
-
 
777
				enregistrer();
-
 
778
				
695
				// TODO : Enregistrer le formulaire
779
				
696
			}  
780
			}  
697
		});
781
		});
698
		barreOutils.add(enregistrer);
782
		barreOutils.add(enregistrer);
Line 770... Line 854...
770
			}
854
			}
Line 771... Line 855...
771
			
855
			
Line -... Line 856...
-
 
856
			
772
			
857
		} else if (nouvellesDonnees instanceof Information)	{
Line 773... Line 858...
773
		} else if (nouvellesDonnees instanceof Information)	{
858
			
Line 774... Line 859...
774
			
859
			
775
			Information info = (Information) nouvellesDonnees;
860
			Information info = (Information) nouvellesDonnees;
776
			
861
			
Line -... Line 862...
-
 
862
			if (info.getDonnee(0) instanceof PersonneListe)	{
-
 
863
			
-
 
864
				Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
-
 
865
				Iterator itPersonneListe = colPersonneListe.iterator();
-
 
866
				Personne personne = (Personne) itPersonneListe.next();
-
 
867
				
777
			if (info.getDonnee(0) instanceof PersonneListe)	{
868
				personneSauvegarde = new Personne();
778
			
869
				personneSauvegarde = (Personne) personne.cloner(personneSauvegarde);
779
				Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values();
-
 
-
 
870
				
-
 
871
				
Line 780... Line 872...
780
				Iterator itPersonneListe = colPersonneListe.iterator();
872
				
781
				Personne personne = (Personne) itPersonneListe.next();
873
				binderPersonne(personne);
782
				
874
				//Mise à jour de la personne		
Line -... Line 875...
-
 
875
				//Personne personne = (Personne) nouvellesDonnees;
783
				//Mise à jour de la personne		
876
				
784
				//Personne personne = (Personne) nouvellesDonnees;
877
				
785
				personneSelectionnee = personne;
878
				
786
				
879
				//Prefixe
787
				//Prefixe
880
				String prefixe = personne.get("ce_truk_prefix");
788
				String prefixe = personne.get("ce_truk_prefix");
881
				ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe");
Line 802... Line 895...
802
				//Suffixe
895
				//Suffixe
803
				String suffixe = personne.get("ce_truk_suffixe");
896
				String suffixe = personne.get("ce_truk_suffixe");
804
				ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
897
				ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe");
Line 805... Line 898...
805
				
898
				
806
				String suffixeCourant = personne.get("ce_truk_suffix");
899
				String suffixeCourant = personne.get("ce_truk_suffix");
807
				if (cbSuffixe.getStore().findModel("nom", suffixeCourant) != null)	{
900
				if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null)	{
808
					cbSuffixe.setValue(cbSuffixe.getStore().findModel("nom", suffixeCourant));
901
					cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant));
809
				}	else	{
902
				}	else	{
810
					cbSuffixe.setRawValue(suffixeCourant);
903
					cbSuffixe.setRawValue(suffixeCourant);
Line 811... Line 904...
811
				}
904
				}
Line 821... Line 914...
821
				(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
914
				(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
822
				((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
915
				((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
Line 823... Line 916...
823
				
916
				
824
				// Telephone
917
				// Telephone
-
 
918
				HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
-
 
919
				if (hmTelephone!=null)	{
-
 
920
					
-
 
921
					
-
 
922
					ListStore storeTelephone = ((ComboBox) hmIdentite.get("cbTelephone")).getStore();
-
 
923
					List lstModelsTelephone = storeTelephone.getModels();
-
 
924
					Iterator<Valeur> itStore = lstModelsTelephone.iterator();
-
 
925
					HashMap<String, String> hmTel = new HashMap();
-
 
926
					while (itStore.hasNext())	{
-
 
927
						Valeur v = itStore.next();
-
 
928
						hmTel.put(v.getAbreviation(), v.getNom());
-
 
929
					}
-
 
930
					
825
				HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
931
					
826
				Collection<String> colTelephone = hmTelephone.keySet();
932
					Collection<String> colTelephone = hmTelephone.keySet();
Line 827... Line 933...
827
				Iterator<String> itTelephone = colTelephone.iterator();
933
					Iterator<String> itTelephone = colTelephone.iterator();
828
				
934
				
829
				while (itTelephone.hasNext())	{
935
					while (itTelephone.hasNext())	{
-
 
936
						String strTypeTelephone = itTelephone.next();
-
 
937
						String strTelephone = hmTelephone.get(strTypeTelephone);
-
 
938
						String idTel = hmTel.get(strTypeTelephone);
-
 
939
						if (idTel == null)	{
-
 
940
							idTel = strTypeTelephone;
830
					String strTelephone = itTelephone.next();
941
						}
-
 
942
						
831
					String strTypeTelephone = hmTelephone.get(strTelephone);
943
						ajouterTelephone(strTelephone, idTel, strTypeTelephone);
Line 832... Line 944...
832
					ajouterTelephone(strTelephone, strTypeTelephone);
944
					}
833
				}
-
 
834
				
945
				}
835
				//Courriel
946
				
Line 836... Line -...
836
				TextArea taCourriels = (TextArea) hmIdentite.get("taCourriel");
-
 
837
				LinkedList<String> lCourriels = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
947
				//Courriel
838
				Iterator<String> itCourriels = lCourriels.iterator(); 
948
				LinkedList<String> lCourriels = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
839
				
-
 
840
				String strValeurCourriel = "";
-
 
841
				while (itCourriels.hasNext())	{
949
				Iterator<String> itCourriels = lCourriels.iterator(); 
842
					strValeurCourriel += itCourriels.next() + "\n";
-
 
843
				}
950
				
Line 844... Line 951...
844
				
951
				while (itCourriels.hasNext())	{
845
				if (!strValeurCourriel.trim().equals(""))	{
-
 
846
					taCourriels.setRawValue(strValeurCourriel);
952
					String strEmail = itCourriels.next();
847
				}
953
					ajouterCourriel(strEmail);
Line 848... Line -...
848
				
-
 
849
				// Sites
-
 
850
				TextArea taUrl = (TextArea) hmIdentite.get("taUrl");
-
 
851
				LinkedList<String> lUrl = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_url");
-
 
Line 852... Line 954...
852
				Iterator<String> itUrl = lUrl.iterator(); 
954
				}
-
 
955
				
853
				
956
				// Sites
854
				String strValeurUrl = "";
957
				LinkedList<String> lUrl = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_url");
Line 855... Line 958...
855
				while (itUrl.hasNext())	{
958
				Iterator<String> itUrl = lUrl.iterator(); 
856
					strValeurUrl += itUrl.next() + "\n";
959
				
857
				}
960
				
Line 930... Line 1033...
930
				//Cp
1033
				//Cp
931
				((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal"));
1034
				((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal"));
Line 932... Line 1035...
932
				
1035
				
933
				//Ville
1036
				//Ville
-
 
1037
				((TextField) hmAdresse.get("tfVille")).setValue(personne.get("ville"));
-
 
1038
				
934
				((TextField) hmAdresse.get("tfVille")).setValue(personne.get("ville"));
1039
				
935
			}
1040
			}
Line 936... Line 1041...
936
		} 
1041
		} 
937
		
1042
		
Line 996... Line 1101...
996
		} else {
1101
		} else {
997
			hm = hmInfosNat;
1102
			hm = hmInfosNat;
998
		}
1103
		}
Line 999... Line 1104...
999
		
1104
		
-
 
1105
		ListStore<Valeur> store = ((ComboBox) hm.get(idComboBox)).getStore();
1000
		ListStore<Valeur> store = ((ComboBox) hm.get(idComboBox)).getStore();
1106
		
1001
		store.removeAll();
1107
		store.removeAll();
1002
		store.add(liste);
1108
		store.add(liste);
-
 
1109
		((ComboBox) hm.get(idComboBox)).setStore(store);
1003
		((ComboBox) hm.get(idComboBox)).setStore(store);
1110
		
Line 1004... Line 1111...
1004
	}
1111
	}
Line 1005... Line 1112...
1005
	
1112
	
1006
	
-
 
1007
	public void ajouterTelephone(String strTelephone, String strValeurTypeTel) 	{
1113
	
1008
		
-
 
1009
			
-
 
1010
				//Ajout d'un champ à la liste
-
 
Line 1011... Line 1114...
1011
				HiddenField<String> hfTelephone = new HiddenField<String>();
1114
	public void ajouterTelephone(String strTelephone, String strValeurTypeTel, String idTel) 	{
Line 1012... Line 1115...
1012
				hfTelephone.setId("hidden-" + strTelephone);
1115
		
1013
				hfTelephone.setFieldLabel(strValeurTypeTel);
1116
			
Line 1014... Line 1117...
1014
				hfTelephone.setValue(strTelephone);
1117
				//Ajout d'un champ à la liste
1015
				hmIdentite.put("hidden-" + strTelephone, hfTelephone);
1118
				String strIdTelephone =  idTel + "##" + strTelephone + ";;";	
Line 1016... Line 1119...
1016
				
1119
				
1017
				FieldSet fsContactTel = (FieldSet) hmIdentite.get("fsContactTel");
1120
				FieldSet fsContactTel = (FieldSet) hmIdentite.get("fsContactTel");
Line 1018... Line 1121...
1018
				
1121
				
1019
				LayoutContainer lcTelephone = new LayoutContainer();
1122
				LayoutContainer lcTelephone = new LayoutContainer();
1020
				lcTelephone.setLayout(new ColumnLayout());
1123
				lcTelephone.setLayout(new ColumnLayout());
1021
				
1124
				
Line 1022... Line 1125...
1022
				Text tTypeTelephone = new Text();
1125
				Text tTypeTelephone = new Text();
1023
				tTypeTelephone.setText(strValeurTypeTel+":");
1126
				tTypeTelephone.setText(strValeurTypeTel+":");
Line 1024... Line 1127...
1024
				
1127
				
1025
				hmIdentite.put("type-" + strTelephone, tTypeTelephone);
1128
				hmIdentite.put("type-" + strIdTelephone, tTypeTelephone);
Line 1026... Line 1129...
1026
				lcTelephone.add(tTypeTelephone, new ColumnData(0.40));
1129
				lcTelephone.add(tTypeTelephone, new ColumnData(0.40));
1027
				
1130
				
Line 1028... Line 1131...
1028
				Text tTelephone = new Text();
1131
				Text tTelephone = new Text();
1029
				tTelephone.setText(strTelephone);
1132
				tTelephone.setText(strTelephone);
Line 1030... Line 1133...
1030
				hmIdentite.put("tel-" + strTelephone, tTelephone);
1133
				hmIdentite.put("tel-" + strIdTelephone, tTelephone);
1031
				lcTelephone.add(tTelephone, new ColumnData(0.40));
1134
				lcTelephone.add(tTelephone, new ColumnData(0.40));
1032
				
-
 
1033
				IconButton bSupprimer = new IconButton(ComposantClass.ICONE_SUPPRIMER);
-
 
1034
				bSupprimer.setId(strTelephone);
-
 
Line 1035... Line 1135...
1035
				
1135
				
Line 1036... Line -...
1036
				bSupprimer.addSelectionListener(new SelectionListener<ComponentEvent>() {
-
 
1037
						public void componentSelected(ComponentEvent ce) {
1136
				IconButton bSupprimer = new IconButton(ComposantClass.ICONE_SUPPRIMER);
1038
							
1137
				bSupprimer.setId(strIdTelephone);
Line -... Line 1138...
-
 
1138
				
-
 
1139
				bSupprimer.addSelectionListener(new SelectionListener<ComponentEvent>() {
-
 
1140
						public void componentSelected(ComponentEvent ce) {
-
 
1141
							
-
 
1142
							String strIdTelephone = ce.component.getId();
1039
							String strTelephone = ce.component.getId();
1143
							LayoutContainer lcContactTel = (LayoutContainer) hmIdentite.get("lc-"+strIdTelephone);
Line 1040... Line 1144...
1040
							LayoutContainer lcContactTel = (LayoutContainer) hmIdentite.get("lc-"+strTelephone);
1144
							
1041
							
1145
							lcContactTel.remove(hmIdentite.get("type-" + strIdTelephone));
Line 1042... Line 1146...
1042
							lcContactTel.remove(hmIdentite.get("type-" + strTelephone));
1146
							hmIdentite.remove("type-" + strIdTelephone);
Line 1043... Line 1147...
1043
							hmIdentite.remove("type-" + strTelephone);
1147
							
1044
							
1148
							lcContactTel.remove(hmIdentite.get("tel-" + strIdTelephone));
Line -... Line 1149...
-
 
1149
							hmIdentite.remove("tel-" + strIdTelephone);
-
 
1150
							
-
 
1151
							lcContactTel.remove(ce.component);
-
 
1152
							
-
 
1153
							FieldSet fsContactTel = (FieldSet) hmIdentite.get("fsContactTel");
-
 
1154
							fsContactTel.remove(lcContactTel);
1045
							lcContactTel.remove(hmIdentite.get("tel-" + strTelephone));
1155
							
Line 1046... Line 1156...
1046
							hmIdentite.remove("tel-" + strTelephone);
1156
							HiddenField<String> hfTelephone = (HiddenField) hmIdentite.get("hfTelephone");
Line 1047... Line 1157...
1047
							
1157
							String strValeurTelephone = hfTelephone.getValue();
Line -... Line 1158...
-
 
1158
							strValeurTelephone = strValeurTelephone.replace(strIdTelephone, "");
-
 
1159
							hfTelephone.setValue(strValeurTelephone);
-
 
1160
							
-
 
1161
							layout();
-
 
1162
							
-
 
1163
						}
-
 
1164
				});
-
 
1165
				
-
 
1166
				lcTelephone.add(bSupprimer, new ColumnData(0.15));
-
 
1167
				
-
 
1168
				hmIdentite.put("lc-"+strIdTelephone, lcTelephone);
-
 
1169
				fsContactTel.add(lcTelephone);
-
 
1170
				
-
 
1171
				HiddenField<String> hfTelephone = (HiddenField) hmIdentite.get("hfTelephone");
-
 
1172
				String strValeurTelephone = hfTelephone.getValue();
-
 
1173
				if (strValeurTelephone==null)	{
-
 
1174
					strValeurTelephone = "";
-
 
1175
				}
-
 
1176
				strValeurTelephone += strIdTelephone;
-
 
1177
				hfTelephone.setValue(strValeurTelephone);
-
 
1178
				
-
 
1179
				layout();
-
 
1180
			
-
 
1181
			
-
 
1182
		
-
 
1183
		
-
 
1184
	}
-
 
1185
	
-
 
1186
	public void ajouterCourriel(String strEmail)	{
-
 
1187
			
-
 
1188
			TextField<String> tfCourriel = (TextField<String>) hmIdentite.get("tfCourriel");
-
 
1189
			tfCourriel.setValue("");
-
 
1190
			
-
 
1191
			//Ajouter adresse email
-
 
1192
			LayoutContainer lcCourrielContainer = (LayoutContainer) hmIdentite.get("lcCourrielContainer");
-
 
1193
			
-
 
1194
			LayoutContainer lcCourriel = new LayoutContainer();
-
 
1195
			lcCourriel.setLayout(new ColumnLayout());
-
 
1196
			
-
 
1197
			LabelField lfCourriel = new LabelField();
-
 
1198
			lfCourriel.setText(strEmail);
-
 
1199
			
-
 
1200
			lcCourriel.add(lfCourriel, new ColumnData(0.8));
-
 
1201
			hmIdentite.put("lc-" + strEmail, lcCourriel);
-
 
1202
			
-
 
1203
			//Bouton supprimer
-
 
1204
			IconButton btnSupprimerCourriel = new IconButton(ComposantClass.ICONE_SUPPRIMER);
-
 
1205
			btnSupprimerCourriel.setId(strEmail);
-
 
1206
			btnSupprimerCourriel.addSelectionListener(new SelectionListener<ComponentEvent>() {
-
 
1207
				
-
 
1208
				public void componentSelected(ComponentEvent ce) {
-
 
1209
					//Suppression de l'adresse email
-
 
1210
					String strEmail = ce.component.getId();
-
 
1211
					LayoutContainer lcCourrielContainer = (LayoutContainer) hmIdentite.get("lcCourrielContainer");
-
 
1212
					LayoutContainer lcCourriel = (LayoutContainer) hmIdentite.get("lc-" + strEmail);
-
 
1213
					lcCourrielContainer.remove(lcCourriel);
-
 
1214
					
-
 
1215
					hmIdentite.remove("lc-" + strEmail);
-
 
1216
					hmIdentite.remove("email-" + strEmail);
-
 
1217
					
-
 
1218
						HiddenField<String> hfHiddenCourriel = (HiddenField) hmIdentite.get("hfHiddenCourriel");
-
 
1219
					String strValeurCourriel = hfHiddenCourriel.getValue();
-
 
1220
					strValeurCourriel = strValeurCourriel.replace(strEmail + ";;", "");
-
 
1221
					hfHiddenCourriel.setValue(strValeurCourriel);
-
 
1222
					
-
 
1223
				}
-
 
1224
				
-
 
1225
			});
-
 
1226
			
-
 
1227
			lcCourriel.add(btnSupprimerCourriel);
-
 
1228
			
-
 
1229
			
-
 
1230
			
-
 
1231
			lcCourrielContainer.add(lcCourriel);
-
 
1232
			hmIdentite.put("email-" + strEmail, lfCourriel);	
-
 
1233
			
-
 
1234
			HiddenField<String> hfHiddenCourriel = (HiddenField) hmIdentite.get("hfHiddenCourriel");
Line -... Line 1235...
-
 
1235
			String strHiddenCourrielValue = hfHiddenCourriel.getValue();
-
 
1236
			if (strHiddenCourrielValue == null) { 
-
 
1237
				strHiddenCourrielValue = "";
-
 
1238
			}
-
 
1239
			hfHiddenCourriel.setRawValue(strHiddenCourrielValue + strEmail + ";;");
-
 
1240
			
-
 
1241
			
-
 
1242
			layout();
-
 
1243
			
-
 
1244
	}
-
 
1245
	
-
 
1246
	public void ajouterUrl(String strUrl)	{
-
 
1247
		
-
 
1248
		LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcUrlContainer");
-
 
1249
		
-
 
1250
		LayoutContainer lcUrl = new LayoutContainer();
-
 
1251
		lcUrl.setLayout(new ColumnLayout());
-
 
1252
		hmIdentite.put("lc-" + strUrl, lcUrl);
-
 
1253
		
-
 
1254
		
-
 
1255
		Text tUrl = new Text(strUrl);
-
 
1256
		hmIdentite.put("url-"+strUrl, tUrl);
-
 
1257
		
-
 
1258
		lcUrl.add(tUrl, new ColumnData(0.8));
-
 
1259
		
-
 
1260
		IconButton ibSupprimerUrl = new IconButton(ComposantClass.ICONE_SUPPRIMER);
-
 
1261
		ibSupprimerUrl.setId(strUrl);
-
 
1262
		ibSupprimerUrl.addSelectionListener(new SelectionListener<ComponentEvent>() {
-
 
1263
 
-
 
1264
			public void componentSelected(ComponentEvent ce) {
-
 
1265
				
-
 
1266
				//Suppression url
-
 
1267
				String strUrl = ce.component.getId();
-
 
1268
				LayoutContainer lcUrl = (LayoutContainer) hmIdentite.get("lc-" + strUrl);
-
 
1269
				LayoutContainer lcUrlContainer  = (LayoutContainer) hmIdentite.get("lcUrlContainer");
-
 
1270
				
-
 
1271
				lcUrlContainer.remove(lcUrl);
-
 
1272
				
-
 
1273
			}
-
 
1274
		});
-
 
1275
		
-
 
1276
		lcUrl.add(ibSupprimerUrl, new ColumnData(0.15));
-
 
1277
		lcUrlContainer.add(lcUrl);
-
 
1278
		
-
 
1279
		layout();
-
 
1280
		
Line -... Line 1281...
-
 
1281
		
-
 
1282
		
-
 
1283
	}
-
 
1284
	
-
 
1285
	public void reinitialiser()	{
-
 
1286
	 
-
 
1287
		mediateur.afficherPopinChargement();		
-
 
1288
		
-
 
1289
		
-
 
1290
		binderPersonne(personneSauvegarde);
-
 
1291
		
-
 
1292
		
-
 
1293
		layout();
-
 
1294
		
-
 
1295
		mediateur.masquerPopinChargement();
-
 
1296
	}
-
 
1297
	
-
 
1298
	
-
 
1299
	
-
 
1300
	public void binderPersonne(Personne personne)	{
-
 
1301
		
-
 
1302
		binding = new FormBinding(this);
-
 
1303
			
-
 
1304
		personneSelectionnee = personne;
-
 
1305
		binding.autoBind();
-
 
1306
		binding.bind(personneSelectionnee);
-
 
1307
		
-
 
1308
		layout();
-
 
1309
	}
-
 
1310
 
-
 
1311
	/**
-
 
1312
	 * Enregistre les information de la personne en cours 
-
 
1313
	 * 
-
 
1314
	 */
-
 
1315
	public void enregistrer()	{
-
 
1316
		
-
 
1317
		LinkedList lstMessageErreur = new LinkedList<String>();
-
 
1318
		
-
 
1319
		//Préparer les données
-
 
1320
		ComboBox combo = (ComboBox) hmIdentite.get("cbSexe");
-
 
1321
		Valeur valeur;
-
 
1322
		String strValeur = "";
-
 
1323
		
-
 
1324
		if (combo.getValue()!=null)	{
-
 
1325
			valeur = (Valeur) combo.getValue();
-
 
1326
			strValeur = valeur.getId();
-
 
1327
		} 
-
 
1328
		
-
 
1329
		if (!strValeur.trim().equals(""))	{
-
 
1330
			personneSelectionnee.set("sexe", strValeur);
-
 
1331
		} else {
-
 
1332
			lstMessageErreur.add("Le champ Sexe n'a pas été renseigné");			
-
 
1333
		}
-
 
1334
		
-
 
1335
		strValeur = obtenirValeurCombo("cbPrefixe");
-
 
1336
		personneSelectionnee.set("ce_truk_prefix", strValeur);
-
 
1337
		
-
 
1338
		strValeur = obtenirValeurCombo("cbSuffixe"); 
-
 
1339
		personneSelectionnee.set("ce_truk_suffix", strValeur);
-
 
1340
		
-
 
1341
		personneSelectionnee.set("truk_courriel", ((HiddenField<String>) hmIdentite.get("hfHiddenCourriel")).getValue());
-
 
1342
		
-
 
1343
		strValeur = personneSelectionnee.get("truk_prefix")
-
 
1344
					+ " " + personneSelectionnee.get("prenom")
-
 
1345
					+ " " + personneSelectionnee.get("nom")
-
 
1346
					+ " " + personneSelectionnee.get("truk_suffix");
-
 
1347
		
-
 
1348
		personneSelectionnee.set("fmt_nom_complet", strValeur);
-
 
1349
		
-
 
1350
		personneSelectionnee.set("naissance_date", (Date) ((DateField) hmIdentite.get("dfDateNaissance")).getValue());
-
 
1351
		
-
 
1352
		
-
 
1353
		strValeur = obtenirValeurCombo("cbPays");
-
 
1354
		personneSelectionnee.set("pays", strValeur);
-
 
1355
		
-
 
1356
		strValeur = obtenirValeurCombo("cbRegion");
-
 
1357
		personneSelectionnee.set("region", strValeur);
-
 
1358
		
-
 
1359
		personneSelectionnee.set("truk_telephone", ((HiddenField<String>) hmIdentite.get("hfTelephone")).getValue());
1048
							((TabItem) hmIdentite.get("tiIdentite")).remove(hmIdentite.get("hidden-" + strTelephone));
1360