Subversion Repositories eFlore/Applications.coel

Rev

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

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