Subversion Repositories eFlore/Applications.coel

Rev

Rev 907 | Rev 934 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 907 Rev 915
Line 12... Line 12...
12
import org.tela_botanica.client.configuration.Configuration;
12
import org.tela_botanica.client.configuration.Configuration;
13
import org.tela_botanica.client.interfaces.Rafraichissable;
13
import org.tela_botanica.client.interfaces.Rafraichissable;
14
import org.tela_botanica.client.modeles.Personne;
14
import org.tela_botanica.client.modeles.Personne;
15
import org.tela_botanica.client.modeles.Valeur;
15
import org.tela_botanica.client.modeles.Valeur;
16
import org.tela_botanica.client.modeles.ValeurListe;
16
import org.tela_botanica.client.modeles.ValeurListe;
17
import org.tela_botanica.client.util.UtilTruk;
17
import org.tela_botanica.client.util.Debug;
Line 18... Line 18...
18
 
18
 
19
import com.extjs.gxt.ui.client.Registry;
19
import com.extjs.gxt.ui.client.Registry;
20
import com.extjs.gxt.ui.client.Style.Scroll;
20
import com.extjs.gxt.ui.client.Style.Scroll;
21
import com.extjs.gxt.ui.client.util.Format;
21
import com.extjs.gxt.ui.client.util.Format;
Line 27... Line 27...
27
import com.extjs.gxt.ui.client.widget.form.FieldSet;
27
import com.extjs.gxt.ui.client.widget.form.FieldSet;
28
import com.extjs.gxt.ui.client.widget.form.LabelField;
28
import com.extjs.gxt.ui.client.widget.form.LabelField;
29
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
29
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
30
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
30
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
31
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
31
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
32
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
-
 
33
import com.google.gwt.user.client.ui.Image;
32
import com.google.gwt.user.client.ui.Image;
Line 34... Line 33...
34
 
33
 
Line 35... Line 34...
35
public class PersonneDetailVue extends DetailVue implements Rafraichissable {
34
public class PersonneDetailVue extends DetailVue implements Rafraichissable {
36
 
35
 
37
	private TabPanel tabPanel;
36
	private TabPanel tabPanel;
38
	private Html entete;
37
	private Html entete;
39
 
38
	
40
	private TabItem tabIdentite;
39
	private TabItem tabIdentite;
41
	private TabItem tabAdresse;
40
	private TabItem tabAdresse;
Line -... Line 41...
-
 
41
	private TabItem tabInfosNat;
-
 
42
	private TabItem tabLogos;
-
 
43
 
-
 
44
	private HashMap hmLabelFieldRegion = new HashMap();
-
 
45
	
-
 
46
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
-
 
47
	private boolean ontologieRecue = false;
42
	private TabItem tabInfosNat;
48
	private Personne personneAAfficher = null;
43
	private TabItem tabLogos;
49
 
44
 
50
	
Line 45... Line 51...
45
	private void chargerOntologie() {
51
	private void chargerOntologie() {
46
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
-
 
47
	}
52
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
48
	
53
	}
Line 49... Line 54...
49
	
54
	
Line 63... Line 68...
63
		panneauPrincipal.setLayout(new FitLayout());
68
		panneauPrincipal.setLayout(new FitLayout());
64
		panneauPrincipal.setHeaderVisible(false);
69
		panneauPrincipal.setHeaderVisible(false);
65
		panneauPrincipal.setBodyBorder(true);
70
		panneauPrincipal.setBodyBorder(true);
66
		panneauPrincipal.setTopComponent(entete);
71
		panneauPrincipal.setTopComponent(entete);
Line 67... Line 72...
67
 
72
 
68
		tabIdentite = new TabItem(mediateur.i18nC.personneIdentite());
73
		tabIdentite = new TabItem(i18nC.personneIdentite());
69
		tabIdentite.setLayout(new AnchorLayout());
74
		tabIdentite.setLayout(new AnchorLayout());
Line 70... Line 75...
70
		tabIdentite.setScrollMode(Scroll.AUTO);
75
		tabIdentite.setScrollMode(Scroll.AUTO);
71
 
76
 
72
		tabAdresse = new TabItem(mediateur.i18nC.personneAdresses());
77
		tabAdresse = new TabItem(i18nC.personneAdresses());
Line 73... Line 78...
73
		tabAdresse.setLayout(new FitLayout());
78
		tabAdresse.setLayout(new FitLayout());
74
		tabAdresse.setScrollMode(Scroll.AUTO);
79
		tabAdresse.setScrollMode(Scroll.AUTO);
Line 75... Line 80...
75
 
80
 
76
		tabInfosNat = new TabItem(mediateur.i18nC.personneInfoNat());
81
		tabInfosNat = new TabItem(i18nC.personneInfoNat());
77
		tabInfosNat.setScrollMode(Scroll.AUTO);
82
		tabInfosNat.setScrollMode(Scroll.AUTO);
Line 78... Line 83...
78
 
83
 
79
		tabLogos = new TabItem(mediateur.i18nC.personneLogos());
84
		tabLogos = new TabItem(i18nC.personneLogos());
Line 91... Line 96...
91
 
96
 
92
		panneauPrincipal.add(tabPanel);
97
		panneauPrincipal.add(tabPanel);
93
		add(panneauPrincipal);
98
		add(panneauPrincipal);
Line 94... Line -...
94
	}
-
 
95
 
-
 
96
	private HashMap hmLabelFieldRegion = new HashMap();
99
	}
