Subversion Repositories eFlore/Applications.coel

Rev

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

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