Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 935 Rev 936
1
package org.tela_botanica.client.vues.personne;
1
package org.tela_botanica.client.vues.personne;
2
 
2
 
3
import java.util.Collection;
3
import java.util.Collection;
4
import java.util.HashMap;
4
import java.util.HashMap;
5
import java.util.Iterator;
5
import java.util.Iterator;
6
import java.util.LinkedList;
6
import java.util.LinkedList;
7
import java.util.MissingResourceException;
7
import java.util.MissingResourceException;
8
 
8
 
9
import org.tela_botanica.client.ComposantId;
9
import org.tela_botanica.client.ComposantId;
10
import org.tela_botanica.client.Mediateur;
10
import org.tela_botanica.client.Mediateur;
11
import org.tela_botanica.client.RegistreId;
11
import org.tela_botanica.client.RegistreId;
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.Valeur;
14
import org.tela_botanica.client.modeles.Valeur;
15
import org.tela_botanica.client.modeles.ValeurListe;
15
import org.tela_botanica.client.modeles.ValeurListe;
16
import org.tela_botanica.client.modeles.personne.Personne;
16
import org.tela_botanica.client.modeles.personne.Personne;
17
import org.tela_botanica.client.util.Debug;
17
import org.tela_botanica.client.util.Debug;
18
import org.tela_botanica.client.vues.collection.DetailVue;
18
import org.tela_botanica.client.vues.DetailVue;
19
 
19
 
20
import com.extjs.gxt.ui.client.Registry;
20
import com.extjs.gxt.ui.client.Registry;
21
import com.extjs.gxt.ui.client.Style.Scroll;
21
import com.extjs.gxt.ui.client.Style.Scroll;
22
import com.extjs.gxt.ui.client.util.Format;
22
import com.extjs.gxt.ui.client.util.Format;
23
import com.extjs.gxt.ui.client.util.Params;
23
import com.extjs.gxt.ui.client.util.Params;
24
import com.extjs.gxt.ui.client.widget.ContentPanel;
24
import com.extjs.gxt.ui.client.widget.ContentPanel;
25
import com.extjs.gxt.ui.client.widget.Html;
25
import com.extjs.gxt.ui.client.widget.Html;
26
import com.extjs.gxt.ui.client.widget.TabItem;
26
import com.extjs.gxt.ui.client.widget.TabItem;
27
import com.extjs.gxt.ui.client.widget.TabPanel;
27
import com.extjs.gxt.ui.client.widget.TabPanel;
28
import com.extjs.gxt.ui.client.widget.form.FieldSet;
28
import com.extjs.gxt.ui.client.widget.form.FieldSet;
29
import com.extjs.gxt.ui.client.widget.form.LabelField;
29
import com.extjs.gxt.ui.client.widget.form.LabelField;
30
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
30
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
31
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
31
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
32
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
32
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
33
import com.google.gwt.user.client.ui.Image;
33
import com.google.gwt.user.client.ui.Image;
34
 
34
 
