Subversion Repositories eFlore/Applications.coel

Rev

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

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