Subversion Repositories eFlore/Applications.coel

Rev

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

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