Subversion Repositories eFlore/Applications.coel

Rev

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

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