Subversion Repositories eFlore/Applications.coel

Rev

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

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