Subversion Repositories eFlore/Applications.coel

Rev

Rev 283 | Rev 293 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 283 Rev 286
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.Date;
4
import java.util.HashMap;
5
import java.util.HashMap;
5
import java.util.Iterator;
6
import java.util.Iterator;
6
import java.util.List;
7
import java.util.List;
7
 
8
 
8
import org.tela_botanica.client.ComposantClass;
9
import org.tela_botanica.client.ComposantClass;
9
import org.tela_botanica.client.Mediateur;
10
import org.tela_botanica.client.Mediateur;
10
import org.tela_botanica.client.RegistreId;
11
import org.tela_botanica.client.RegistreId;
11
import org.tela_botanica.client.interfaces.Rafraichissable;
12
import org.tela_botanica.client.interfaces.Rafraichissable;
12
import org.tela_botanica.client.modeles.Configuration;
13
import org.tela_botanica.client.modeles.Configuration;
13
import org.tela_botanica.client.modeles.InterneValeur;
14
import org.tela_botanica.client.modeles.InterneValeur;
-
 
15
import org.tela_botanica.client.modeles.Personne;
14
import org.tela_botanica.client.modeles.Valeur;
16
import org.tela_botanica.client.modeles.Valeur;
15
import org.tela_botanica.client.modeles.ValeurListe;
17
import org.tela_botanica.client.modeles.ValeurListe;
16
 
18
 
17
 
19
 
18
import com.extjs.gxt.ui.client.Registry;
20
import com.extjs.gxt.ui.client.Registry;
19
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
21
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
20
import com.extjs.gxt.ui.client.Style.Scroll;
22
import com.extjs.gxt.ui.client.Style.Scroll;
21
import com.extjs.gxt.ui.client.event.BaseEvent;
23
import com.extjs.gxt.ui.client.event.BaseEvent;
22
import com.extjs.gxt.ui.client.event.ComponentEvent;
24
import com.extjs.gxt.ui.client.event.ComponentEvent;
23
import com.extjs.gxt.ui.client.event.KeyListener;
25
import com.extjs.gxt.ui.client.event.KeyListener;
24
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
26
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
25
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
27
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
26
import com.extjs.gxt.ui.client.event.SelectionListener;
28
import com.extjs.gxt.ui.client.event.SelectionListener;
27
import com.extjs.gxt.ui.client.store.ListStore;
29
import com.extjs.gxt.ui.client.store.ListStore;
28
import com.extjs.gxt.ui.client.store.StoreListener;
30
import com.extjs.gxt.ui.client.store.StoreListener;
29
 
31
 
30
import com.extjs.gxt.ui.client.widget.ContentPanel;
32
import com.extjs.gxt.ui.client.widget.ContentPanel;
31
 
33
 
32
import com.extjs.gxt.ui.client.widget.LayoutContainer;
34
import com.extjs.gxt.ui.client.widget.LayoutContainer;
33
import com.extjs.gxt.ui.client.widget.TabItem;
35
import com.extjs.gxt.ui.client.widget.TabItem;
34
import com.extjs.gxt.ui.client.widget.TabPanel;
36
import com.extjs.gxt.ui.client.widget.TabPanel;
35
 
37
 
36
import com.extjs.gxt.ui.client.widget.form.ComboBox;
38
import com.extjs.gxt.ui.client.widget.form.ComboBox;
37
import com.extjs.gxt.ui.client.widget.form.DateField;
39
import com.extjs.gxt.ui.client.widget.form.DateField;
38
import com.extjs.gxt.ui.client.widget.form.FieldSet;
40
import com.extjs.gxt.ui.client.widget.form.FieldSet;
39
import com.extjs.gxt.ui.client.widget.form.LabelField;
41
import com.extjs.gxt.ui.client.widget.form.LabelField;
-
 
42
import com.extjs.gxt.ui.client.widget.form.TextArea;
40
import com.extjs.gxt.ui.client.widget.form.TextField;
43
import com.extjs.gxt.ui.client.widget.form.TextField;
41
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
44
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
42
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
45
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
43
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
46
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
44
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
47
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
45
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
48
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
46
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
49
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
47
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
50
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
48
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
51
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
49
import com.google.gwt.user.client.Window;
52
import com.google.gwt.user.client.Window;
50
import com.google.gwt.user.client.ui.Widget;
53
import com.google.gwt.user.client.ui.Widget;
51
 
54
 
52
 
55
 
53
 
56
 
