Subversion Repositories eFlore/Applications.coel

Rev

Rev 1353 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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