97
 
100
 
98
	public void afficherDetailPersonne(Personne personne) {
-
 
99
		if (personne != null) {
101
	public void afficherDetailPersonne(Personne personne) {
Line 100... Line 102...
100
 
102
		if (personne != null) {
101
			String tplEntete = initialiserTplEntete();
103
			String tplEntete = initialiserTplEntete();
102
 
104
 
Line 127... Line 129...
127
			} else {
129
			} else {
128
				enteteParams.set("image", "");
130
				enteteParams.set("image", "");
129
				tabLogos.disable();
131
				tabLogos.disable();
130
			}
132
			}
Line 131... Line -...
131
 
-
 
132
			entete.el()
133
 
Line 133... Line 134...
133
					.setInnerHtml(Format.substitute(tplEntete, enteteParams));
134
			entete.el().setInnerHtml(Format.substitute(tplEntete, enteteParams));
Line 134... Line 135...
134
 
135
 
135
			String tplIdentite = initialiserTplIdentite();
136
			String tplIdentite = initialiserTplIdentite();
Line 141... Line 142...
141
			tabIdentiteParams.set("naissance_lieu", personne.getString("naissance_lieu"));
142
			tabIdentiteParams.set("naissance_lieu", personne.getString("naissance_lieu"));
142
			String tplDeces = "";
143
			String tplDeces = "";
143
			if (personne.estDecedee())	{
144
			if (personne.estDecedee())	{
144
				tplDeces = " <h2>Décès:</h2>"
145
				tplDeces = " <h2>Décès:</h2>"
145
						+ " <span><b>"
146
						+ " <span><b>"
146
						+ mediateur.i18nC.personneDateDeces()
147
						+ i18nC.personneDateDeces()
147
						+ ":</b></span> {deces_date}<br />"
148
						+ ":</b></span> {deces_date}<br />"
148
						+ " 	 <span><b>"
149
						+ " 	 <span><b>"
149
						+ mediateur.i18nC.personneLieuDeces()
150
						+ i18nC.personneLieuDeces()
150
						+ ":</b></span> {deces_lieu}<br /><br />";
151
						+ ":</b></span> {deces_lieu}<br /><br />";
Line 151... Line 152...
151
				
152
				
152
				tabIdentiteParams.set("deces_date", personne.getDecesDate());
153
				tabIdentiteParams.set("deces_date", personne.getDecesDate());
153
				tabIdentiteParams.set("deces_lieu", personne.getString("deces_lieu"));
154
				tabIdentiteParams.set("deces_lieu", personne.getString("deces_lieu"));
Line 174... Line 175...
174
				while (itTelephones.hasNext()) {
175
				while (itTelephones.hasNext()) {
175
					String key = itTelephones.next();
176
					String key = itTelephones.next();
176
					String label = mapTelephones.get(key);
177
					String label = mapTelephones.get(key);
Line 177... Line 178...
177
 
178
 
178
					try {
179
					try {
179
						label = mediateur.i18nC.getString(label);
180
						label = i18nC.getString(label);
180
					} catch (MissingResourceException e) {
181
					} catch (MissingResourceException e) {
Line 181... Line 182...
181
					}
182
					}
182
 
183
 
Line 254... Line 255...
254
			tabAdresse.setStyleAttribute("padding", "15px");
255
			tabAdresse.setStyleAttribute("padding", "15px");
Line 255... Line 256...
255
 
256
 
256
			// Infos naturalistes :Biographie, Spécialité (typé)
257
			// Infos naturalistes :Biographie, Spécialité (typé)
257
			String tplInfosNat = "<div class='{css_corps}'>"
258
			String tplInfosNat = "<div class='{css_corps}'>"
258
					+ "	<div class='{css_fieldset}'>" + "		<h2>"
259
					+ "	<div class='{css_fieldset}'>" + "		<h2>"
259
					+ mediateur.i18nC.personneSpecialite() + "</h1>"
260
					+ i18nC.personneSpecialite() + "</h1>"
260
					+ "			{specialites}" + "		<h2>"
261
					+ "			{specialites}" + "		<h2>"
261
					+ mediateur.i18nC.personneRecolte() + "</h2>"
262
					+ i18nC.personneRecolte() + "</h2>"
262
					+ "		{recoltes}" + "  </div>" + "</div>";
263
					+ "		{recoltes}" + "  </div>" + "</div>";
Line 263... Line 264...
263
			Params prmInfosNat = new Params();
264
			Params prmInfosNat = new Params();
Line 277... Line 278...
277
			layout();
278
			layout();
278
		}
279
		}
279
	}
280
	}
Line 280... Line 281...
280
 
281
 
281
	public String initialiserTplEntete() {
-
 
282
 
282
	public String initialiserTplEntete() {
283
		return "<div id='{css_id}'>" + "<h1>{nom}</h1>"
283
		return "<div id='{css_id}'>" + "<h1>{nom}</h1>"
284
				+ "<h2><a href='{mail}'>{mail}</a></h2>" + "</div>";
284
				+ "<h2><a href='{mail}'>{mail}</a></h2>" + "</div>";
Line 285... Line 285...
285
	}
285
	}
286
 
-
 
287
	public String initialiserTplIdentite() {
286
 
288
 
287
	public String initialiserTplIdentite() {
289
		return "<div class='{css_corps}'>" + "	<div class='{css_fieldset}'>"
288
		return "<div class='{css_corps}'>" + "	<div class='{css_fieldset}'>"
290
				+ "	 <h2>Noms:</h2>" + "	 <span><b>"
289
				+ "	 <h2>Noms:</h2>" + "	 <span><b>"
291
				+ mediateur.i18nC.personneNomComplet()
290
				+ i18nC.personneNomComplet()
292
				+ ":</b></span> {nom_complet}<br />"
291
				+ ":</b></span> {nom_complet}<br />"
293
				+ "	 <span><b>"
292
				+ "	 <span><b>"
294
				+ mediateur.i18nC.personneNomAutre()
293
				+ i18nC.personneNomAutre()
295
				+ ":</b></span> {nom_autre}<br />"
294
				+ ":</b></span> {nom_autre}<br />"
296
				+ "	 <span><b>"
295
				+ "	 <span><b>"
297
				+ mediateur.i18nC.personneAbreviation()
296
				+ i18nC.personneAbreviation()
298
				+ ":</b></span> {abreviation}<br />"
297
				+ ":</b></span> {abreviation}<br />"
299
				+ " 	 <span><b>"
298
				+ " 	 <span><b>"
300
				+ mediateur.i18nC.personneAbreviationAutre()
299
				+ i18nC.personneAbreviationAutre()
301
				+ ":</b></b></span> {abreviation_autre}<br /><br />"
300
				+ ":</b></b></span> {abreviation_autre}<br /><br />"
302
				+ "	 <h2>Naissance:</h2>"
301
				+ "	 <h2>Naissance:</h2>"
303
				+ " 	 <span><b>"
302
				+ " 	 <span><b>"
304
				+ mediateur.i18nC.personneDateNaissance()
303
				+ i18nC.personneDateNaissance()
305
				+ ":</b></span> {naissance_date}<br />"
304
				+ ":</b></span> {naissance_date}<br />"
306
				+ " 	 <span><b>"
305
				+ " 	 <span><b>"
307
				+ mediateur.i18nC.personneLieuNaissance()
306
				+ i18nC.personneLieuNaissance()
308
				+ ":</b></span> {naissance_lieu}<br /><br />"
307
				+ ":</b></span> {naissance_lieu}<br /><br />"
309
				+ "{tplDeces}"
308
				+ "{tplDeces}"
310
				+ " 	</div>"
309
				+ " 	</div>"
Line 314... Line 313...
314
				+ "	<h2>Description:</h2>"
313
				+ "	<h2>Description:</h2>"
315
				+ " 		{description}<br />" + "	</div>" + "<br />";
314
				+ " 		{description}<br />" + "	</div>" + "<br />";
316
	}
315
	}
Line 317... Line 316...
317
 
316
 
318
	private void changerLabelRegions() {
-
 
319
 
317
	private void changerLabelRegions() {
320
		Collection<String> colClesComposants = hmLabelFieldRegion.keySet();
318
		Collection<String> colClesComposants = hmLabelFieldRegion.keySet();
Line 321... Line 319...
321
		Iterator<String> itComposants = colClesComposants.iterator();
319
		Iterator<String> itComposants = colClesComposants.iterator();
322
 
320
 
323
		while (itComposants.hasNext()) {
321
		while (itComposants.hasNext()) {
324
			String region = itComposants.next();
322
			String region = itComposants.next();
325
			mediateur.obtenirValeurEtRafraichir(this, "region", region);
323
			mediateur.obtenirValeurEtRafraichir(this, "region", region);
Line 326... Line 324...
326
		}
324
		}
327
	}
-
 
328
 
325
	}
Line 329... Line 326...
329
	private void ajouterLabelField(FieldSet fs, String tfLabel, Object tfValue) {
326
 
Line 330... Line 327...
330
 
327
	private void ajouterLabelField(FieldSet fs, String tfLabel, Object tfValue) {
Line 341... Line 338...
341
 
338
 
342
			// Ajout au fieldSet
339
			// Ajout au fieldSet
343
			fs.add(tf);
340
			fs.add(tf);
344
		}
341
		}
345
	}
-
 
346
 
-
 
347
	private Configuration config = (Configuration) Registry
-
 
348
			.get(RegistreId.CONFIG);
-
 
349
 
-
 
350
	private boolean ontologieRecue = false;
-
 
Line 351... Line 342...
351
	private Personne personneAAfficher = null;
342
	}
