| 150 |
gduche |
1 |
package org.tela_botanica.client.vues;
|
|
|
2 |
|
| 253 |
gduche |
3 |
import java.util.Collection;
|
| 197 |
gduche |
4 |
import java.util.HashMap;
|
|
|
5 |
import java.util.Iterator;
|
| 253 |
gduche |
6 |
import java.util.LinkedList;
|
|
|
7 |
import java.util.MissingResourceException;
|
| 189 |
gduche |
8 |
|
| 197 |
gduche |
9 |
|
| 150 |
gduche |
10 |
import org.tela_botanica.client.RegistreId;
|
| 253 |
gduche |
11 |
import org.tela_botanica.client.i18n.Constantes;
|
| 150 |
gduche |
12 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
13 |
import org.tela_botanica.client.modeles.Personne;
|
| 259 |
gduche |
14 |
import org.tela_botanica.client.util.UtilTruk;
|
| 150 |
gduche |
15 |
|
|
|
16 |
import com.extjs.gxt.ui.client.Registry;
|
|
|
17 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
| 253 |
gduche |
18 |
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
|
| 215 |
aurelien |
19 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
| 269 |
gduche |
20 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
| 189 |
gduche |
21 |
import com.extjs.gxt.ui.client.widget.TabItem;
|
|
|
22 |
import com.extjs.gxt.ui.client.widget.TabPanel;
|
| 197 |
gduche |
23 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
| 246 |
gduche |
24 |
import com.extjs.gxt.ui.client.widget.form.LabelField;
|
| 150 |
gduche |
25 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
| 197 |
gduche |
26 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
|
|
27 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
| 253 |
gduche |
28 |
import com.extjs.gxt.ui.client.widget.layout.TableData;
|
| 197 |
gduche |
29 |
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
|
| 280 |
gduche |
30 |
|
| 253 |
gduche |
31 |
import com.google.gwt.core.client.GWT;
|
| 197 |
gduche |
32 |
import com.google.gwt.user.client.ui.Image;
|
| 150 |
gduche |
33 |
|
| 269 |
gduche |
34 |
public class PersonneDetailPanneauVue extends LayoutContainer implements Rafraichissable {
|
| 150 |
gduche |
35 |
|
| 197 |
gduche |
36 |
// Le panneau détail se compose de formulaires tabulés
|
| 269 |
gduche |
37 |
private TabPanel tabPanel;
|
| 189 |
gduche |
38 |
|
| 197 |
gduche |
39 |
// Onglet 1 : identite & contact
|
| 215 |
aurelien |
40 |
private TabItem tabIdentite;
|
|
|
41 |
|
|
|
42 |
private ContentPanel panneauIdentite;
|
|
|
43 |
private ContentPanel panneauImage;
|
|
|
44 |
|
| 197 |
gduche |
45 |
private FieldSet fsIdentite;
|
|
|
46 |
private FieldSet fsContact;
|
| 189 |
gduche |
47 |
|
| 200 |
gduche |
48 |
// Onglet 2 : Adresses
|
|
|
49 |
private TabItem tabAdresse;
|
|
|
50 |
private FieldSet fsAdressePerso;
|
| 198 |
gduche |
51 |
// contient : adresse perso / adresse pro
|
|
|
52 |
|
| 215 |
aurelien |
53 |
// Onglet 3 : Informations naturalistes
|
|
|
54 |
private TabItem tabInfosNat;
|
| 269 |
gduche |
55 |
private FieldSet fsSpec;
|
| 198 |
gduche |
56 |
|
| 267 |
gduche |
57 |
|
| 150 |
gduche |
58 |
public PersonneDetailPanneauVue() {
|
| 189 |
gduche |
59 |
|
| 269 |
gduche |
60 |
tabPanel = new TabPanel();
|
|
|
61 |
this.add(tabPanel);
|
|
|
62 |
|
| 198 |
gduche |
63 |
//Constructeur de la classe
|
| 150 |
gduche |
64 |
Registry.register(RegistreId.PANNEAU_PERSONNE_DETAIL, this);
|
| 189 |
gduche |
65 |
setLayout(new FitLayout());
|
| 150 |
gduche |
66 |
|
| 215 |
aurelien |
67 |
tabIdentite = new TabItem("Identité");
|
|
|
68 |
TableLayout tLayout = new TableLayout(2);
|
|
|
69 |
tabIdentite.setLayout(tLayout);
|
|
|
70 |
tabIdentite.setScrollMode(Scroll.AUTO);
|
| 189 |
gduche |
71 |
|
| 215 |
aurelien |
72 |
panneauIdentite = new ContentPanel();
|
|
|
73 |
panneauIdentite.setWidth("400px");
|
|
|
74 |
panneauIdentite.setHeaderVisible(false);
|
|
|
75 |
panneauIdentite.setBorders(false);
|
|
|
76 |
panneauIdentite.setBodyBorder(false);
|
|
|
77 |
panneauImage = new ContentPanel();
|
| 253 |
gduche |
78 |
panneauImage.setLayout(new FlowLayout());
|
| 215 |
aurelien |
79 |
panneauImage.setBorders(false);
|
| 253 |
gduche |
80 |
panneauImage.setWidth(350);
|
| 215 |
aurelien |
81 |
panneauImage.setBodyBorder(false);
|
|
|
82 |
panneauImage.setHeaderVisible(false);
|
| 200 |
gduche |
83 |
|
| 259 |
gduche |
84 |
//Gérer l'alignement vertical en haut
|
| 253 |
gduche |
85 |
TableData td = new TableData();
|
| 259 |
gduche |
86 |
td.setVerticalAlign(VerticalAlignment.TOP);
|
|
|
87 |
|
|
|
88 |
tabIdentite.add(panneauIdentite, td);
|
| 253 |
gduche |
89 |
tabIdentite.add(panneauImage, td);
|
| 259 |
gduche |
90 |
|
| 253 |
gduche |
91 |
|
| 197 |
gduche |
92 |
fsIdentite = new FieldSet();
|
|
|
93 |
fsIdentite.setLayout(new FormLayout());
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
fsContact = new FieldSet();
|
|
|
97 |
fsContact.setLayout(new FormLayout());
|
|
|
98 |
|
| 269 |
gduche |
99 |
tabPanel.add(tabIdentite);
|
| 197 |
gduche |
100 |
|
| 200 |
gduche |
101 |
//Onglet Adresse:
|
| 259 |
gduche |
102 |
tabAdresse = new TabItem("Adresses");
|
| 200 |
gduche |
103 |
fsAdressePerso = new FieldSet();
|
|
|
104 |
fsAdressePerso.setLayout(new FormLayout());
|
|
|
105 |
|
| 269 |
gduche |
106 |
tabPanel.add(tabAdresse);
|
| 200 |
gduche |
107 |
|
| 215 |
aurelien |
108 |
//Onglet info naturalistes
|
|
|
109 |
tabInfosNat = new TabItem("Informations naturalistes");
|
| 269 |
gduche |
110 |
fsSpec = new FieldSet();
|
|
|
111 |
fsSpec.setLayout(new FormLayout());
|
| 200 |
gduche |
112 |
|
| 269 |
gduche |
113 |
tabPanel.add(tabInfosNat);
|
| 198 |
gduche |
114 |
|
| 150 |
gduche |
115 |
}
|
|
|
116 |
|
|
|
117 |
public void afficherDetailPersonne(Personne personne) {
|
|
|
118 |
if (personne != null) {
|
| 198 |
gduche |
119 |
|
|
|
120 |
|
|
|
121 |
//MAJ Identité : Configurer les fieldSet
|
| 215 |
aurelien |
122 |
panneauIdentite.removeAll();
|
|
|
123 |
panneauImage.removeAll();
|
| 150 |
gduche |
124 |
|
| 197 |
gduche |
125 |
fsIdentite.setHeading("Identité");
|
| 259 |
gduche |
126 |
//fsIdentite.setWidth("350px");
|
| 183 |
gduche |
127 |
|
| 197 |
gduche |
128 |
fsContact.setHeading("Contact");
|
| 259 |
gduche |
129 |
//fsContact.setWidth("350px");
|
| 183 |
gduche |
130 |
|
| 215 |
aurelien |
131 |
panneauIdentite.add(fsIdentite);
|
|
|
132 |
|
| 259 |
gduche |
133 |
|
| 253 |
gduche |
134 |
//La personne peut avoir un ou plusieurs logo
|
|
|
135 |
panneauImage.setHeight("100%");
|
| 259 |
gduche |
136 |
panneauImage.setPosition(0, 6);
|
|
|
137 |
panneauImage.setBorders(false);
|
| 198 |
gduche |
138 |
|
| 253 |
gduche |
139 |
LinkedList<String> listeLogos = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_logo");
|
|
|
140 |
if ((listeLogos != null)&&(listeLogos.size() > 0)) {
|
| 259 |
gduche |
141 |
panneauImage.setBorders(true);
|
| 253 |
gduche |
142 |
for (int i = 0; i < listeLogos.size(); i++) {
|
|
|
143 |
String logoUrl = listeLogos.get(i);
|
|
|
144 |
if ((logoUrl!=null)&&(!logoUrl.trim().equals(""))) {
|
|
|
145 |
//Si c'est le cas, on l'affiche sur la même ligne que fsIdentité
|
|
|
146 |
Image img = new Image();
|
|
|
147 |
img.setUrl(logoUrl);
|
|
|
148 |
|
|
|
149 |
panneauImage.add(img);
|
|
|
150 |
if (panneauImage.getWidth() < (img.getWidth() + 15)) {
|
|
|
151 |
panneauImage.setWidth(img.getWidth() + 15);
|
|
|
152 |
}
|
|
|
153 |
|
|
|
154 |
}
|
|
|
155 |
}
|
| 246 |
gduche |
156 |
|
| 189 |
gduche |
157 |
}
|
| 150 |
gduche |
158 |
|
| 215 |
aurelien |
159 |
panneauIdentite.add(fsContact);
|
| 183 |
gduche |
160 |
|
| 197 |
gduche |
161 |
fsIdentite.removeAll();
|
|
|
162 |
fsContact.removeAll();
|
| 215 |
aurelien |
163 |
fsAdressePerso.removeAll();
|
| 269 |
gduche |
164 |
fsSpec.removeAll();
|
| 197 |
gduche |
165 |
//Ajout des champs Identité
|
|
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
|
169 |
// TODO: projet
|
|
|
170 |
|
|
|
171 |
// nom complet
|
|
|
172 |
Object nomComplet = personne.obtenirValeurChamp("fmt_nom_complet");
|
| 266 |
gduche |
173 |
ajouterLabelField(fsIdentite,"Nom Complet", nomComplet);
|
| 197 |
gduche |
174 |
|
| 259 |
gduche |
175 |
// Nom autre : champ truk; non-typé
|
|
|
176 |
LinkedList<String> nomsAutre = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_nom_autre");
|
|
|
177 |
if ((nomsAutre != null)&&(nomsAutre.size() > 0)) {
|
|
|
178 |
|
|
|
179 |
LabelField noms = new LabelField();
|
|
|
180 |
noms.setFieldLabel("Autres noms:");
|
|
|
181 |
String listeNoms = UtilTruk.traiterTrukListe(nomsAutre, ", ");
|
|
|
182 |
noms.setValue(listeNoms);
|
|
|
183 |
fsIdentite.add(noms);
|
|
|
184 |
}
|
| 197 |
gduche |
185 |
|
|
|
186 |
// abreviation
|
|
|
187 |
Object abreviation = personne.obtenirValeurChamp("abreviation");
|
| 266 |
gduche |
188 |
ajouterLabelField(fsIdentite, "Abreviation", abreviation);
|
| 197 |
gduche |
189 |
|
| 259 |
gduche |
190 |
// Abréviations, autre : non-typé
|
|
|
191 |
LinkedList<String> abrevAutres = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_abreviation_autre");
|
|
|
192 |
if ((abrevAutres != null)&&(abrevAutres.size() > 0)) {
|
|
|
193 |
|
|
|
194 |
LabelField abreviations = new LabelField();
|
|
|
195 |
abreviations.setFieldLabel("Autres abreviations:");
|
|
|
196 |
String listeAbrev = UtilTruk.traiterTrukListe(abrevAutres, ", ");
|
|
|
197 |
abreviations.setValue(listeAbrev);
|
|
|
198 |
fsIdentite.add(abreviations);
|
|
|
199 |
}
|
|
|
200 |
fsIdentite.addText("<hr>");
|
| 197 |
gduche |
201 |
|
| 259 |
gduche |
202 |
// date naissance
|
|
|
203 |
// TODO : Mettre la date en format FR 10/12/09
|
|
|
204 |
Object dateNaissance = personne.obtenirValeurChamp("naissance_date");
|
| 266 |
gduche |
205 |
ajouterLabelField(fsIdentite, "Né le", dateNaissance);
|
| 259 |
gduche |
206 |
|
| 197 |
gduche |
207 |
// lieu naissance
|
| 259 |
gduche |
208 |
Object lieuNaissance = personne.obtenirValeurChamp("naissance_lieu");
|
| 266 |
gduche |
209 |
ajouterLabelField(fsIdentite, "A", lieuNaissance);
|
| 197 |
gduche |
210 |
|
|
|
211 |
// date deces
|
| 259 |
gduche |
212 |
Object dateDeces = personne.obtenirValeurChamp("deces_date");
|
| 266 |
gduche |
213 |
ajouterLabelField(fsIdentite, "Date décès", dateDeces);
|
| 197 |
gduche |
214 |
|
|
|
215 |
// lieu deces
|
| 259 |
gduche |
216 |
Object lieuDeces = personne.obtenirValeurChamp("deces_lieu");
|
| 266 |
gduche |
217 |
ajouterLabelField(fsIdentite, "Lieu de décès", lieuDeces);
|
| 197 |
gduche |
218 |
|
| 259 |
gduche |
219 |
fsIdentite.addText("<hr>");
|
|
|
220 |
|
| 200 |
gduche |
221 |
//Description
|
|
|
222 |
String description = (String) personne.obtenirValeurChamp("description");
|
|
|
223 |
if ((description!=null)&&(!description.trim().equals(""))) {
|
| 253 |
gduche |
224 |
LabelField txtDescription = new LabelField();
|
|
|
225 |
txtDescription.setFieldLabel("Description:");
|
| 200 |
gduche |
226 |
txtDescription.setValue(description);
|
|
|
227 |
|
| 253 |
gduche |
228 |
//rendreNonEditable(txtDescription);
|
| 200 |
gduche |
229 |
|
|
|
230 |
fsIdentite.add(txtDescription);
|
|
|
231 |
}
|
| 197 |
gduche |
232 |
|
|
|
233 |
|
| 253 |
gduche |
234 |
// CONTACT
|
|
|
235 |
// Téléphones
|
|
|
236 |
// > Plusieurs téléphones possible, typés
|
|
|
237 |
Constantes constantesI18n = (Constantes) GWT.create(Constantes.class);
|
| 197 |
gduche |
238 |
|
| 253 |
gduche |
239 |
HashMap<String, String> mapTelephones = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
|
|
|
240 |
if ((mapTelephones != null)&&(mapTelephones.size() > 0)) {
|
|
|
241 |
|
|
|
242 |
Collection<String> telephoneKeys = mapTelephones.keySet();
|
|
|
243 |
Iterator<String> itTelephones = telephoneKeys.iterator();
|
|
|
244 |
|
|
|
245 |
while (itTelephones.hasNext()) {
|
|
|
246 |
String key = itTelephones.next();
|
|
|
247 |
LabelField telephoneLabel = new LabelField();
|
|
|
248 |
String label = "";
|
|
|
249 |
try {
|
|
|
250 |
label = constantesI18n.getString(key);
|
|
|
251 |
}
|
|
|
252 |
catch (MissingResourceException e) {
|
|
|
253 |
label = key;
|
|
|
254 |
}
|
|
|
255 |
|
|
|
256 |
telephoneLabel.setFieldLabel( label + ":");
|
|
|
257 |
|
|
|
258 |
telephoneLabel.setValue(mapTelephones.get(key));
|
|
|
259 |
|
|
|
260 |
fsContact.add(telephoneLabel);
|
|
|
261 |
}
|
| 215 |
aurelien |
262 |
}
|
| 197 |
gduche |
263 |
|
| 253 |
gduche |
264 |
// Fax
|
|
|
265 |
// > Plusieurs fax possible, typés
|
|
|
266 |
|
|
|
267 |
HashMap<String, String> mapFax = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_fax");
|
|
|
268 |
if ((mapFax != null)&&(mapFax.size() > 0)) {
|
|
|
269 |
|
|
|
270 |
Collection<String> faxKeys = mapFax.keySet();
|
|
|
271 |
Iterator<String> itFax = faxKeys.iterator();
|
|
|
272 |
|
|
|
273 |
while (itFax.hasNext()) {
|
|
|
274 |
String key = itFax.next();
|
|
|
275 |
LabelField faxLabel = new LabelField();
|
|
|
276 |
String label = "";
|
|
|
277 |
try {
|
|
|
278 |
label = constantesI18n.getString(key);
|
|
|
279 |
}
|
|
|
280 |
catch (MissingResourceException e) {
|
|
|
281 |
label = key;
|
|
|
282 |
}
|
|
|
283 |
|
|
|
284 |
faxLabel.setFieldLabel( label + ":");
|
|
|
285 |
|
|
|
286 |
faxLabel.setValue(mapTelephones.get(key));
|
|
|
287 |
|
|
|
288 |
fsContact.add(faxLabel);
|
|
|
289 |
}
|
|
|
290 |
}
|
|
|
291 |
|
|
|
292 |
// Courriel
|
|
|
293 |
// Courriel est un champ truk de la forme "Adresse@adr.com;; adr2@adr.fr ..."
|
|
|
294 |
|
|
|
295 |
LinkedList<String> listeCourriel = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
|
|
|
296 |
if ((listeCourriel!=null)&&(listeCourriel.size() > 0)) {
|
|
|
297 |
String strLabelCourriel = "Courriel";
|
|
|
298 |
if (listeCourriel.size() > 1) {
|
|
|
299 |
strLabelCourriel += "s";
|
|
|
300 |
}
|
|
|
301 |
|
|
|
302 |
LabelField labelCourriel = new LabelField();
|
|
|
303 |
labelCourriel.setFieldLabel(strLabelCourriel);
|
|
|
304 |
|
|
|
305 |
String valeurCourriel = "";
|
|
|
306 |
Iterator<String> itCourriel = listeCourriel.iterator();
|
|
|
307 |
while (itCourriel.hasNext()) {
|
|
|
308 |
String valeurCourante = itCourriel.next();
|
|
|
309 |
valeurCourriel += "<a href=\"mailto:" + valeurCourante + "\">" + valeurCourante + "</a><br />";
|
|
|
310 |
|
|
|
311 |
}
|
|
|
312 |
|
|
|
313 |
labelCourriel.setValue(valeurCourriel);
|
|
|
314 |
fsContact.add(labelCourriel);
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
|
| 260 |
gduche |
318 |
// Url Site Webs
|
|
|
319 |
LinkedList listeUrl = (LinkedList) personne.getChaineDenormaliseAsMapOrList("truk_url");
|
|
|
320 |
if (listeUrl!=null && listeUrl.size() > 0) {
|
|
|
321 |
String strUrl = "";
|
|
|
322 |
Iterator<String> urlIt = listeUrl.iterator();
|
|
|
323 |
while (urlIt.hasNext()) {
|
|
|
324 |
String urlCourante = urlIt.next();
|
|
|
325 |
strUrl += "<a href=\""+urlCourante+"\">" + urlCourante + "</a> <br/>";
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
}
|
|
|
329 |
|
|
|
330 |
LabelField urlLabelField = new LabelField();
|
|
|
331 |
urlLabelField.setFieldLabel("Url:");
|
|
|
332 |
urlLabelField.setValue(strUrl);
|
|
|
333 |
fsContact.add(urlLabelField);
|
|
|
334 |
}
|
|
|
335 |
|
|
|
336 |
|
| 215 |
aurelien |
337 |
panneauIdentite.add(fsContact);
|
| 197 |
gduche |
338 |
|
| 198 |
gduche |
339 |
|
| 215 |
aurelien |
340 |
fsAdressePerso.setHeading("Adresse personnelle");
|
|
|
341 |
|
| 198 |
gduche |
342 |
/*
|
|
|
343 |
* Adresses :
|
| 215 |
aurelien |
344 |
* */
|
| 197 |
gduche |
345 |
String adresse01 = (String) personne.obtenirValeurChamp("adresse_01");
|
| 266 |
gduche |
346 |
ajouterLabelField(fsAdressePerso, "Adresse", adresse01);
|
| 197 |
gduche |
347 |
|
|
|
348 |
String adresse02 = (String) personne.obtenirValeurChamp("adresse_02");
|
| 266 |
gduche |
349 |
ajouterLabelField(fsAdressePerso, "", adresse02);
|
| 197 |
gduche |
350 |
|
|
|
351 |
String boitePostale = (String) personne.obtenirValeurChamp("bp");
|
| 266 |
gduche |
352 |
ajouterLabelField(fsAdressePerso, "Boite Postale", boitePostale);
|
| 197 |
gduche |
353 |
|
|
|
354 |
String codePostal = (String) personne.obtenirValeurChamp("code_postal");
|
| 266 |
gduche |
355 |
ajouterLabelField(fsAdressePerso, "Code postal", codePostal);
|
| 197 |
gduche |
356 |
|
|
|
357 |
String ville = (String) personne.obtenirValeurChamp("ville");
|
| 266 |
gduche |
358 |
ajouterLabelField(fsAdressePerso, "Ville", ville);
|
| 197 |
gduche |
359 |
|
|
|
360 |
String region = (String) personne.obtenirValeurChamp("region");
|
| 266 |
gduche |
361 |
ajouterLabelField(fsAdressePerso, "Région", region);
|
| 197 |
gduche |
362 |
|
|
|
363 |
String pays = (String) personne.obtenirValeurChamp("pays");
|
| 266 |
gduche |
364 |
ajouterLabelField(fsAdressePerso, "Pays", pays);
|
| 197 |
gduche |
365 |
|
| 215 |
aurelien |
366 |
fsAdressePerso.addText("<br >");
|
|
|
367 |
fsAdressePerso.setWidth("350px");
|
| 197 |
gduche |
368 |
|
| 215 |
aurelien |
369 |
tabAdresse.add(fsAdressePerso);
|
| 267 |
gduche |
370 |
//tabAdresse.setScrollMode(Scroll.AUTO);
|
| 246 |
gduche |
371 |
|
| 215 |
aurelien |
372 |
|
| 260 |
gduche |
373 |
/*
|
|
|
374 |
* Infos naturalistes
|
|
|
375 |
* */
|
|
|
376 |
|
|
|
377 |
// Biographie
|
| 267 |
gduche |
378 |
// Spécialité (typé)
|
|
|
379 |
|
| 269 |
gduche |
380 |
fsSpec.setHeading("Spécialités");
|
|
|
381 |
tabInfosNat.add(fsSpec);
|
| 267 |
gduche |
382 |
|
|
|
383 |
HashMap hmSpecialite = (HashMap) personne.getChaineDenormaliseAsMapOrList("ce_truk_specialite");
|
|
|
384 |
if ((hmSpecialite != null)&&(hmSpecialite.size() > 0)) {
|
|
|
385 |
|
|
|
386 |
Collection<String> specialiteKeys = hmSpecialite.keySet();
|
|
|
387 |
Iterator<String> itSpec = specialiteKeys.iterator();
|
|
|
388 |
|
|
|
389 |
while (itSpec.hasNext()) {
|
|
|
390 |
String key = itSpec.next();
|
|
|
391 |
LabelField specLabel = new LabelField();
|
|
|
392 |
String label = "";
|
|
|
393 |
try {
|
|
|
394 |
label = constantesI18n.getString(key);
|
|
|
395 |
}
|
|
|
396 |
catch (MissingResourceException e) {
|
|
|
397 |
label = key;
|
|
|
398 |
}
|
|
|
399 |
|
|
|
400 |
specLabel.setFieldLabel( label + ":");
|
|
|
401 |
|
|
|
402 |
specLabel.setValue(hmSpecialite.get(key));
|
|
|
403 |
|
| 269 |
gduche |
404 |
fsSpec.add(specLabel);
|
| 267 |
gduche |
405 |
}
|
|
|
406 |
}
|
| 269 |
gduche |
407 |
|
|
|
408 |
// Récolte
|
|
|
409 |
LinkedList<String> lstRecolte = (LinkedList) personne.getChaineDenormaliseAsMapOrList("truk_recolte");
|
|
|
410 |
if ((lstRecolte!=null)&&(lstRecolte.size()>0)) {
|
|
|
411 |
FieldSet fsRecolte = new FieldSet();
|
|
|
412 |
fsRecolte.setHeading("Récoltes");
|
|
|
413 |
fsRecolte.setLayout(new FormLayout());
|
|
|
414 |
|
|
|
415 |
Iterator<String> itRecolte = lstRecolte.iterator();
|
|
|
416 |
while (itRecolte.hasNext()) {
|
|
|
417 |
|
|
|
418 |
String recolteCourante = itRecolte.next();
|
|
|
419 |
LabelField lfRecolte = new LabelField();
|
|
|
420 |
String[] splitRecolte = recolteCourante.split("\\|");
|
|
|
421 |
|
|
|
422 |
String labelRecolte = "";
|
|
|
423 |
if (splitRecolte.length > 1) {
|
|
|
424 |
|
| 280 |
gduche |
425 |
lfRecolte.setValue(splitRecolte[1]);
|
| 269 |
gduche |
426 |
}
|
|
|
427 |
|
| 280 |
gduche |
428 |
lfRecolte.setFieldLabel(splitRecolte[0]);
|
| 269 |
gduche |
429 |
|
|
|
430 |
// TODO : lier avec BDD ISO-3166-2
|
|
|
431 |
|
|
|
432 |
fsRecolte.add(lfRecolte);
|
|
|
433 |
|
|
|
434 |
}
|
|
|
435 |
|
|
|
436 |
tabInfosNat.add(fsRecolte);
|
|
|
437 |
}
|
| 260 |
gduche |
438 |
// tabInfosNat
|
| 150 |
gduche |
439 |
layout();
|
| 197 |
gduche |
440 |
}
|
|
|
441 |
}
|
|
|
442 |
|
| 266 |
gduche |
443 |
private void ajouterLabelField(FieldSet fs, String tfLabel, Object tfValue) {
|
| 197 |
gduche |
444 |
|
|
|
445 |
if ((tfValue!=null)&&(!tfValue.toString().trim().equals(""))) {
|
| 189 |
gduche |
446 |
|
| 246 |
gduche |
447 |
|
|
|
448 |
LabelField tf = new LabelField();
|
| 197 |
gduche |
449 |
|
| 246 |
gduche |
450 |
tf.setFieldLabel(tfLabel + ":");
|
| 197 |
gduche |
451 |
if ((tfLabel==null)||("".equals(tfLabel))) {
|
|
|
452 |
tf.setHideLabel(true);
|
|
|
453 |
tf.setStyleAttribute("margin", "0 0 0 105px");
|
|
|
454 |
}
|
|
|
455 |
tf.setValue(tfValue);
|
|
|
456 |
|
| 200 |
gduche |
457 |
//Ajout au fieldSet
|
|
|
458 |
fs.add(tf);
|
|
|
459 |
}
|
|
|
460 |
}
|
|
|
461 |
|
| 266 |
gduche |
462 |
|
| 197 |
gduche |
463 |
|
|
|
464 |
|
| 183 |
gduche |
465 |
public void rafraichir(Object nouvelleDonnees) {
|
| 227 |
aurelien |
466 |
|
|
|
467 |
// Si on a reçu une personne on en affiche les détails
|
| 183 |
gduche |
468 |
if (nouvelleDonnees instanceof Personne) {
|
|
|
469 |
afficherDetailPersonne((Personne) nouvelleDonnees);
|
| 227 |
aurelien |
470 |
}
|
| 150 |
gduche |
471 |
}
|
|
|
472 |
|
| 197 |
gduche |
473 |
}
|