Subversion Repositories eFlore/Applications.coel

Rev

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

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