Subversion Repositories eFlore/Applications.coel

Rev

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

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