Subversion Repositories eFlore/Applications.coel

Rev

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

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