Subversion Repositories eFlore/Applications.coel

Rev

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

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