Subversion Repositories eFlore/Applications.coel

Rev

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

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