54
public class FormPersonneVue extends ContentPanel implements Rafraichissable {
57
public class FormPersonneVue extends ContentPanel implements Rafraichissable {
55
	
58
	
56
	
59
	
57
	/*--------------------------------------------------------------------------------------
60
	/*--------------------------------------------------------------------------------------
58
	 * 		VARIABLES
61
	 * 		VARIABLES
59
	 * -------------------------------------------------------------------------------------
62
	 * -------------------------------------------------------------------------------------
60
	 */
63
	 */
61
	
64
	
62
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
65
	private TabItem tiIdentite, tiAdresses, tiInfosNat;
63
	private Mediateur mediateur = Registry.get(RegistreId.MEDIATEUR);
66
	private Mediateur mediateur = Registry.get(RegistreId.MEDIATEUR);
64
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
67
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
-
 
68
	private Personne personneSelectionnee = null;
65
	
69
	
66
	/*--------------------------------------------------------------------------------------
70
	/*--------------------------------------------------------------------------------------
67
	 * 		CONSTRUCTEUR 
71
	 * 		CONSTRUCTEUR 
68
	 * -------------------------------------------------------------------------------------
72
	 * -------------------------------------------------------------------------------------
69
	 */
73
	 */
70
	/**
74
	/**
71
	 * Constructeur du panneau
75
	 * Constructeur du panneau
72
	 * 
76
	 * 
73
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le 
77
	 * Initialise le panneau et ajoute une barre d'outils à deux boutons (réinitialiser le 
74
	 * formulaire et annuler la saisie). 
78
	 * formulaire et annuler la saisie). 
75
	 * 
79
	 * 
76
	 * */
80
	 * */
77
	public FormPersonneVue() {
81
	public FormPersonneVue() {
78
		
82
		
79
		initialiserPanneau();
83
		initialiserPanneau();
80
		
84
		
81
		ToolBar barreOutils = new ToolBar();
85
		ToolBar barreOutils = new ToolBar();
82
		
86
		
83
		ajouterBoutonEnregistrer(barreOutils);
87
		ajouterBoutonEnregistrer(barreOutils);
84
		ajouterBoutonReinitialiser(barreOutils);
88
		ajouterBoutonReinitialiser(barreOutils);
85
		ajouterBoutonAnnuler(barreOutils);
89
		ajouterBoutonAnnuler(barreOutils);
86
		
90
		
87
		setTopComponent(barreOutils);
91
		setTopComponent(barreOutils);
88
		
92
		
89
		initialiserOnglets();	
93
		initialiserOnglets();	
90
		
94
		
91
		creerComposantsIdentite();
95
		creerComposantsIdentite();
92
		
96
		
93
	}
97
	}
94
	
98
	
95
	
99
	
96
	/*---------------------------------------------------------------------------------------
100
	/*---------------------------------------------------------------------------------------
97
	 * 		SOUS-METHODES
101
	 * 		SOUS-METHODES
98
	 * --------------------------------------------------------------------------------------
102
	 * --------------------------------------------------------------------------------------
99
	 */
103
	 */
100
	/**
104
	/**
101
	 * Inialise le panneau donné
105
	 * Inialise le panneau donné
102
	 * 
106
	 * 
103
	 * @param contentPanel le panneau à initialiser
107
	 * @param contentPanel le panneau à initialiser
104
	 * */
108
	 * */
105
	public void initialiserPanneau()	{
109
	public void initialiserPanneau()	{
106
		
110
		
107
		setLayout(new FitLayout());
111
		setLayout(new FitLayout());
108
		setIconStyle("icone-form-ajouter");  
112
		setIconStyle("icone-form-ajouter");  
109
		setCollapsible(false);  
113
		setCollapsible(false);  
110
		setHeading("Ajouter une personne");
114
		setHeading("Ajouter une personne");
111
		setButtonAlign(HorizontalAlignment.CENTER);  
115
		setButtonAlign(HorizontalAlignment.CENTER);  
112
		setLayout(new FormLayout());
116
		setLayout(new FormLayout());
113
	}
117
	}
114
	
118
	
115
	/**
119
	/**
116
	 * Crée les onglets identité, adresse et informations naturaliste
120
	 * Crée les onglets identité, adresse et informations naturaliste
117
	 * 
121
	 * 
118
	 * */
122
	 * */
119
	public void initialiserOnglets()	{
123
	public void initialiserOnglets()	{
120
		//TabPanel
124
		//TabPanel
121
		TabPanel formulaireOnglets = new TabPanel();
125
		TabPanel formulaireOnglets = new TabPanel();
122
		
126
		
123
		//Tab 1 : identite
127
		//Tab 1 : identite
124
		tiIdentite = new TabItem("Identité");
128
		tiIdentite = new TabItem("Identité");
125
		tiIdentite.setLayout(new FormLayout());
129
		tiIdentite.setLayout(new FormLayout());
126
		tiIdentite.setScrollMode(Scroll.AUTO);
130
		tiIdentite.setScrollMode(Scroll.AUTO);
127
		formulaireOnglets.add(tiIdentite);
131
		formulaireOnglets.add(tiIdentite);
128
		
132
		
129
		
133
		
130
		
134
		
131
		//Tab 2 : Adresse
135
		//Tab 2 : Adresse
132
		tiAdresses = new TabItem("Adresse");
136
		tiAdresses = new TabItem("Adresse");
133
		tiAdresses.setLayout(new FlowLayout());
137
		tiAdresses.setLayout(new FlowLayout());
134
		tiAdresses.setScrollMode(Scroll.AUTO);
138
		tiAdresses.setScrollMode(Scroll.AUTO);
135
		formulaireOnglets.add(tiAdresses);
139
		formulaireOnglets.add(tiAdresses);
136
		
140
		
137
		//Tab 3 : Infos Naturalistes
141
		//Tab 3 : Infos Naturalistes
138
		tiInfosNat = new TabItem("Informations Naturalistes");
142
		tiInfosNat = new TabItem("Informations Naturalistes");
139
		tiInfosNat.setLayout(new FormLayout());
143
		tiInfosNat.setLayout(new FormLayout());
140
		tiInfosNat.setScrollMode(Scroll.AUTO);
144
		tiInfosNat.setScrollMode(Scroll.AUTO);
141
		formulaireOnglets.add(tiInfosNat);
145
		formulaireOnglets.add(tiInfosNat);
142
		
146
		
143
		add(formulaireOnglets);
147
		add(formulaireOnglets);
144
	}
148
	}
145
	
149
	
146
	/**
150
	/**
147
	 * Crée les widgets pour l'onglet identité
151
	 * Crée les widgets pour l'onglet identité
148
	 * 
152
	 * 
149
	 * */
153
	 * */
150
	
154
	
151
	//hmIdentite référence par une chaine de caractère tous les composants de l'onglet Identite
155
	//hmIdentite référence par une chaine de caractère tous les composants de l'onglet Identite
152
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
156
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
153
	
157
	
154
	public void creerComposantsIdentite()	{
158
	public void creerComposantsIdentite()	{
155
		
159
		
156
		// Gestion de l'affichage en colonnes
160
		// Gestion de l'affichage en colonnes
157
			// On crée 3 Layout container : un principal, un pour la colonne de gauche, un pour la colonne de droite
161
			// On crée 3 Layout container : un principal, un pour la colonne de gauche, un pour la colonne de droite
158
		
162
		
159
			// Gauche
163
			// Gauche
160
			LayoutContainer left = new LayoutContainer();
164
			LayoutContainer left = new LayoutContainer();
161
			left.setLayout(new FormLayout());
165
			left.setLayout(new FormLayout());
162
			
166
			
163
			// Droite
167
			// Droite
164
			LayoutContainer right = new LayoutContainer();
168
			LayoutContainer right = new LayoutContainer();
165
			right.setLayout(new FormLayout());
169
			right.setLayout(new FormLayout());
166
			
170
			
167
			// Principal
171
			// Principal
168
			LayoutContainer main = new LayoutContainer();
172
			LayoutContainer main = new LayoutContainer();
169
			main.setLayout(new ColumnLayout());
173
			main.setLayout(new ColumnLayout());
170
			
174
			
171
			// Ajout au principal
175
			// Ajout au principal
172
			main.add(left, new ColumnData(.5));
176
			main.add(left, new ColumnData(.5));
173
			main.add(right, new ColumnData(.5));
177
			main.add(right, new ColumnData(.5));
174
			
178
			
175
			
179
			
176
			// Création des champs
180
			// Création des champs
177
			
181
			
178
			//FormLayout sera utilisé à plusieurs reprises
182
			//FormLayout sera utilisé à plusieurs reprises
179
			FormLayout formLayout = new FormLayout();
183
			FormLayout formLayout = new FormLayout();
180
			
184
			
181
			FieldSet fsNoms = new FieldSet();
185
			FieldSet fsNoms = new FieldSet();
182
			fsNoms.setHeading("Noms");
186
			fsNoms.setHeading("Noms");
183
			
187
			
184
			formLayout.setLabelAlign(LabelAlign.LEFT);
188
			formLayout.setLabelAlign(LabelAlign.LEFT);
185
			fsNoms.setLayout(formLayout); 
189
			fsNoms.setLayout(formLayout); 
186
			
190
			
187
			// Nom complet
191
			// Nom complet
188
			// Affiché que si valeurs saisies
192
			// Affiché que si valeurs saisies
189
			LabelField nomComplet = new LabelField();
193
			LabelField nomComplet = new LabelField();
190
			nomComplet.setFieldLabel("Nom complet:");
194
			nomComplet.setFieldLabel("Nom complet:");
191
			nomComplet.hide();
195
			nomComplet.hide();
192
			fsNoms.add(nomComplet);
196
			fsNoms.add(nomComplet);
193
			
197
			
194
			hmIdentite.put("nomComplet", nomComplet);
198
			hmIdentite.put("nomComplet", nomComplet);
195
			
199
			
196
			//Préfixe
200
			//Préfixe
197
			ComboBox<Valeur> cbPrefix = new ComboBox<Valeur>();
201
			ComboBox<Valeur> cbPrefix = new ComboBox<Valeur>();
198
			ListStore<Valeur> storePrefixe = new ListStore<Valeur>();
202
			ListStore<Valeur> storePrefixe = new ListStore<Valeur>();
199
			cbPrefix.setStore(storePrefixe);
203
			cbPrefix.setStore(storePrefixe);
200
			cbPrefix.setDisplayField("nom");
204
			cbPrefix.setDisplayField("nom");
201
			cbPrefix.setEmptyText("Choisissez le préfixe:");
205
			cbPrefix.setEmptyText("Choisissez le préfixe:");
202
			cbPrefix.setFieldLabel("Prefix");
206
			cbPrefix.setFieldLabel("Prefix");
203
			fsNoms.add(cbPrefix);			
207
			fsNoms.add(cbPrefix);			
204
			
208
			
205
			hmIdentite.put("cbPrefix", cbPrefix);
209
			hmIdentite.put("cbPrefix", cbPrefix);
206
			
210
			
207
			// Remplir la liste des préfixe
211
			// Remplir la liste des préfixe
208
			mediateur.obtenirListeValeurEtRafraichir(this, "prefixe");
212
			mediateur.obtenirListeValeurEtRafraichir(this, "prefixe");
209
			
213
			
210
			//Prénom
214
			//Prénom
211
			TextField<String> tfPrenom = new TextField<String>();
215
			TextField<String> tfPrenom = new TextField<String>();
212
			tfPrenom.setFieldLabel("Prénom");
216
			tfPrenom.setFieldLabel("Prénom");
213
			fsNoms.add(tfPrenom);
217
			fsNoms.add(tfPrenom);
214
			
218
			
215
			hmIdentite.put("tfPrenom", tfPrenom);
219
			hmIdentite.put("tfPrenom", tfPrenom);
216
			
220
			
217
			//Nom
221
			//Nom
218
			TextField<String> tfNom = new TextField<String>();
222
			TextField<String> tfNom = new TextField<String>();
219
			tfNom.setFieldLabel("Nom");
223
			tfNom.setFieldLabel("Nom");
220
			fsNoms.add(tfNom);
224
			fsNoms.add(tfNom);
221
			
225
			
222
			hmIdentite.put("tfNom", tfNom);
226
			hmIdentite.put("tfNom", tfNom);
223
			
227
			
224
			//Suffixe
228
			//Suffixe
225
			ComboBox<Valeur> cbSuffixe = new ComboBox<Valeur>();
229
			ComboBox<Valeur> cbSuffixe = new ComboBox<Valeur>();
226
			ListStore<Valeur> storeSuffixe = new ListStore<Valeur>();
230
			ListStore<Valeur> storeSuffixe = new ListStore<Valeur>();
227
			cbSuffixe.setStore(storeSuffixe);
231
			cbSuffixe.setStore(storeSuffixe);
228
			cbSuffixe.setFieldLabel("Suffixe");
232
			cbSuffixe.setFieldLabel("Suffixe");
229
			cbSuffixe.setDisplayField("nom");
233
			cbSuffixe.setDisplayField("nom");
230
			cbSuffixe.setEmptyText("Choisissez un suffixe:");
234
			cbSuffixe.setEmptyText("Choisissez un suffixe:");
231
			fsNoms.add(cbSuffixe);			
235
			fsNoms.add(cbSuffixe);			
232
			
236
			
233
			hmIdentite.put("cbSuffixe", cbSuffixe);
237
			hmIdentite.put("cbSuffixe", cbSuffixe);
234
			
238
			
235
			// Remplir la liste des suffixes:
239
			// Remplir la liste des suffixes:
236
			mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
240
			mediateur.obtenirListeValeurEtRafraichir(this, "suffixes");
237
			
241
			
238
			// Nom : autre
242
			// Nom : autre
239
			TextField<String> tfNomAutre = new TextField();
243
			TextField<String> tfNomAutre = new TextField();
240
			tfNomAutre.setFieldLabel("Autres noms");
244
			tfNomAutre.setFieldLabel("Autres noms");
241
			fsNoms.add(tfNomAutre);
245
			fsNoms.add(tfNomAutre);
242
			
246
			
243
			hmIdentite.put("tfNomAutre", tfNomAutre);
247
			hmIdentite.put("tfNomAutre", tfNomAutre);
244
			
248
			
245
			//Abréviation
249
			//Abréviation
246
			TextField<String> tfAbreviation = new TextField<String>();
250
			TextField<String> tfAbreviation = new TextField<String>();
247
			tfAbreviation.setFieldLabel("Abréviation");
251
			tfAbreviation.setFieldLabel("Abréviation");
248
			fsNoms.add(tfAbreviation);
252
			fsNoms.add(tfAbreviation);
249
			
253
			
250
			hmIdentite.put("tfAbreviation", tfAbreviation);
254
			hmIdentite.put("tfAbreviation", tfAbreviation);
251
			
255
			
252
			//Abréviation autres
256
			//Abréviation autres
253
			TextField<String> tfAbreviationAutre = new TextField<String>();
257
			TextField<String> tfAbreviationAutre = new TextField<String>();
254
			tfAbreviationAutre.setFieldLabel("Autres Abrév.");
258
			tfAbreviationAutre.setFieldLabel("Autres Abrév.");
255
			fsNoms.add(tfAbreviationAutre);
259
			fsNoms.add(tfAbreviationAutre);
256
			
260
			
257
			hmIdentite.put("tfAbreviation", tfAbreviation);
261
			hmIdentite.put("tfAbreviationAutre", tfAbreviationAutre);
258
			
262
			
259
			
263
			
260
			left.add(fsNoms);
264
			left.add(fsNoms);
261
			
265
			
262
			// Naissance & décès
266
			// Naissance
263
			FieldSet fsVie = new FieldSet();
267
			FieldSet fsNaissance = new FieldSet();
264
			fsVie.setHeading("Vie");
268
			fsNaissance.setHeading("Naissance");
265
			
269
			
266
			formLayout = new FormLayout();
270
			formLayout = new FormLayout();
267
			formLayout.setLabelAlign(LabelAlign.TOP);
271
			formLayout.setLabelAlign(LabelAlign.LEFT);
268
			fsVie.setLayout(formLayout); 
272
			fsNaissance.setLayout(formLayout); 
269
			
273
			
270
			// Date naissance
274
			// Date naissance
271
			DateField dfDateNaissance = new DateField();
275
			DateField dfDateNaissance = new DateField();
272
			
276
			
273
			dfDateNaissance.setFieldLabel("Date de naissance");
277
			dfDateNaissance.setFieldLabel("Date");
274
			fsVie.add(dfDateNaissance);
278
			fsNaissance.add(dfDateNaissance);
275
			
279
			
276
			hmIdentite.put("dfDateNaissance", dfDateNaissance);
280
			hmIdentite.put("dfDateNaissance", dfDateNaissance);
277
			
281
			
278
			// Lieu naissance
282
			// Lieu naissance
279
			TextField<String> tfLieuNaissance = new TextField();
283
			TextField<String> tfLieuNaissance = new TextField();
280
			tfLieuNaissance.setFieldLabel("Lieu de naissance");
284
			tfLieuNaissance.setFieldLabel("Lieu");
281
			fsVie.add(tfLieuNaissance);
285
			fsNaissance.add(tfLieuNaissance);
282
			
286
			
283
			hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
287
			hmIdentite.put("tfLieuNaissance", tfLieuNaissance);
-
 
288
			
-
 
289
			left.add(fsNaissance);
-
 
290
			
-
 
291
			// Deces
-
 
292
			FieldSet fsDeces = new FieldSet();
-
 
293
			fsDeces.setHeading("Décès");
-
 
294
			
-
 
295
			formLayout = new FormLayout();
-
 
296
			formLayout.setLabelAlign(LabelAlign.LEFT);
-
 
297
			fsDeces.setLayout(formLayout); 
284
			
298
			
285
			// Date décès
299
			// Date décès
286
			DateField dfDateDeces = new DateField();
300
			DateField dfDateDeces = new DateField();
287
			dfDateDeces.setFieldLabel("Date de décès");
301
			dfDateDeces.setFieldLabel("Date");
288
			fsVie.add(dfDateDeces);
302
			fsDeces.add(dfDateDeces);
289
			
303
			
290
			hmIdentite.put("dfDateDeces", dfDateDeces);
304
			hmIdentite.put("dfDateDeces", dfDateDeces);
291
			
305
			
292
			// Lieu décès
306
			// Lieu décès
293
			TextField<String> tfLieuDeces = new TextField();
307
			TextField<String> tfLieuDeces = new TextField();
294
			tfLieuDeces.setFieldLabel("Lieu de décès");
308
			tfLieuDeces.setFieldLabel("Lieu");
295
			fsVie.add(tfLieuDeces);
309
			fsDeces.add(tfLieuDeces);
296
			
310
			
297
			hmIdentite.put("tfLieuDeces", tfLieuDeces);
311
			hmIdentite.put("tfLieuDeces", tfLieuDeces);
298
			
312
			
299
			left.add(fsVie);
313
			left.add(fsDeces);
300
			
314
			
301
			tiIdentite.add(main);
315
			tiIdentite.add(main);
-
 
316
			
-
 
317
			// Autres informations
-
 
318
			FieldSet fsAutresInfos = new FieldSet();
-
 
319
			fsAutresInfos.setHeading("Autres informations");
-
 
320
			
-
 
321
			formLayout = new FormLayout();
-
 
322
			formLayout.setLabelAlign(LabelAlign.LEFT);
-
 
323
			fsAutresInfos.setLayout(formLayout); 
-
 
324
			
-
 
325
			right.add(fsAutresInfos);
-
 
326
			
-
 
327
			//Civilité
-
 
328
			
-
 
329
			ComboBox<Valeur> cbCivilite = new ComboBox<Valeur>();
-
 
330
			ListStore<Valeur> storeCivilite = new ListStore<Valeur>();
-
 
331
			cbCivilite.setStore(storeCivilite);
-
 
332
			cbCivilite.setFieldLabel("Civilité");
-
 
333
			cbCivilite.setDisplayField("nom");
-
 
334
			cbCivilite.setEmptyText("Choisissez une civilité:");
-
 
335
			
-
 
336
			fsAutresInfos.add(cbCivilite);			
-
 
337
			
-
 
338
			hmIdentite.put("cbCivilite", cbCivilite);
-
 
339
			
-
 
340
			// TODO : récupérer la liste des civilités en BDD
-
 
341
			
-
 
342
			
-
 
343
			//Description
-
 
344
			TextArea taDescription = new TextArea();
-
 
345
			taDescription.setEmptyText("Saisissez une description");
-
 
346
			taDescription.setFieldLabel("Description");
-
 
347
			fsAutresInfos.add(taDescription);
-
 
348
			
-
 
349
			hmIdentite.put("taDescription", taDescription);
-
 
350
			
-
 
351
			// Logo
-
 
352
			TextArea taLogo = new TextArea();
-
 
353
			taLogo.setFieldLabel("Logos");
-
 
354
			taLogo.setEmptyText("Saisissez les adresses des logos séparées par un saut de ligne");
-
 
355
			fsAutresInfos.add(taLogo);
-
 
356
			
-
 
357
			hmIdentite.put("taLogo", taLogo);
-
 
358
			
-
 
359
			
-
 
360
			
-
 
361
			//Contact
-
 
362
			FieldSet fsContact = new FieldSet();
-
 
363
			fsContact.setHeading("Contact");
-
 
364
			
-
 
365
			formLayout = new FormLayout();
-
 
366
			formLayout.setLabelAlign(LabelAlign.LEFT);
-
 
367
			fsContact.setLayout(formLayout);
-
 
368
			
-
 
369
			right.add(fsContact);
-
 
370
			
-
 
371
			// Courriels
-
 
372
			TextArea taCourriel = new TextArea();
-
 
373
			taCourriel.setFieldLabel("Courriels");
-
 
374
			taCourriel.setEmptyText("Saisissez les adresses courriels séparées par un saut de ligne");
-
 
375
			fsContact.add(taCourriel);
-
 
376
			
-
 
377
			hmIdentite.put("taCourriel", taCourriel);
-
 
378
			
-
 
379
			// URLS
-
 
380
			TextArea taUrl = new TextArea();
-
 
381
			taUrl.setFieldLabel("Sites");
-
 
382
			taUrl.setEmptyText("Saisissez les adresses des sites séparées par un saut de ligne");
-
 
383
			fsContact.add(taUrl);
-
 
384
			
-
 
385
			hmIdentite.put("taUrl", taUrl);
302
			
386
			
303
			
387
			
304
			// Ajout des évènements saisi
388
			// Ajout des évènements saisi
305
			KeyListener klNoms = new KeyListener()	{
389
			KeyListener klNoms = new KeyListener()	{
306
				public void componentKeyUp(ComponentEvent ev)	{
390
				public void componentKeyUp(ComponentEvent ev)	{
307
					rafraichir(null);	
391
					rafraichir(null);	
308
				}				
392
				}				
309
			};
393
			};
310
			
394
			
311
			SelectionChangedListener<InterneValeur> selectionChange = new SelectionChangedListener<InterneValeur>() {
395
			SelectionChangedListener<InterneValeur> selectionChange = new SelectionChangedListener<InterneValeur>() {
312
				public void selectionChanged(SelectionChangedEvent se) {
396
				public void selectionChanged(SelectionChangedEvent se) {
313
						rafraichir(null);
397
						rafraichir(null);
314
					}
398
					}
315
			};
399
			};
316
						
400
						
317
			cbPrefix.addSelectionChangedListener(selectionChange);
401
			cbPrefix.addSelectionChangedListener(selectionChange);
318
			cbPrefix.addKeyListener(klNoms);
402
			cbPrefix.addKeyListener(klNoms);
319
			tfPrenom.addKeyListener(klNoms);
403
			tfPrenom.addKeyListener(klNoms);
320
			tfNom.addKeyListener(klNoms);
404
			tfNom.addKeyListener(klNoms);
321
			cbSuffixe.addSelectionChangedListener(selectionChange);		
405
			cbSuffixe.addSelectionChangedListener(selectionChange);		
322
			
406
			
323
	}
407
	}
324
	
408
	
325
	/**
409
	/**
326
	 * Ajouter le bouton réinitialiser à la barre d'outils donnée
410
	 * Ajouter le bouton réinitialiser à la barre d'outils donnée
327
	 * 
411
	 * 
328
	 * @param barreOutils la barre d'outils à modifier
412
	 * @param barreOutils la barre d'outils à modifier
329
	 * */
413
	 * */
330
	public static void ajouterBoutonReinitialiser(ToolBar barreOutils)	{
414
	public static void ajouterBoutonReinitialiser(ToolBar barreOutils)	{
331
		
415
		
332
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
416
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
333
		TextToolItem reinitialiser = new TextToolItem("Réinitialiser");
417
		TextToolItem reinitialiser = new TextToolItem("Réinitialiser");
334
		reinitialiser.setIconStyle(ComposantClass.ICONE_RAFRAICHIR);
418
		reinitialiser.setIconStyle(ComposantClass.ICONE_RAFRAICHIR);
335
		reinitialiser.addSelectionListener(new SelectionListener<ComponentEvent>() {  
419
		reinitialiser.addSelectionListener(new SelectionListener<ComponentEvent>() {  
336
			public void componentSelected(ComponentEvent ce) {  
420
			public void componentSelected(ComponentEvent ce) {  
337
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicAjouterPersonne();
421
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicAjouterPersonne();
338
			}  
422
			}  
339
		});
423
		});
340
		barreOutils.add(reinitialiser);
424
		barreOutils.add(reinitialiser);
341
	}
425
	}
342
	
426
	
343
	/**
427
	/**
344
	 * Ajouter le bouton Sauvegarder à la barre d'outils donnée
428
	 * Ajouter le bouton Sauvegarder à la barre d'outils donnée
345
	 * 
429
	 * 
346
	 * @param barreOutils la barre d'outils à modifier
430
	 * @param barreOutils la barre d'outils à modifier
347
	 * */
431
	 * */
348
	public static void ajouterBoutonEnregistrer(ToolBar barreOutils)	{
432
	public static void ajouterBoutonEnregistrer(ToolBar barreOutils)	{
349
		
433
		
350
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
434
		//Le bouton réintialiser recharge la page sans sauvegarder les informations
351
		TextToolItem reinitialiser = new TextToolItem("Enregistrer");
435
		TextToolItem enregistrer = new TextToolItem("Enregistrer");
352
		reinitialiser.setIconStyle(ComposantClass.ICONE_PREFERENCE);
436
		enregistrer.setIconStyle(ComposantClass.ICONE_PREFERENCE);
353
		reinitialiser.addSelectionListener(new SelectionListener<ComponentEvent>() {  
437
		enregistrer.addSelectionListener(new SelectionListener<ComponentEvent>() {  
354
			public void componentSelected(ComponentEvent ce) {  
438
			public void componentSelected(ComponentEvent ce) {  
355
				// TODO : Enregistrer le formulaire
439
				// TODO : Enregistrer le formulaire
356
			}  
440
			}  
357
		});
441
		});
358
		barreOutils.add(reinitialiser);
442
		barreOutils.add(enregistrer);
359
	}
443
	}
360
	
444
	
361
	/**
445
	/**
362
	 * Ajouter le bouton annuler à la barre d'outils donnée
446
	 * Ajouter le bouton annuler à la barre d'outils donnée
363
	 * 
447
	 * 
364
	 * @param barreOutils la barre d'outils à modifier
448
	 * @param barreOutils la barre d'outils à modifier
365
	 * */
449
	 * */
366
	public static void ajouterBoutonAnnuler(ToolBar barreOutils)	{
450
	public static void ajouterBoutonAnnuler(ToolBar barreOutils)	{
367
		
451
		
368
		// Le bouton annuler ne sauvegarde pas les informations et renvoie vers la page précédente
452
		// Le bouton annuler ne sauvegarde pas les informations et renvoie vers la page précédente
369
		TextToolItem annuler = new TextToolItem("Annuler");
453
		TextToolItem annuler = new TextToolItem("Annuler");
370
		annuler.addSelectionListener(new SelectionListener<ComponentEvent>() {  
454
		annuler.addSelectionListener(new SelectionListener<ComponentEvent>() {  
371
			public void componentSelected(ComponentEvent ce) {  
455
			public void componentSelected(ComponentEvent ce) {  
372
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicMenu("Personnes");
456
				((Mediateur) Registry.get(RegistreId.MEDIATEUR)).clicMenu("Personnes");
373
			}  
457
			}  
374
		});
458
		});
375
		annuler.setIconStyle(ComposantClass.ICONE_SUPPRIMER);
459
		annuler.setIconStyle(ComposantClass.ICONE_SUPPRIMER);
376
		barreOutils.add(annuler);
460
		barreOutils.add(annuler);
377
	}
461
	}
378
	
462
	
379
	
463
	
380
	
464
	
381
	/*---------------------------------------------------------------------------------------
465
	/*---------------------------------------------------------------------------------------
382
	 * 		RAFRAICHISSEMENT DU PANNEAU
466
	 * 		RAFRAICHISSEMENT DU PANNEAU
383
	 * --------------------------------------------------------------------------------------
467
	 * --------------------------------------------------------------------------------------
384
	 */	
468
	 */	
385
	public void rafraichir(Object nouvellesDonnees) {
469
	public void rafraichir(Object nouvellesDonnees) {
386
		if (nouvellesDonnees instanceof ValeurListe){
470
		if (nouvellesDonnees instanceof ValeurListe){
387
			
471
			
388
			
472
			
389
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
473
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
390
			
474
			
391
			
475
			
392
			
476
			
393
			// Créer une liste de valeurs
477
			// Créer une liste de valeurs
394
			List<Valeur> liste = new ArrayList<Valeur>();
478
			List<Valeur> liste = new ArrayList<Valeur>();
395
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
479
			for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
396
				liste.add(listeValeurs.get(it.next()));
480
				liste.add(listeValeurs.get(it.next()));
397
			}
481
			}
398
			
482
			
399
			if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
483
			if (listeValeurs.getId().equals(config.getListeId("prefixe")))	{
400
 
484
 
401
				//Remplir la liste Prefixe
485
				//Remplir la liste Prefixe
402
				
486
				
403
				
487
				
404
				ListStore<Valeur> stPrefixe = ((ComboBox) hmIdentite.get("cbPrefix")).getStore();
488
				ListStore<Valeur> stPrefixe = ((ComboBox) hmIdentite.get("cbPrefix")).getStore();
405
				stPrefixe.removeAll();
489
				stPrefixe.removeAll();
406
				stPrefixe.add(liste);
490
				stPrefixe.add(liste);
407
				((ComboBox) hmIdentite.get("cbPrefix")).setStore(stPrefixe);
491
				((ComboBox) hmIdentite.get("cbPrefix")).setStore(stPrefixe);
408
				
492
				
409
				
493
				
410
			} else if (listeValeurs.getId().equals(config.getListeId("suffixes"))) {
494
			} else if (listeValeurs.getId().equals(config.getListeId("suffixes"))) {
411
			
495
			
412
				//Remplir la liste Suffixe
496
				//Remplir la liste Suffixe
413
				ListStore<Valeur> stSuffix = ((ComboBox) hmIdentite.get("cbSuffixe")).getStore();
497
				ListStore<Valeur> stSuffix = ((ComboBox) hmIdentite.get("cbSuffixe")).getStore();
414
				stSuffix.removeAll();
498
				stSuffix.removeAll();
415
				stSuffix.add(liste);
499
				stSuffix.add(liste);
416
				((ComboBox) hmIdentite.get("cbSuffixe")).setStore(stSuffix);
500
				((ComboBox) hmIdentite.get("cbSuffixe")).setStore(stSuffix);
417
				
501
				
418
				
502
				
419
			}
503
			}
-
 
504
		} else if (nouvellesDonnees instanceof Personne)	{
-
 
505
			
-
 
506
			
-
 
507
			//Mise à jour de la personne		
-
 
508
			Personne personne = (Personne) nouvellesDonnees;
-
 
509
			personneSelectionnee = personne;
-
 
510
			
-
 
511
			
-
 
512
			((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom"));
-
 
513
			((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom"));
-
 
514
			((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre"));
-
 
515
			((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation"));
-
 
516
			((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre"));
-
 
517
			
-
 
518
			//((DateField) hmIdentite.get("dfDateNaissance")).setValue(new Date((String) personne.get("naissance_date")));
-
 
519
			((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
-
 
520
			//((DateField) hmIdentite.get("dfDateDeces")).setValue(new Date((String) personne.get("deces_date")));
-
 
521
			((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
-
 
522
			
420
		}
523
		}
421
		
524
		
422
		if (nouvellesDonnees == null)
525
		if (nouvellesDonnees == null)
423
		{
526
		{
424
			ComboBox cb= (ComboBox) hmIdentite.get("cbPrefix");
527
			ComboBox cb= (ComboBox) hmIdentite.get("cbPrefix");
425
			/*
528
			/*
426
			 * Met à jour le nom Complet du formulaire
529
			 * Met à jour le nom Complet du formulaire
427
			 * */
530
			 * */
428
			String valeurRetour = "";
531
			String valeurRetour = "";
429
			
532
			
430
			// Prefixe
533
			// Prefixe
431
			String prefixe = "";
534
			String prefixe = "";
432
			Valeur valPrefixe = (Valeur) ((ComboBox) hmIdentite.get("cbPrefix")).getValue();
535
			Valeur valPrefixe = (Valeur) ((ComboBox) hmIdentite.get("cbPrefix")).getValue();
433
			
536
			
434
			if (valPrefixe != null)	{
537
			if (valPrefixe != null)	{
435
				prefixe = valPrefixe.getNom();
538
				prefixe = valPrefixe.getNom();
436
			}
539
			}
437
			
540
			
438
			// Prénom
541
			// Prénom
439
			String prenom = (String) ((TextField) hmIdentite.get("tfPrenom")).getValue();
542
			String prenom = (String) ((TextField) hmIdentite.get("tfPrenom")).getValue();
440
			
543
			
441
			// Nom
544
			// Nom
442
			String nom = (String) ((TextField) hmIdentite.get("tfNom")).getValue();
545
			String nom = (String) ((TextField) hmIdentite.get("tfNom")).getValue();
443
			
546
			
444
			// Suffixe
547
			// Suffixe
445
			String suffixe = "";
548
			String suffixe = "";
446
			Valeur valSuffixe = (Valeur) ((ComboBox) hmIdentite.get("cbSuffixe")).getValue();
549
			Valeur valSuffixe = (Valeur) ((ComboBox) hmIdentite.get("cbSuffixe")).getValue();
447
			
550
			
448
			if (valSuffixe != null)	{
551
			if (valSuffixe != null)	{
449
				suffixe = valSuffixe.getNom();
552
				suffixe = valSuffixe.getNom();
450
			}
553
			}
451
			
554
			
452
			// Mettre à jour la valeur
555
			// Mettre à jour la valeur
453
			valeurRetour = prefixe + " " + prenom + " " + nom + " " + suffixe;
556
			valeurRetour = prefixe + " " + prenom + " " + nom + " " + suffixe;
454
			valeurRetour = valeurRetour.replaceAll("null", "");
557
			valeurRetour = valeurRetour.replaceAll("null", "");
455
			
558
			
456
			((LabelField) hmIdentite.get("nomComplet")).setValue(valeurRetour);
559
			((LabelField) hmIdentite.get("nomComplet")).setValue(valeurRetour);
457
			
560
			
458
			if (!valeurRetour.trim().equals(""))	{
561
			if (!valeurRetour.trim().equals(""))	{
459
				((LabelField) hmIdentite.get("nomComplet")).show();
562
				((LabelField) hmIdentite.get("nomComplet")).show();
460
			} else {
563
			} else {
461
				((LabelField) hmIdentite.get("nomComplet")).hide();
564
				((LabelField) hmIdentite.get("nomComplet")).hide();
462
			}
565
			}
463
		}
566
		}
464
	}
567
	}
465
 
568
 
466
	
569
	
467
 
570
 
468
 
571
 
469
}
572
}