Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 977 Rev 1284
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.List;
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.modeles.publication.Publication;
-
 
18
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
-
 
19
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
18
import org.tela_botanica.client.vues.DetailVue;
20
import org.tela_botanica.client.vues.DetailVue;
19
 
21
 
20
import com.extjs.gxt.ui.client.Registry;
22
import com.extjs.gxt.ui.client.Registry;
21
import com.extjs.gxt.ui.client.Style.Scroll;
23
import com.extjs.gxt.ui.client.Style.Scroll;
22
import com.extjs.gxt.ui.client.util.Format;
24
import com.extjs.gxt.ui.client.util.Format;
23
import com.extjs.gxt.ui.client.util.Params;
25
import com.extjs.gxt.ui.client.util.Params;
24
import com.extjs.gxt.ui.client.widget.ContentPanel;
26
import com.extjs.gxt.ui.client.widget.ContentPanel;
25
import com.extjs.gxt.ui.client.widget.Html;
27
import com.extjs.gxt.ui.client.widget.Html;
26
import com.extjs.gxt.ui.client.widget.TabItem;
28
import com.extjs.gxt.ui.client.widget.TabItem;
27
import com.extjs.gxt.ui.client.widget.TabPanel;
29
import com.extjs.gxt.ui.client.widget.TabPanel;
28
import com.extjs.gxt.ui.client.widget.form.FieldSet;
30
import com.extjs.gxt.ui.client.widget.form.FieldSet;
29
import com.extjs.gxt.ui.client.widget.form.LabelField;
31
import com.extjs.gxt.ui.client.widget.form.LabelField;
30
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
32
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
31
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
33
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
32
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
34
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
33
import com.google.gwt.user.client.ui.Image;
35
import com.google.gwt.user.client.ui.Image;
34
 
36
 