352
	
-
 
353
	public void rafraichir(Object nouvellesDonnees) {
343
	
354
 
344
	public void rafraichir(Object nouvellesDonnees) {
355
		// Si on a reçu une personne on en affiche les détails
-
 
356
		if (nouvellesDonnees instanceof Personne) {
-
 
357
			if (ontologieRecue)	{
-
 
358
				afficherDetailPersonne((Personne) nouvellesDonnees);
345
		// Si on a reçu une personne on en affiche les détails
359
			} else	{
-
 
360
				personneAAfficher = (Personne) nouvellesDonnees;
346
		if (nouvellesDonnees instanceof Personne) {
361
			}
347
			personneAAfficher = (Personne) nouvellesDonnees;
362
		} else if (nouvellesDonnees instanceof ValeurListe) {
348
		} else if (nouvellesDonnees instanceof ValeurListe) {
363
			ValeurListe ontologieReceptionnee = (ValeurListe) nouvellesDonnees;
-
 
364
			ajouterListeValeursAOntologie(ontologieReceptionnee);
-
 
365
			
-
 
366
			if (personneAAfficher != null)	{
-
 
367
				afficherDetailPersonne(personneAAfficher);
349
			ValeurListe ontologieReceptionnee = (ValeurListe) nouvellesDonnees;
Line 368... Line 350...
368
			}
350
			ajouterListeValeursAOntologie(ontologieReceptionnee);
369
			ontologieRecue = true;
351
			ontologieRecue = true;
370
			
352
			
Line 390... Line 372...
390
 
372
 
391
					}
373
					}
392
				}
374
				}
393
			}
375
			}
-
 
376
		}
-
 
377
		
-
 
378
		if (ontologieRecue && personneAAfficher != null)	{
-
 
379
			afficherDetailPersonne(personneAAfficher);
394
		}
380
		}
Line 395... Line 381...
395
	}
381
	}
396
 
382