Subversion Repositories eFlore/Applications.coel

Rev

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

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