Subversion Repositories eFlore/Applications.coel

Rev

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

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