Subversion Repositories eFlore/Applications.coel

Rev

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

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