Subversion Repositories eFlore/Applications.coel

Rev

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

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