Subversion Repositories eFlore/Applications.coel

Rev

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

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