35
public class PersonneDetailVue extends DetailVue implements Rafraichissable {
35
public class PersonneDetailVue extends DetailVue implements Rafraichissable {
36
 
36
 
37
	private TabPanel tabPanel;
37
	private TabPanel tabPanel;
38
	private Html entete;
38
	private Html entete;
39
	
39
	
40
	private TabItem tabIdentite;
40
	private TabItem tabIdentite;
41
	private TabItem tabAdresse;
41
	private TabItem tabAdresse;
42
	private TabItem tabInfosNat;
42
	private TabItem tabInfosNat;
43
	private TabItem tabLogos;
43
	private TabItem tabLogos;
44
 
44
 
45
	private HashMap hmLabelFieldRegion = new HashMap();
45
	private HashMap hmLabelFieldRegion = new HashMap();
46
	
46
	
47
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
47
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
48
	private boolean ontologieRecue = false;
48
	private boolean ontologieRecue = false;
49
	private Personne personneAAfficher = null;
49
	private Personne personneAAfficher = null;
50
 
50
 
51
	
51
	
52
	private void chargerOntologie() {
52
	private void chargerOntologie() {
53
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
53
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
54
	}
54
	}
55
	
55
	
56
	
56
	
57
	public PersonneDetailVue(Mediateur mediateur) {
57
	public PersonneDetailVue(Mediateur mediateur) {
58
		super(mediateur);
58
		super(mediateur);
59
		chargerOntologie();
59
		chargerOntologie();
60
		
60
		
61
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
61
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
62
 
62
 
63
		setLayout(new FitLayout());
63
		setLayout(new FitLayout());
64
 
64
 
65
		entete = new Html();
65
		entete = new Html();
66
		entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
66
		entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
67
 
67
 
68
		ContentPanel panneauPrincipal = new ContentPanel();
68
		ContentPanel panneauPrincipal = new ContentPanel();
69
		panneauPrincipal.setLayout(new FitLayout());
69
		panneauPrincipal.setLayout(new FitLayout());
70
		panneauPrincipal.setHeaderVisible(false);
70
		panneauPrincipal.setHeaderVisible(false);
71
		panneauPrincipal.setBodyBorder(true);
71
		panneauPrincipal.setBodyBorder(true);
72
		panneauPrincipal.setTopComponent(entete);
72
		panneauPrincipal.setTopComponent(entete);
73
 
73
 
74
		tabIdentite = new TabItem(i18nC.personneIdentite());
74
		tabIdentite = new TabItem(i18nC.personneIdentite());
75
		tabIdentite.setLayout(new AnchorLayout());
75
		tabIdentite.setLayout(new AnchorLayout());
76
		tabIdentite.setScrollMode(Scroll.AUTO);
76
		tabIdentite.setScrollMode(Scroll.AUTO);
77
 
77
 
78
		tabAdresse = new TabItem(i18nC.personneAdresses());
78
		tabAdresse = new TabItem(i18nC.personneAdresses());
79
		tabAdresse.setLayout(new FitLayout());
79
		tabAdresse.setLayout(new FitLayout());
80
		tabAdresse.setScrollMode(Scroll.AUTO);
80
		tabAdresse.setScrollMode(Scroll.AUTO);
81
 
81
 
82
		tabInfosNat = new TabItem(i18nC.personneInfoNat());
82
		tabInfosNat = new TabItem(i18nC.personneInfoNat());
83
		tabInfosNat.setScrollMode(Scroll.AUTO);
83
		tabInfosNat.setScrollMode(Scroll.AUTO);
84
 
84
 
85
		tabLogos = new TabItem(i18nC.personneLogos());
85
		tabLogos = new TabItem(i18nC.personneLogos());
86
		tabLogos.setScrollMode(Scroll.AUTO);
86
		tabLogos.setScrollMode(Scroll.AUTO);
87
		tabLogos.setLayout(new FlowLayout());
87
		tabLogos.setLayout(new FlowLayout());
88
 
88
 
89
		tabPanel = new TabPanel();
89
		tabPanel = new TabPanel();
90
		tabPanel.setId(ComposantId.ZONE_DETAIL_CORPS);
90
		tabPanel.setId(ComposantId.ZONE_DETAIL_CORPS);
91
		tabPanel.setBodyBorder(false);
91
		tabPanel.setBodyBorder(false);
92
 
92
 
93
		tabPanel.add(tabIdentite);
93
		tabPanel.add(tabIdentite);
94
		tabPanel.add(tabAdresse);
94
		tabPanel.add(tabAdresse);
95
		tabPanel.add(tabInfosNat);
95
		tabPanel.add(tabInfosNat);
96
		tabPanel.add(tabLogos);
96
		tabPanel.add(tabLogos);
97
 
97
 
98
		panneauPrincipal.add(tabPanel);
98
		panneauPrincipal.add(tabPanel);
99
		add(panneauPrincipal);
99
		add(panneauPrincipal);
100
	}
100
	}
101
 
101
 
102
	public void afficherDetailPersonne(Personne personne) {
102
	public void afficherDetailPersonne(Personne personne) {
103
		if (personne != null) {
103
		if (personne != null) {
104
			String tplEntete = initialiserTplEntete();
104
			String tplEntete = initialiserTplEntete();
105
 
105
 
106
			Params enteteParams = new Params();
106
			Params enteteParams = new Params();
107
			enteteParams.set("nom", (String) personne.get("fmt_nom_complet"));
107
			enteteParams.set("nom", (String) personne.get("fmt_nom_complet"));
108
			enteteParams.set("mail", (String) personne.get("courriel_princ"));
108
			enteteParams.set("mail", (String) personne.get("courriel_princ"));
109
 
109
 
110
			LinkedList lstLogos = (LinkedList) personne
110
			LinkedList lstLogos = (LinkedList) personne
111
					.getChaineDenormaliseAsMapOrList("truk_logo");
111
					.getChaineDenormaliseAsMapOrList("truk_logo");
112
			if (lstLogos != null && lstLogos.size() > 0) {
112
			if (lstLogos != null && lstLogos.size() > 0) {
113
 
113
 
114
				tabLogos.removeAll();
114
				tabLogos.removeAll();
115
				String urlLogoPrinc = (String) lstLogos.get(0);
115
				String urlLogoPrinc = (String) lstLogos.get(0);
116
				if (!urlLogoPrinc.trim().equals("")) {
116
				if (!urlLogoPrinc.trim().equals("")) {
117
					tplEntete = "<div id='personne-logo-div'><img src='{image}' alt='logo' /></div>"
117
					tplEntete = "<div id='personne-logo-div'><img src='{image}' alt='logo' /></div>"
118
							+ tplEntete;
118
							+ tplEntete;
119
					enteteParams.set("image", urlLogoPrinc);
119
					enteteParams.set("image", urlLogoPrinc);
120
				}
120
				}
121
 
121
 
122
				Iterator<String> itLogo = lstLogos.iterator();
122
				Iterator<String> itLogo = lstLogos.iterator();
123
				while (itLogo.hasNext()) {
123
				while (itLogo.hasNext()) {
124
					String urlLogoCourant = itLogo.next();
124
					String urlLogoCourant = itLogo.next();
125
					Image imgCourante = new Image(urlLogoCourant);
125
					Image imgCourante = new Image(urlLogoCourant);
126
					tabLogos.add(imgCourante);
126
					tabLogos.add(imgCourante);
127
				}
127
				}
128
				tabLogos.enable();
128
				tabLogos.enable();
129
 
129
 
130
			} else {
130
			} else {
131
				enteteParams.set("image", "");
131
				enteteParams.set("image", "");
132
				tabLogos.disable();
132
				tabLogos.disable();
133
			}
133
			}
134
 
134
 
135
			entete.el().setInnerHtml(Format.substitute(tplEntete, enteteParams));
135
			entete.el().setInnerHtml(Format.substitute(tplEntete, enteteParams));
136
 
136
 
137
			String tplIdentite = initialiserTplIdentite();
137
			String tplIdentite = initialiserTplIdentite();
138
 
138
 
139
			Params tabIdentiteParams = new Params();
139
			Params tabIdentiteParams = new Params();
140
			tabIdentiteParams.set("nom_complet", personne.getString("fmt_nom_complet"));
140
			tabIdentiteParams.set("nom_complet", personne.getString("fmt_nom_complet"));
141
			tabIdentiteParams.set("abreviation", personne.getString("abreviation"));
141
			tabIdentiteParams.set("abreviation", personne.getString("abreviation"));
142
			tabIdentiteParams.set("naissance_date", personne.getNaissanceDate());
142
			tabIdentiteParams.set("naissance_date", personne.getNaissanceDate());
143
			tabIdentiteParams.set("naissance_lieu", personne.getString("naissance_lieu"));
143
			tabIdentiteParams.set("naissance_lieu", personne.getString("naissance_lieu"));
144
			String tplDeces = "";
144
			String tplDeces = "";
145
			if (personne.estDecedee())	{
145
			if (personne.estDecedee())	{
146
				tplDeces = " <h2>Décès:</h2>"
146
				tplDeces = " <h2>Décès:</h2>"
147
						+ " <span><b>"
147
						+ " <span><b>"
148
						+ i18nC.personneDateDeces()
148
						+ i18nC.personneDateDeces()
149
						+ ":</b></span> {deces_date}<br />"
149
						+ ":</b></span> {deces_date}<br />"
150
						+ " 	 <span><b>"
150
						+ " 	 <span><b>"
151
						+ i18nC.personneLieuDeces()
151
						+ i18nC.personneLieuDeces()
152
						+ ":</b></span> {deces_lieu}<br /><br />";
152
						+ ":</b></span> {deces_lieu}<br /><br />";
153
				
153
				
154
				tabIdentiteParams.set("deces_date", personne.getDecesDate());
154
				tabIdentiteParams.set("deces_date", personne.getDecesDate());
155
				tabIdentiteParams.set("deces_lieu", personne.getString("deces_lieu"));
155
				tabIdentiteParams.set("deces_lieu", personne.getString("deces_lieu"));
156
			}
156
			}
157
			
157
			
158
			Params paramsDeces = new Params();
158
			Params paramsDeces = new Params();
159
			paramsDeces.set("tplDeces", tplDeces);
159
			paramsDeces.set("tplDeces", tplDeces);
160
			tplIdentite = Format.substitute(tplIdentite, paramsDeces);
160
			tplIdentite = Format.substitute(tplIdentite, paramsDeces);
161
			
161
			
162
			tabIdentiteParams.set("description", personne.getString("description"));
162
			tabIdentiteParams.set("description", personne.getString("description"));
163
 
163
 
164
			tabInfosNat.removeAll();
164
			tabInfosNat.removeAll();
165
 
165
 
166
			tabIdentiteParams.set("nom_autre", construireTxtTruck(personne.getString("truk_nom_autre")));
166
			tabIdentiteParams.set("nom_autre", construireTxtTruck(personne.getString("truk_nom_autre")));
167
			tabIdentiteParams.set("abreviation_autre", construireTxtTruck(personne.getString("truk_abreviation_autre")));
167
			tabIdentiteParams.set("abreviation_autre", construireTxtTruck(personne.getString("truk_abreviation_autre")));
168
 
168
 
169
			HashMap<String, String> mapTelephones = (HashMap<String, String>) personne
169
			HashMap<String, String> mapTelephones = (HashMap<String, String>) personne
170
					.getChaineDenormaliseAsMapOrList("truk_telephone");
170
					.getChaineDenormaliseAsMapOrList("truk_telephone");
171
			if ((mapTelephones != null) && (mapTelephones.size() > 0)) {
171
			if ((mapTelephones != null) && (mapTelephones.size() > 0)) {
172
 
172
 
173
				Collection<String> telephoneKeys = mapTelephones.keySet();
173
				Collection<String> telephoneKeys = mapTelephones.keySet();
174
				Iterator<String> itTelephones = telephoneKeys.iterator();
174
				Iterator<String> itTelephones = telephoneKeys.iterator();
175
 
175
 
176
				while (itTelephones.hasNext()) {
176
				while (itTelephones.hasNext()) {
177
					String key = itTelephones.next();
177
					String key = itTelephones.next();
178
					String label = mapTelephones.get(key);
178
					String label = mapTelephones.get(key);
179
 
179
 
180
					try {
180
					try {
181
						label = i18nC.getString(label);
181
						label = i18nC.getString(label);
182
					} catch (MissingResourceException e) {
182
					} catch (MissingResourceException e) {
183
					}
183
					}
184
 
184
 
185
					tplIdentite += "<b>" + label + ":</b> " + key;
185
					tplIdentite += "<b>" + label + ":</b> " + key;
186
					tplIdentite += "<br />";
186
					tplIdentite += "<br />";
187
				}
187
				}
188
			}
188
			}
189
 
189
 
190
			// Courriel :Champ truk de la forme
190
			// Courriel :Champ truk de la forme
191
			// "Adresse@adr.com;; adr2@adr.fr ..."
191
			// "Adresse@adr.com;; adr2@adr.fr ..."
192
			LinkedList<String> listeCourriel = (LinkedList<String>) personne
192
			LinkedList<String> listeCourriel = (LinkedList<String>) personne
193
					.getChaineDenormaliseAsMapOrList("truk_courriel");
193
					.getChaineDenormaliseAsMapOrList("truk_courriel");
194
			if ((listeCourriel != null) && (listeCourriel.size() > 0)) {
194
			if ((listeCourriel != null) && (listeCourriel.size() > 0)) {
195
				String strLabelCourriel = "Courriel";
195
				String strLabelCourriel = "Courriel";
196
				if (listeCourriel.size() > 1) {
196
				if (listeCourriel.size() > 1) {
197
					strLabelCourriel += "s";
197
					strLabelCourriel += "s";
198
				}
198
				}
199
 
199
 
200
				String valeurCourriel = "";
200
				String valeurCourriel = "";
201
				Iterator<String> itCourriel = listeCourriel.iterator();
201
				Iterator<String> itCourriel = listeCourriel.iterator();
202
				while (itCourriel.hasNext()) {
202
				while (itCourriel.hasNext()) {
203
					String valeurCourante = itCourriel.next();
203
					String valeurCourante = itCourriel.next();
204
					valeurCourriel += "<br /><a href=\"mailto:"
204
					valeurCourriel += "<br /><a href=\"mailto:"
205
							+ valeurCourante + "\">" + valeurCourante + "</a>";
205
							+ valeurCourante + "\">" + valeurCourante + "</a>";
206
				}
206
				}
207
				tplIdentite += valeurCourriel;
207
				tplIdentite += valeurCourriel;
208
			}
208
			}
209
 
209
 
210
			// Url Site Webs
210
			// Url Site Webs
211
			LinkedList listeUrl = (LinkedList) personne
211
			LinkedList listeUrl = (LinkedList) personne
212
					.getChaineDenormaliseAsMapOrList("truk_url");
212
					.getChaineDenormaliseAsMapOrList("truk_url");
213
			if (listeUrl != null && listeUrl.size() > 0) {
213
			if (listeUrl != null && listeUrl.size() > 0) {
214
 
214
 
215
				tplIdentite += "<br /><br /><b>Sites web:</b><br /><span style='display:inline-block'>";
215
				tplIdentite += "<br /><br /><b>Sites web:</b><br /><span style='display:inline-block'>";
216
				String strUrl = "";
216
				String strUrl = "";
217
				Iterator<String> urlIt = listeUrl.iterator();
217
				Iterator<String> urlIt = listeUrl.iterator();
218
				while (urlIt.hasNext()) {
218
				while (urlIt.hasNext()) {
219
					String urlCourante = urlIt.next();
219
					String urlCourante = urlIt.next();
220
					strUrl += "<a href=\"" + urlCourante + "\">" + urlCourante
220
					strUrl += "<a href=\"" + urlCourante + "\">" + urlCourante
221
							+ "</a> <br/>";
221
							+ "</a> <br/>";
222
				}
222
				}
223
				tplIdentite += strUrl + "</span><br />";
223
				tplIdentite += strUrl + "</span><br />";
224
			}
224
			}
225
 
225
 
226
			tplIdentite += "</div>";
226
			tplIdentite += "</div>";
227
 
227
 
228
			afficherOnglet(tplIdentite, tabIdentiteParams, tabIdentite);
228
			afficherOnglet(tplIdentite, tabIdentiteParams, tabIdentite);
229
 
229
 
230
			String tabAdresseTpl = "<div class='{css_corps}'>"
230
			String tabAdresseTpl = "<div class='{css_corps}'>"
231
					+ "	<div class='{css_fieldset}'>"
231
					+ "	<div class='{css_fieldset}'>"
232
					+ "		<h2>Adresse personnelle:</h2>"
232
					+ "		<h2>Adresse personnelle:</h2>"
233
					+ "		{adresse01} <br />" + "		{adresse02} <br />"
233
					+ "		{adresse01} <br />" + "		{adresse02} <br />"
234
					+ "		{boitePostale}<br />"
234
					+ "		{boitePostale}<br />"
235
					+ "		{codePostal} {region}<br />"
235
					+ "		{codePostal} {region}<br />"
236
					+ "		<span style='uppercase'>{pays}</span><br />"
236
					+ "		<span style='uppercase'>{pays}</span><br />"
237
					+ "</div>";
237
					+ "</div>";
238
			// Adresses :
238
			// Adresses :
239
			Params paramAdresseTpl = new Params();
239
			Params paramAdresseTpl = new Params();
240
			paramAdresseTpl.set("adresse01", (String) personne
240
			paramAdresseTpl.set("adresse01", (String) personne
241
					.obtenirValeurChamp("adresse_01"));
241
					.obtenirValeurChamp("adresse_01"));
242
			paramAdresseTpl.set("adresse02", (String) personne
242
			paramAdresseTpl.set("adresse02", (String) personne
243
					.obtenirValeurChamp("adresse_02"));
243
					.obtenirValeurChamp("adresse_02"));
244
			paramAdresseTpl.set("boitePostale", (String) personne
244
			paramAdresseTpl.set("boitePostale", (String) personne
245
					.obtenirValeurChamp("bp"));
245
					.obtenirValeurChamp("bp"));
246
			paramAdresseTpl.set("codePostal", (String) personne
246
			paramAdresseTpl.set("codePostal", (String) personne
247
					.obtenirValeurChamp("code_postal"));
247
					.obtenirValeurChamp("code_postal"));
248
			paramAdresseTpl.set("ville", (String) personne
248
			paramAdresseTpl.set("ville", (String) personne
249
					.obtenirValeurChamp("ville"));
249
					.obtenirValeurChamp("ville"));
250
			paramAdresseTpl.set("region", (String) personne
250
			paramAdresseTpl.set("region", (String) personne
251
					.obtenirValeurChamp("region"));
251
					.obtenirValeurChamp("region"));
252
			paramAdresseTpl.set("pays", (String) personne
252
			paramAdresseTpl.set("pays", (String) personne
253
					.obtenirValeurChamp("pays"));
253
					.obtenirValeurChamp("pays"));
254
 
254
 
255
			afficherOnglet(tabAdresseTpl, paramAdresseTpl, tabAdresse);
255
			afficherOnglet(tabAdresseTpl, paramAdresseTpl, tabAdresse);
256
			tabAdresse.setStyleAttribute("padding", "15px");
256
			tabAdresse.setStyleAttribute("padding", "15px");
257
 
257
 
258
			// Infos naturalistes :Biographie, Spécialité (typé)
258
			// Infos naturalistes :Biographie, Spécialité (typé)
259
			String tplInfosNat = "<div class='{css_corps}'>"
259
			String tplInfosNat = "<div class='{css_corps}'>"
260
					+ "	<div class='{css_fieldset}'>" + "		<h2>"
260
					+ "	<div class='{css_fieldset}'>" + "		<h2>"
261
					+ i18nC.personneSpecialite() + "</h1>"
261
					+ i18nC.personneSpecialite() + "</h1>"
262
					+ "			{specialites}" + "		<h2>"
262
					+ "			{specialites}" + "		<h2>"
263
					+ i18nC.personneRecolte() + "</h2>"
263
					+ i18nC.personneRecolte() + "</h2>"
264
					+ "		{recoltes}" + "  </div>" + "</div>";
264
					+ "		{recoltes}" + "  </div>" + "</div>";
265
			Params prmInfosNat = new Params();
265
			Params prmInfosNat = new Params();
266
 
266
 
267
			// TODO : replace id region par valeur
267
			// TODO : replace id region par valeur
268
 
268
 
269
			String specialite = construireTxtTruck(personne.getSpecialite());
269
			String specialite = construireTxtTruck(personne.getSpecialite());
270
			prmInfosNat.set("specialites", specialite);
270
			prmInfosNat.set("specialites", specialite);
271
 
271
 
272
			String recolte = construireTxtListeOntologie(personne.getString("truk_recolte"));
272
			String recolte = construireTxtListeOntologie(personne.getString("truk_recolte"));
273
			prmInfosNat.set("recoltes", recolte);
273
			prmInfosNat.set("recoltes", recolte);
274
 
274
 
275
			afficherOnglet(tplInfosNat, prmInfosNat, tabInfosNat);
275
			afficherOnglet(tplInfosNat, prmInfosNat, tabInfosNat);
276
			tabAdresse.setStyleAttribute("padding", "15px");
276
			tabAdresse.setStyleAttribute("padding", "15px");
277
 
277
 
278
			changerLabelRegions();
278
			changerLabelRegions();
279
			layout();
279
			layout();
280
		}
280
		}
281
	}
281
	}
282
 
282
 
283
	public String initialiserTplEntete() {
283
	public String initialiserTplEntete() {
284
		return "<div id='{css_id}'>" + "<h1>{nom}</h1>"
284
		return "<div id='{css_id}'>" + "<h1>{nom}</h1>"
285
				+ "<h2><a href='{mail}'>{mail}</a></h2>" + "</div>";
285
				+ "<h2><a href='{mail}'>{mail}</a></h2>" + "</div>";
286
	}
286
	}
287
 
287
 
288
	public String initialiserTplIdentite() {
288
	public String initialiserTplIdentite() {
289
		return "<div class='{css_corps}'>" + "	<div class='{css_fieldset}'>"
289
		return "<div class='{css_corps}'>" + "	<div class='{css_fieldset}'>"
290
				+ "	 <h2>Noms:</h2>" + "	 <span><b>"
290
				+ "	 <h2>Noms:</h2>" + "	 <span><b>"
291
				+ i18nC.personneNomComplet()
291
				+ i18nC.personneNomComplet()
292
				+ ":</b></span> {nom_complet}<br />"
292
				+ ":</b></span> {nom_complet}<br />"
293
				+ "	 <span><b>"
293
				+ "	 <span><b>"
294
				+ i18nC.personneNomAutre()
294
				+ i18nC.personneNomAutre()
295
				+ ":</b></span> {nom_autre}<br />"
295
				+ ":</b></span> {nom_autre}<br />"
296
				+ "	 <span><b>"
296
				+ "	 <span><b>"
297
				+ i18nC.personneAbreviation()
297
				+ i18nC.personneAbreviation()
298
				+ ":</b></span> {abreviation}<br />"
298
				+ ":</b></span> {abreviation}<br />"
299
				+ " 	 <span><b>"
299
				+ " 	 <span><b>"
300
				+ i18nC.personneAbreviationAutre()
300
				+ i18nC.personneAbreviationAutre()
301
				+ ":</b></b></span> {abreviation_autre}<br /><br />"
301
				+ ":</b></b></span> {abreviation_autre}<br /><br />"
302
				+ "	 <h2>Naissance:</h2>"
302
				+ "	 <h2>Naissance:</h2>"
303
				+ " 	 <span><b>"
303
				+ " 	 <span><b>"
304
				+ i18nC.personneDateNaissance()
304
				+ i18nC.personneDateNaissance()
305
				+ ":</b></span> {naissance_date}<br />"
305
				+ ":</b></span> {naissance_date}<br />"
306
				+ " 	 <span><b>"
306
				+ " 	 <span><b>"
307
				+ i18nC.personneLieuNaissance()
307
				+ i18nC.personneLieuNaissance()
308
				+ ":</b></span> {naissance_lieu}<br /><br />"
308
				+ ":</b></span> {naissance_lieu}<br /><br />"
309
				+ "{tplDeces}"
309
				+ "{tplDeces}"
310
				+ " 	</div>"
310
				+ " 	</div>"
311
				+ "</div>"
311
				+ "</div>"
312
				+ "<div class='{css_corps}'>"
312
				+ "<div class='{css_corps}'>"
313
				+ "	<div class='css_fieldset'> "
313
				+ "	<div class='css_fieldset'> "
314
				+ "	<h2>Description:</h2>"
314
				+ "	<h2>Description:</h2>"
315
				+ " 		{description}<br />" + "	</div>" + "<br />";
315
				+ " 		{description}<br />" + "	</div>" + "<br />";
316
	}
316
	}
317
 
317
 
318
	private void changerLabelRegions() {
318
	private void changerLabelRegions() {
319
		Collection<String> colClesComposants = hmLabelFieldRegion.keySet();
319
		Collection<String> colClesComposants = hmLabelFieldRegion.keySet();
320
		Iterator<String> itComposants = colClesComposants.iterator();
320
		Iterator<String> itComposants = colClesComposants.iterator();
321
 
321
 
322
		while (itComposants.hasNext()) {
322
		while (itComposants.hasNext()) {
323
			String region = itComposants.next();
323
			String region = itComposants.next();
324
			mediateur.obtenirValeurEtRafraichir(this, "region", region);
324
			mediateur.obtenirValeurEtRafraichir(this, "region", region);
325
		}
325
		}
326
	}
326
	}
327
 
327
 
328
	private void ajouterLabelField(FieldSet fs, String tfLabel, Object tfValue) {
328
	private void ajouterLabelField(FieldSet fs, String tfLabel, Object tfValue) {
329
		if ((tfValue != null) && (!tfValue.toString().trim().equals(""))) {
329
		if ((tfValue != null) && (!tfValue.toString().trim().equals(""))) {
330
 
330
 
331
			LabelField tf = new LabelField();
331
			LabelField tf = new LabelField();
332
 
332
 
333
			tf.setFieldLabel(tfLabel + ":");
333
			tf.setFieldLabel(tfLabel + ":");
334
			if ((tfLabel == null) || ("".equals(tfLabel))) {
334
			if ((tfLabel == null) || ("".equals(tfLabel))) {
335
				tf.setHideLabel(true);
335
				tf.setHideLabel(true);
336
				tf.setStyleAttribute("margin", "0 0 0 105px");
336
				tf.setStyleAttribute("margin", "0 0 0 105px");
337
			}
337
			}
338
			tf.setValue(tfValue);
338
			tf.setValue(tfValue);
339
 
339
 
340
			// Ajout au fieldSet
340
			// Ajout au fieldSet
341
			fs.add(tf);
341
			fs.add(tf);
342
		}
342
		}
343
	}
343
	}
344
	
344
	
345
	public void rafraichir(Object nouvellesDonnees) {
345
	public void rafraichir(Object nouvellesDonnees) {
346
		// Si on a reçu une personne on en affiche les détails
346
		// Si on a reçu une personne on en affiche les détails
347
		if (nouvellesDonnees instanceof Personne) {
347
		if (nouvellesDonnees instanceof Personne) {
348
			personneAAfficher = (Personne) nouvellesDonnees;
348
			personneAAfficher = (Personne) nouvellesDonnees;
349
		} else if (nouvellesDonnees instanceof ValeurListe) {
349
		} else if (nouvellesDonnees instanceof ValeurListe) {
350
			ValeurListe ontologieReceptionnee = (ValeurListe) nouvellesDonnees;
350
			ValeurListe ontologieReceptionnee = (ValeurListe) nouvellesDonnees;
351
			ajouterListeValeursAOntologie(ontologieReceptionnee);
351
			ajouterListeValeursAOntologie(ontologieReceptionnee);
352
			ontologieRecue = true;
352
			ontologieRecue = true;
353
			
353
			
354
			// Remplacer ci-dessous par Ontologie
354
			// Remplacer ci-dessous par Ontologie
355
			ValeurListe listeValeur = (ValeurListe) nouvellesDonnees;
355
			ValeurListe listeValeur = (ValeurListe) nouvellesDonnees;
356
			if (listeValeur.getId().equals(config.getListeId("region"))) {
356
			if (listeValeur.getId().equals(config.getListeId("region"))) {
357
			
357
			
358
				Collection colCleListeValeur = listeValeur.keySet();
358
				Collection colCleListeValeur = listeValeur.keySet();
359
				Iterator<String> itLv = colCleListeValeur.iterator();
359
				Iterator<String> itLv = colCleListeValeur.iterator();
360
				while (itLv.hasNext()) {
360
				while (itLv.hasNext()) {
361
					String idRegion = itLv.next();
361
					String idRegion = itLv.next();
362
					Valeur region = listeValeur.get(idRegion);
362
					Valeur region = listeValeur.get(idRegion);
363
 
363
 
364
					if (region != null) {
364
					if (region != null) {
365
 
365
 
366
						String strRegionId = region.getAbreviation();
366
						String strRegionId = region.getAbreviation();
367
 
367
 
368
						LinkedList<LabelField> listComposantsRegion = (LinkedList) hmLabelFieldRegion.get(strRegionId);
368
						LinkedList<LabelField> listComposantsRegion = (LinkedList) hmLabelFieldRegion.get(strRegionId);
369
						for (int i = 0; i < listComposantsRegion.size(); i++) {
369
						for (int i = 0; i < listComposantsRegion.size(); i++) {
370
							LabelField lfRegion = listComposantsRegion.get(i);
370
							LabelField lfRegion = listComposantsRegion.get(i);
371
							lfRegion.setFieldLabel(region.getNom());
371
							lfRegion.setFieldLabel(region.getNom());
372
						}
372
						}
373
 
373
 
374
					}
374
					}
375
				}
375
				}
376
			}
376
			}
377
		}
377
		}
378
		
378
		
379
		if (ontologieRecue && personneAAfficher != null)	{
379
		if (ontologieRecue && personneAAfficher != null)	{
380
			afficherDetailPersonne(personneAAfficher);
380
			afficherDetailPersonne(personneAAfficher);
381
		}
381
		}
382
	}
382
	}
383
 
383
 
384
}
384
}