35
public class PersonneDetailVue extends DetailVue implements Rafraichissable {
37
public class PersonneDetailVue extends DetailVue implements Rafraichissable {
36
 
38
 
37
	private TabPanel tabPanel;
39
	private TabPanel tabPanel;
38
	private Html entete;
40
	private Html entete;
39
	
41
	
40
	private TabItem tabIdentite;
42
	private TabItem tabIdentite;
41
	private TabItem tabAdresse;
43
	private TabItem tabAdresse;
42
	private TabItem tabInfosNat;
44
	private TabItem tabInfosNat;
43
	private TabItem tabLogos;
45
	private TabItem tabLogos;
-
 
46
	private TabItem tabPublications;
44
 
47
	
45
	private HashMap hmLabelFieldRegion = new HashMap();
48
	private HashMap hmLabelFieldRegion = new HashMap();
46
	
49
	
47
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
50
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
48
	private boolean ontologieRecue = false;
51
	private boolean ontologieRecue = false;
49
	private Personne personneAAfficher = null;
52
	private Personne personneAAfficher = null;
-
 
53
 
-
 
54
	private boolean personneAffichee = false;
-
 
55
	private String tableauPublicationsLieesTpl = "";
50
 
56
	private String lignePublicationLieeTpl = "";
51
	
57
	
52
	private void chargerOntologie() {
58
	private void chargerOntologie() {
53
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
59
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
54
		mediateur.obtenirListeValeurEtRafraichir(this, "tel");
60
		mediateur.obtenirListeValeurEtRafraichir(this, "tel");
-
 
61
		mediateur.obtenirListeValeurEtRafraichir(this, "relationPersonnePublication");
55
	}
62
	}
56
	
63
	
57
	
64
	
58
	public PersonneDetailVue(Mediateur mediateur) {
65
	public PersonneDetailVue(Mediateur mediateur) {
59
		super(mediateur);
66
		super(mediateur);
60
		chargerOntologie();
67
		chargerOntologie();
61
		
-
 
62
		mediateur.obtenirListeValeurEtRafraichir(this, "pays");
-
 
63
 
68
 
64
		setLayout(new FitLayout());
69
		setLayout(new FitLayout());
65
 
70
 
66
		entete = new Html();
71
		entete = new Html();
67
		entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
72
		entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
68
 
73
 
69
		ContentPanel panneauPrincipal = new ContentPanel();
74
		ContentPanel panneauPrincipal = new ContentPanel();
70
		panneauPrincipal.setLayout(new FitLayout());
75
		panneauPrincipal.setLayout(new FitLayout());
71
		panneauPrincipal.setHeaderVisible(false);
76
		panneauPrincipal.setHeaderVisible(false);
72
		panneauPrincipal.setBodyBorder(true);
77
		panneauPrincipal.setBodyBorder(true);
73
		panneauPrincipal.setTopComponent(entete);
78
		panneauPrincipal.setTopComponent(entete);
74
 
79
 
75
		tabIdentite = new TabItem(i18nC.personneIdentite());
80
		tabIdentite = new TabItem(i18nC.personneIdentite());
76
		tabIdentite.setLayout(new AnchorLayout());
81
		tabIdentite.setLayout(new AnchorLayout());
77
		tabIdentite.setScrollMode(Scroll.AUTO);
82
		tabIdentite.setScrollMode(Scroll.AUTO);
78
 
83
 
79
		tabAdresse = new TabItem(i18nC.personneAdresses());
84
		tabAdresse = new TabItem(i18nC.personneAdresses());
80
		tabAdresse.setLayout(new FitLayout());
85
		tabAdresse.setLayout(new FitLayout());
81
		tabAdresse.setScrollMode(Scroll.AUTO);
86
		tabAdresse.setScrollMode(Scroll.AUTO);
82
 
87
 
83
		tabInfosNat = new TabItem(i18nC.personneInfoNat());
88
		tabInfosNat = new TabItem(i18nC.personneInfoNat());
84
		tabInfosNat.setScrollMode(Scroll.AUTO);
89
		tabInfosNat.setScrollMode(Scroll.AUTO);
-
 
90
 
-
 
91
		//Greg : ajout d'un résumé des publications
-
 
92
		tabPublications = new TabItem(i18nC.tabPublications());
-
 
93
		tabPublications.setScrollMode(Scroll.AUTO);
-
 
94
		tabPublications.setLayout(new FlowLayout());
85
 
95
		
86
		tabLogos = new TabItem(i18nC.personneLogos());
96
		tabLogos = new TabItem(i18nC.personneLogos());
87
		tabLogos.setScrollMode(Scroll.AUTO);
97
		tabLogos.setScrollMode(Scroll.AUTO);
88
		tabLogos.setLayout(new FlowLayout());
98
		tabLogos.setLayout(new FlowLayout());
89
 
99
 
90
		tabPanel = new TabPanel();
100
		tabPanel = new TabPanel();
91
		tabPanel.setId(ComposantId.ZONE_DETAIL_CORPS);
101
		tabPanel.setId(ComposantId.ZONE_DETAIL_CORPS);
92
		tabPanel.setBodyBorder(false);
102
		tabPanel.setBodyBorder(false);
93
 
103
 
94
		tabPanel.add(tabIdentite);
104
		tabPanel.add(tabIdentite);
95
		tabPanel.add(tabAdresse);
105
		tabPanel.add(tabAdresse);
96
		tabPanel.add(tabInfosNat);
106
		tabPanel.add(tabInfosNat);
-
 
107
		tabPanel.add(tabPublications);
97
		tabPanel.add(tabLogos);
108
		tabPanel.add(tabLogos);
98
 
109
 
99
		panneauPrincipal.add(tabPanel);
110
		panneauPrincipal.add(tabPanel);
100
		add(panneauPrincipal);
111
		add(panneauPrincipal);
101
	}
112
	}
102
 
113
 
103
	public void afficherDetailPersonne(Personne personne) {
114
	public void afficherDetailPersonne(Personne personne) {
104
		if (personne != null) {
115
		if (personne != null) {
105
			String tplEntete = initialiserTplEntete();
116
			String tplEntete = initialiserTplEntete();
-
 
117
			
-
 
118
			//Sélection des publication à personne
-
 
119
			mediateur.selectionnerPublicationAPersonne(this, null, personne.getId(), new LinkedList());
106
 
120
 
107
			Params enteteParams = new Params();
121
			Params enteteParams = new Params();
108
			enteteParams.set("nom", (String) personne.get("fmt_nom_complet"));
122
			enteteParams.set("nom", (String) personne.get("fmt_nom_complet"));
109
			enteteParams.set("mail", (String) personne.getCourrielPrinc());
123
			enteteParams.set("mail", (String) personne.getCourrielPrinc());
110
 
124
 
111
			LinkedList lstLogos = (LinkedList) personne
125
			LinkedList lstLogos = (LinkedList) personne
112
					.getChaineDenormaliseAsMapOrList("truk_logo");
126
					.getChaineDenormaliseAsMapOrList("truk_logo");
113
			if (lstLogos != null && lstLogos.size() > 0) {
127
			if (lstLogos != null && lstLogos.size() > 0) {
114
 
128
 
115
				tabLogos.removeAll();
129
				tabLogos.removeAll();
116
				String urlLogoPrinc = (String) lstLogos.get(0);
130
				String urlLogoPrinc = (String) lstLogos.get(0);
117
				if (!urlLogoPrinc.trim().equals("")) {
131
				if (!urlLogoPrinc.trim().equals("")) {
118
					tplEntete = "<div id='personne-logo-div'><img src='{image}' alt='logo' /></div>"
132
					tplEntete = "<div id='personne-logo-div'><img src='{image}' alt='logo' /></div>"
119
							+ tplEntete;
133
							+ tplEntete;
120
					enteteParams.set("image", urlLogoPrinc);
134
					enteteParams.set("image", urlLogoPrinc);
121
				}
135
				}
122
 
136
 
123
				Iterator<String> itLogo = lstLogos.iterator();
137
				Iterator<String> itLogo = lstLogos.iterator();
124
				while (itLogo.hasNext()) {
138
				while (itLogo.hasNext()) {
125
					String urlLogoCourant = itLogo.next();
139
					String urlLogoCourant = itLogo.next();
126
					Image imgCourante = new Image(urlLogoCourant);
140
					Image imgCourante = new Image(urlLogoCourant);
127
					tabLogos.add(imgCourante);
141
					tabLogos.add(imgCourante);
128
				}
142
				}
129
				tabLogos.enable();
143
				tabLogos.enable();
130
 
144
 
131
			} else {
145
			} else {
132
				enteteParams.set("image", "");
146
				enteteParams.set("image", "");
133
				tabLogos.disable();
147
				tabLogos.disable();
134
			}
148
			}
135
 
149
 
136
			entete.el().setInnerHtml(Format.substitute(tplEntete, enteteParams));
150
			entete.el().setInnerHtml(Format.substitute(tplEntete, enteteParams));
137
 
151
 
138
			String tplIdentite = initialiserTplIdentite();
152
			String tplIdentite = initialiserTplIdentite();
139
 
153
 
140
			Params tabIdentiteParams = new Params();
154
			Params tabIdentiteParams = new Params();
141
			tabIdentiteParams.set("nom_complet", personne.getString("fmt_nom_complet"));
155
			tabIdentiteParams.set("nom_complet", personne.getString("fmt_nom_complet"));
142
			tabIdentiteParams.set("abreviation", personne.getString("abreviation"));
156
			tabIdentiteParams.set("abreviation", personne.getString("abreviation"));
143
			tabIdentiteParams.set("naissance_date", personne.getNaissanceDate());
157
			tabIdentiteParams.set("naissance_date", personne.getAnneeOuDateNaiss().equals("") ? mediateur.i18nC.inconnue() : personne.getAnneeOuDateNaiss());
144
			tabIdentiteParams.set("naissance_lieu", personne.getString("naissance_lieu"));
158
			tabIdentiteParams.set("naissance_lieu", personne.getString("naissance_lieu"));
145
			String tplDeces = "";
159
			String tplDeces = "";
146
			if (personne.estDecedee())	{
160
			if (personne.estDecedee())	{
147
				tplDeces = " <h2>Décès:</h2>"
161
				tplDeces = " <h2>Décès:</h2>"
148
						+ " <span><b>"
162
						+ " <span><b>"
149
						+ i18nC.personneDateDeces()
163
						+ i18nC.personneDateDeces()
150
						+ ":</b></span> {deces_date}<br />"
164
						+ ":</b></span> {deces_date}<br />"
151
						+ " 	 <span><b>"
165
						+ " 	 <span><b>"
152
						+ i18nC.personneLieuDeces()
166
						+ i18nC.personneLieuDeces()
153
						+ ":</b></span> {deces_lieu}<br /><br />";
167
						+ ":</b></span> {deces_lieu}<br /><br />";
154
				
168
				
155
				tabIdentiteParams.set("deces_date", personne.getDecesDate());
169
				tabIdentiteParams.set("deces_date", personne.getAnneeOuDateDeces().equals("") ? mediateur.i18nC.inconnue() : personne.getAnneeOuDateDeces());
156
				tabIdentiteParams.set("deces_lieu", personne.getString("deces_lieu"));
170
				tabIdentiteParams.set("deces_lieu", personne.getString("deces_lieu"));
157
			}
171
			}
158
			
172
			
159
			Params paramsDeces = new Params();
173
			Params paramsDeces = new Params();
160
			paramsDeces.set("tplDeces", tplDeces);
174
			paramsDeces.set("tplDeces", tplDeces);
161
			tplIdentite = Format.substitute(tplIdentite, paramsDeces);
175
			tplIdentite = Format.substitute(tplIdentite, paramsDeces);
162
			
176
			
163
			tabIdentiteParams.set("description", personne.getString("description"));
177
			tabIdentiteParams.set("description", personne.getString("description"));
164
 
178
 
165
			tabInfosNat.removeAll();
179
			tabInfosNat.removeAll();
166
 
180
 
167
			tabIdentiteParams.set("nom_autre", construireTxtTruck(personne.getString("truk_nom_autre")));
181
			tabIdentiteParams.set("nom_autre", construireTxtTruck(personne.getString("truk_nom_autre")));
168
			tabIdentiteParams.set("abreviation_autre", construireTxtTruck(personne.getString("truk_abreviation_autre")));
182
			tabIdentiteParams.set("abreviation_autre", construireTxtTruck(personne.getString("truk_abreviation_autre")));
169
 
183
 
170
			tplIdentite += construireTxtListeOntologie(personne.getString("truk_telephone"));
184
			tplIdentite += construireTxtListeOntologie(personne.getString("truk_telephone"));
171
 
185
 
172
			// Courriel :Champ truk de la forme
186
			// Courriel :Champ truk de la forme
173
			// "Adresse@adr.com;; adr2@adr.fr ..."
187
			// "Adresse@adr.com;; adr2@adr.fr ..."
174
			LinkedList<String> listeCourriel = (LinkedList<String>) personne
188
			LinkedList<String> listeCourriel = (LinkedList<String>) personne
175
					.getChaineDenormaliseAsMapOrList("truk_courriel");
189
					.getChaineDenormaliseAsMapOrList("truk_courriel");
176
			if ((listeCourriel != null) && (listeCourriel.size() > 0)) {
190
			if ((listeCourriel != null) && (listeCourriel.size() > 0)) {
177
				String strLabelCourriel = "Courriel";
191
				String strLabelCourriel = "Courriel";
178
				if (listeCourriel.size() > 1) {
192
				if (listeCourriel.size() > 1) {
179
					strLabelCourriel += "s";
193
					strLabelCourriel += "s";
180
				}
194
				}
181
 
195
 
182
				String valeurCourriel = "";
196
				String valeurCourriel = "";
183
				Iterator<String> itCourriel = listeCourriel.iterator();
197
				Iterator<String> itCourriel = listeCourriel.iterator();
184
				while (itCourriel.hasNext()) {
198
				while (itCourriel.hasNext()) {
185
					String valeurCourante = itCourriel.next();
199
					String valeurCourante = itCourriel.next();
186
					valeurCourriel += "<br /><a href=\"mailto:"
200
					valeurCourriel += "<br /><a href=\"mailto:"
187
							+ valeurCourante + "\">" + valeurCourante + "</a>";
201
							+ valeurCourante + "\">" + valeurCourante + "</a>";
188
				}
202
				}
189
				tplIdentite += valeurCourriel;
203
				tplIdentite += valeurCourriel;
190
			}
204
			}
191
 
205
 
192
			// Url Site Webs
206
			// Url Site Webs
193
			LinkedList listeUrl = (LinkedList) personne
207
			LinkedList listeUrl = (LinkedList) personne
194
					.getChaineDenormaliseAsMapOrList("truk_url");
208
					.getChaineDenormaliseAsMapOrList("truk_url");
195
			if (listeUrl != null && listeUrl.size() > 0) {
209
			if (listeUrl != null && listeUrl.size() > 0) {
196
 
210
 
197
				tplIdentite += "<br /><br /><b>Sites web:</b><br /><span style='display:inline-block'>";
211
				tplIdentite += "<br /><br /><b>Sites web:</b><br /><span style='display:inline-block'>";
198
				String strUrl = "";
212
				String strUrl = "";
199
				Iterator<String> urlIt = listeUrl.iterator();
213
				Iterator<String> urlIt = listeUrl.iterator();
200
				while (urlIt.hasNext()) {
214
				while (urlIt.hasNext()) {
201
					String urlCourante = urlIt.next();
215
					String urlCourante = urlIt.next();
202
					strUrl += "<a href=\"" + urlCourante + "\">" + urlCourante
216
					strUrl += "<a href=\"" + urlCourante + "\">" + urlCourante
203
							+ "</a> <br/>";
217
							+ "</a> <br/>";
204
				}
218
				}
205
				tplIdentite += strUrl + "</span><br />";
219
				tplIdentite += strUrl + "</span><br />";
206
			}
220
			}
207
 
221
 
208
			tplIdentite += "</div>";
222
			tplIdentite += "</div>";
209
 
223
 
210
			afficherOnglet(tplIdentite, tabIdentiteParams, tabIdentite);
224
			afficherOnglet(tplIdentite, tabIdentiteParams, tabIdentite);
211
 
225
 
212
			String tabAdresseTpl = "<div class='{css_corps}'>"
226
			String tabAdresseTpl = "<div class='{css_corps}'>"
213
					+ "	<div class='{css_fieldset}'>"
227
					+ "	<div class='{css_fieldset}'>"
214
					+ "		<h2>Adresse personnelle:</h2>"
228
					+ "		<h2>Adresse personnelle:</h2>"
215
					+ "		<b>Adresse:</b> {adresse01} <br />" 
229
					+ "		<b>Adresse:</b> {adresse01} <br />" 
216
					+ "		<b>Complément d'adresse: </b>{adresse02} <br />"
230
					+ "		<b>Complément d'adresse: </b>{adresse02} <br />"
217
					+ "		<b>Boite postale: </b>{boitePostale}<br />"
231
					+ "		<b>Boite postale: </b>{boitePostale}<br />"
218
					+ "		<b>Code postal:</b>{codePostal} <br />" 
232
					+ "		<b>Code postal:</b>{codePostal} <br />" 
219
					+ "		<b>Région:</b>{region}<br />"
233
					+ "		<b>Région:</b>{region}<br />"
220
					+ "		<span style='uppercase'>{pays}</span><br />"
234
					+ "		<span style='uppercase'>{pays}</span><br />"
221
					+ "</div>";
235
					+ "</div>";
222
			// Adresses :
236
			// Adresses :
223
			Params paramAdresseTpl = new Params();
237
			Params paramAdresseTpl = new Params();
224
			paramAdresseTpl.set("adresse01", (String) personne
238
			paramAdresseTpl.set("adresse01", (String) personne
225
					.obtenirValeurChamp("adresse_01"));
239
					.obtenirValeurChamp("adresse_01"));
226
			paramAdresseTpl.set("adresse02", (String) personne
240
			paramAdresseTpl.set("adresse02", (String) personne
227
					.obtenirValeurChamp("adresse_02"));
241
					.obtenirValeurChamp("adresse_02"));
228
			paramAdresseTpl.set("boitePostale", (String) personne
242
			paramAdresseTpl.set("boitePostale", (String) personne
229
					.obtenirValeurChamp("bp"));
243
					.obtenirValeurChamp("bp"));
230
			paramAdresseTpl.set("codePostal", (String) personne
244
			paramAdresseTpl.set("codePostal", (String) personne
231
					.obtenirValeurChamp("code_postal"));
245
					.obtenirValeurChamp("code_postal"));
232
			paramAdresseTpl.set("ville", (String) personne
246
			paramAdresseTpl.set("ville", (String) personne
233
					.obtenirValeurChamp("ville"));
247
					.obtenirValeurChamp("ville"));
234
			paramAdresseTpl.set("region", (String) personne
248
			paramAdresseTpl.set("region", (String) personne
235
					.obtenirValeurChamp("region"));
249
					.obtenirValeurChamp("region"));
236
			paramAdresseTpl.set("pays", (String) personne
250
			paramAdresseTpl.set("pays", (String) personne
237
					.obtenirValeurChamp("pays"));
251
					.obtenirValeurChamp("pays"));
238
 
252
 
239
			afficherOnglet(tabAdresseTpl, paramAdresseTpl, tabAdresse);
253
			afficherOnglet(tabAdresseTpl, paramAdresseTpl, tabAdresse);
240
			tabAdresse.setStyleAttribute("padding", "15px");
254
			tabAdresse.setStyleAttribute("padding", "15px");
241
 
255
 
242
			// Infos naturalistes :Biographie, Spécialité (typé)
256
			// Infos naturalistes :Biographie, Spécialité (typé)
243
			String tplInfosNat = "<div class='{css_corps}'>"
257
			String tplInfosNat = "<div class='{css_corps}'>"
244
					+ "	<div class='{css_fieldset}'>" + "		<h2>"
258
					+ "	<div class='{css_fieldset}'>" + "		<h2>"
245
					+ i18nC.personneSpecialite() + "</h1>"
259
					+ i18nC.personneBiographie() + "</h2>"
-
 
260
					+ "			{biographie}" + "		"
-
 
261
					+ "<h2>" + i18nC.personneSpecialite() + "</h2>"
246
					+ "			{specialites}" + "		<h2>"
262
					+ "			{specialites}" + "	<h2>"
247
					+ i18nC.personneRecolte() + "</h2>"
263
					+ i18nC.personneRecolte() + "</h2>"
248
					+ "		{recoltes}" + "  </div>" + "</div>";
264
					+ "		{recoltes}" + "  </div>" + "</div>";
249
			Params prmInfosNat = new Params();
265
			Params prmInfosNat = new Params();
250
 
266
 
251
			// TODO : replace id region par valeur
267
			prmInfosNat.set("biographie", personne.get("biographie"));
252
 
268
			
253
			String specialite = construireTxtTruck(personne.getSpecialite());
269
			String specialite = construireTxtTruck(personne.getSpecialite());
254
			prmInfosNat.set("specialites", specialite);
270
			prmInfosNat.set("specialites", specialite);
255
 
271
 
256
			String recolte = construireTxtListeOntologie(personne.getString("truk_recolte"));
272
			String recolte = construireTxtListeOntologie(personne.getString("truk_recolte"));
257
			prmInfosNat.set("recoltes", recolte);
273
			prmInfosNat.set("recoltes", recolte);
258
 
274
 
259
			afficherOnglet(tplInfosNat, prmInfosNat, tabInfosNat);
275
			afficherOnglet(tplInfosNat, prmInfosNat, tabInfosNat);
260
			tabAdresse.setStyleAttribute("padding", "15px");
276
			tabAdresse.setStyleAttribute("padding", "15px");
261
 
277
 
262
			changerLabelRegions();
278
			changerLabelRegions();
263
			layout();
279
			layout();
264
		}
280
		}
265
	}
281
	}
266
 
282
 
267
	public String initialiserTplEntete() {
283
	public String initialiserTplEntete() {
268
		return "<div id='{css_id}'>" + "<h1>{nom}</h1>"
284
		return "<div id='{css_id}'>" + "<h1>{nom}</h1>"
269
				+ "<h2><a href='{mail}'>{mail}</a></h2>" + "</div>";
285
				+ "<h2><a href='{mail}'>{mail}</a></h2>" + "</div>";
270
	}
286
	}
271
 
287
 
272
	public String initialiserTplIdentite() {
288
	public String initialiserTplIdentite() {
273
		return "<div class='{css_corps}'>" + "	<div class='{css_fieldset}'>"
289
		return "<div class='{css_corps}'>" + "	<div class='{css_fieldset}'>"
274
				+ "	 <h2>Noms:</h2>" + "	 <span><b>"
290
				+ "	 <h2>Noms:</h2>" + "	 <span><b>"
275
				+ i18nC.personneNomComplet()
291
				+ i18nC.personneNomComplet()
276
				+ ":</b></span> {nom_complet}<br />"
292
				+ ":</b></span> {nom_complet}<br />"
277
				+ "	 <span><b>"
293
				+ "	 <span><b>"
278
				+ i18nC.personneNomAutre()
294
				+ i18nC.personneNomAutre()
279
				+ ":</b></span> {nom_autre}<br />"
295
				+ ":</b></span> {nom_autre}<br />"
280
				+ "	 <span><b>"
296
				+ "	 <span><b>"
281
				+ i18nC.personneAbreviation()
297
				+ i18nC.personneAbreviation()
282
				+ ":</b></span> {abreviation}<br />"
298
				+ ":</b></span> {abreviation}<br />"
283
				+ " 	 <span><b>"
299
				+ " 	 <span><b>"
284
				+ i18nC.personneAbreviationAutre()
300
				+ i18nC.personneAbreviationAutre()
285
				+ ":</b></b></span> {abreviation_autre}<br /><br />"
301
				+ ":</b></b></span> {abreviation_autre}<br /><br />"
286
				+ "	 <h2>Naissance:</h2>"
302
				+ "	 <h2>Naissance:</h2>"
287
				+ " 	 <span><b>"
303
				+ " 	 <span><b>"
288
				+ i18nC.personneDateNaissance()
304
				+ i18nC.personneDateNaissance()
289
				+ ":</b></span> {naissance_date}<br />"
305
				+ ":</b></span> {naissance_date}<br />"
290
				+ " 	 <span><b>"
306
				+ " 	 <span><b>"
291
				+ i18nC.personneLieuNaissance()
307
				+ i18nC.personneLieuNaissance()
292
				+ ":</b></span> {naissance_lieu}<br /><br />"
308
				+ ":</b></span> {naissance_lieu}<br /><br />"
293
				+ "{tplDeces}"
309
				+ "{tplDeces}"
294
				+ " 	</div>"
310
				+ " 	</div>"
295
				+ "</div>"
311
				+ "</div>"
296
				+ "<div class='{css_corps}'>"
312
				+ "<div class='{css_corps}'>"
297
				+ "	<div class='css_fieldset'> "
313
				+ "	<div class='css_fieldset'> "
298
				+ "	<h2>Description:</h2>"
314
				+ "	<h2>Description:</h2>"
299
				+ " 		{description}<br />" + "	</div>" + "<br />";
315
				+ " 		{description}<br />" + "	</div>" + "<br />";
300
	}
316
	}
301
 
317
 
302
	private void changerLabelRegions() {
318
	private void changerLabelRegions() {
303
		Collection<String> colClesComposants = hmLabelFieldRegion.keySet();
319
		Collection<String> colClesComposants = hmLabelFieldRegion.keySet();
304
		Iterator<String> itComposants = colClesComposants.iterator();
320
		Iterator<String> itComposants = colClesComposants.iterator();
305
 
321
 
306
		while (itComposants.hasNext()) {
322
		while (itComposants.hasNext()) {
307
			String region = itComposants.next();
323
			String region = itComposants.next();
308
			mediateur.obtenirValeurEtRafraichir(this, "region", region);
324
			mediateur.obtenirValeurEtRafraichir(this, "region", region);
309
		}
325
		}
310
	}
326
	}
311
 
327
 
312
	private void ajouterLabelField(FieldSet fs, String tfLabel, Object tfValue) {
328
	private void ajouterLabelField(FieldSet fs, String tfLabel, Object tfValue) {
313
		if ((tfValue != null) && (!tfValue.toString().trim().equals(""))) {
329
		if ((tfValue != null) && (!tfValue.toString().trim().equals(""))) {
314
 
330
 
315
			LabelField tf = new LabelField();
331
			LabelField tf = new LabelField();
316
 
332
 
317
			tf.setFieldLabel(tfLabel + ":");
333
			tf.setFieldLabel(tfLabel + ":");
318
			if ((tfLabel == null) || ("".equals(tfLabel))) {
334
			if ((tfLabel == null) || ("".equals(tfLabel))) {
319
				tf.setHideLabel(true);
335
				tf.setHideLabel(true);
320
				tf.setStyleAttribute("margin", "0 0 0 105px");
336
				tf.setStyleAttribute("margin", "0 0 0 105px");
321
			}
337
			}
322
			tf.setValue(tfValue);
338
			tf.setValue(tfValue);
323
 
339
 
324
			// Ajout au fieldSet
340
			// Ajout au fieldSet
325
			fs.add(tf);
341
			fs.add(tf);
326
		}
342
		}
327
	}
343
	}
-
 
344
	
-
 
345
	
-
 
346
	private void initialiserTableauPublicationsLieesTpl() {
-
 
347
		
-
 
348
		tableauPublicationsLieesTpl =
-
 
349
			"<div class='{css_corps}'>" +
-
 
350
			"	<h2>{i18n_titre_publication}</h2>"+
-
 
351
			"	<table>"+
-
 
352
			"	<thead>"+
-
 
353
			"		<tr>" +
-
 
354
			"			<th>{i18n_relation}</th>" +
-
 
355
			"			<th>{i18n_auteur}</th>" +
-
 
356
			"			<th>{i18n_titre}</th>" +
-
 
357
			"			<th>{i18n_revue}</th>" +
-
 
358
			"			<th>{i18n_editeur}</th>" +
-
 
359
			"			<th>{i18n_annee}</th>" +
-
 
360
			"			<th>{i18n_nvt}</th>" +
-
 
361
			"			<th>{i18n_fascicule}</th>" +
-
 
362
			"			<th>{i18n_page}</th>" +
-
 
363
			"		</tr>"+
-
 
364
			"	</thead>"+
-
 
365
			"	<tbody>"+
-
 
366
			"		{lignes}"+
-
 
367
			"	</tbody>"+
-
 
368
			"</table>";
-
 
369
	}
-
 
370
	
-
 
371
	private void initialiserLignePublicationLieeTpl() {
-
 
372
		lignePublicationLieeTpl =
-
 
373
			"<tr>"+
-
 
374
			"	<td>{relation}</td>"+
-
 
375
			"	<td>{auteur}</td>"+
-
 
376
			"	<td>{titre}</td>"+
-
 
377
			"	<td>{revue}</td>"+
-
 
378
			"	<td>{editeur}</td>"+
-
 
379
			"	<td>{annee}</td>"+
-
 
380
			"	<td>{nvt}</td>"+
-
 
381
			"	<td>{fascicule}</td>"+
-
 
382
			"	<td>{page}</td>"+
-
 
383
			"</tr>";
-
 
384
	}
-
 
385
	/**
-
 
386
	 * @author greg
-
 
387
	 * Rempli l'onglet des publications liées
-
 
388
	 * @param listePublications la liste des publications
-
 
389
	 */
-
 
390
	private void afficherPublications(PublicationAPersonneListe listePublications)	{
-
 
391
		List<PublicationAPersonne> publicationsLiees = listePublications.toList();
-
 
392
		Iterator<PublicationAPersonne> iterateur = publicationsLiees.iterator();
-
 
393
		
-
 
394
		//Onglet Publications
-
 
395
		initialiserTableauPublicationsLieesTpl();
-
 
396
		Params paramsPublis = new Params();
-
 
397
		
-
 
398
		String contenuLignes = "";
-
 
399
		while (iterateur.hasNext())	{
-
 
400
			initialiserLignePublicationLieeTpl();
-
 
401
			
-
 
402
			PublicationAPersonne publicationAPersonneCourante = iterateur.next();
-
 
403
			Publication publication = publicationAPersonneCourante.getPublicationLiee();
-
 
404
			
-
 
405
			Params ligneParams = new Params();
-
 
406
			ligneParams.set("relation", construireTxtListeOntologie(publicationAPersonneCourante.getRole()));
-
 
407
			ligneParams.set("auteur", publication.getAuteur());
-
 
408
			ligneParams.set("titre", publication.getTitre());
-
 
409
			ligneParams.set("revue", publication.getCollection());
-
 
410
			ligneParams.set("editeur", publication.getEditeur());
-
 
411
			ligneParams.set("annee", publication.getAnneeParution());
-
 
412
			ligneParams.set("nvt", publication.getIndicationNvt());
-
 
413
			ligneParams.set("fascicule", publication.getFascicule());
-
 
414
			ligneParams.set("page", publication.getPages());
-
 
415
			contenuLignes += Format.substitute(lignePublicationLieeTpl, ligneParams);
-
 
416
		}
-
 
417
		
-
 
418
		paramsPublis.set("lignes", contenuLignes);
-
 
419
		paramsPublis.set("i18n_titre_publication", i18nC.tabPublications());
-
 
420
		paramsPublis.set("i18n_relation", i18nC.publicationAuteurs());
-
 
421
		paramsPublis.set("i18n_auteur", i18nC.publicationAuteurs());
-
 
422
		paramsPublis.set("i18n_titre", i18nC.publicationTitre());
-
 
423
		paramsPublis.set("i18n_revue", i18nC.publicationRevueCollection());
-
 
424
		paramsPublis.set("i18n_editeur", i18nC.publicationEditeur());
-
 
425
		paramsPublis.set("i18n_annee", i18nC.publicationDateParution());
-
 
426
		paramsPublis.set("i18n_nvt", i18nC.publicationNvt());
-
 
427
		paramsPublis.set("i18n_fascicule", i18nC.publicationFascicule());
-
 
428
		paramsPublis.set("i18n_page", i18nC.publicationPage());
-
 
429
		afficherOnglet(tableauPublicationsLieesTpl, paramsPublis, tabPublications);
-
 
430
		
-
 
431
	}
328
	
432
	
-
 
433
	public void rafraichir(Object nouvellesDonnees) {
-
 
434
		
-
 
435
		// FIXME : Ci-dessous, on utilise le booléen personneAffichee pour éviter un affichage répété de personnes.
-
 
436
		// Se règlerait avec une gestion Synchrone/Asynchrone
329
	public void rafraichir(Object nouvellesDonnees) {
437
		
330
		// Si on a reçu une personne on en affiche les détails
438
		// Si on a reçu une personne on en affiche les détails
331
		if (nouvellesDonnees instanceof Personne) {
439
		if (nouvellesDonnees instanceof Personne) {
332
			personneAAfficher = (Personne) nouvellesDonnees;
440
			personneAAfficher = (Personne) nouvellesDonnees;
-
 
441
			personneAffichee = false;
333
		} else if (nouvellesDonnees instanceof ValeurListe) {
442
		} else if (nouvellesDonnees instanceof ValeurListe) {
334
			ValeurListe ontologieReceptionnee = (ValeurListe) nouvellesDonnees;
443
			ValeurListe ontologieReceptionnee = (ValeurListe) nouvellesDonnees;
335
			ajouterListeValeursAOntologie(ontologieReceptionnee);
444
			ajouterListeValeursAOntologie(ontologieReceptionnee);
336
			ontologieRecue = true;
445
			ontologieRecue = true;
337
			
446
			
338
			// Remplacer ci-dessous par Ontologie
447
			// Remplacer ci-dessous par Ontologie
339
			ValeurListe listeValeur = (ValeurListe) nouvellesDonnees;
448
			ValeurListe listeValeur = (ValeurListe) nouvellesDonnees;
340
			if (listeValeur.getId().equals(config.getListeId("region"))) {
449
			if (listeValeur.getId().equals(config.getListeId("region"))) {
341
			
450
			
342
				Collection colCleListeValeur = listeValeur.keySet();
451
				Collection colCleListeValeur = listeValeur.keySet();
343
				Iterator<String> itLv = colCleListeValeur.iterator();
452
				Iterator<String> itLv = colCleListeValeur.iterator();
344
				while (itLv.hasNext()) {
453
				while (itLv.hasNext()) {
345
					String idRegion = itLv.next();
454
					String idRegion = itLv.next();
346
					Valeur region = listeValeur.get(idRegion);
455
					Valeur region = listeValeur.get(idRegion);
347
 
456
 
348
					if (region != null) {
457
					if (region != null) {
349
 
458
 
350
						String strRegionId = region.getAbreviation();
459
						String strRegionId = region.getAbreviation();
351
 
460
 
352
						LinkedList<LabelField> listComposantsRegion = (LinkedList) hmLabelFieldRegion.get(strRegionId);
461
						LinkedList<LabelField> listComposantsRegion = (LinkedList) hmLabelFieldRegion.get(strRegionId);
353
						for (int i = 0; i < listComposantsRegion.size(); i++) {
462
						for (int i = 0; i < listComposantsRegion.size(); i++) {
354
							LabelField lfRegion = listComposantsRegion.get(i);
463
							LabelField lfRegion = listComposantsRegion.get(i);
355
							lfRegion.setFieldLabel(region.getNom());
464
							lfRegion.setFieldLabel(region.getNom());
356
						}
465
						}
357
 
466
 
358
					}
467
					}
359
				}
468
				}
360
			}
469
			}
-
 
470
		} else if (nouvellesDonnees instanceof PublicationAPersonneListe)	{
-
 
471
			afficherPublications((PublicationAPersonneListe) nouvellesDonnees);
361
		}
472
		}
362
		
473
		
363
		if (ontologieRecue && personneAAfficher != null)	{
474
		if (ontologieRecue && personneAAfficher != null && personneAffichee == false)	{
-
 
475
			afficherDetailPersonne(personneAAfficher);
364
			afficherDetailPersonne(personneAAfficher);
476
			personneAffichee = true;
365
		}
477
		}
366
	}
478
	}
367
 
479
 
368
}
480
}