Subversion Repositories eFlore/Applications.coel

Rev

Rev 1294 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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