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