Subversion Repositories eFlore/Applications.coel

Rev

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

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