Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 305 Rev 321
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
2
 
2
 
3
import java.util.Collection;
3
import java.util.Collection;
4
import java.util.HashMap;
4
import java.util.HashMap;
5
import java.util.Iterator;
5
import java.util.Iterator;
6
import java.util.LinkedList;
6
import java.util.LinkedList;
7
import java.util.MissingResourceException;
7
import java.util.MissingResourceException;
8
 
8
 
9
 
9
 
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.i18n.Constantes;
12
import org.tela_botanica.client.i18n.Constantes;
13
import org.tela_botanica.client.interfaces.Rafraichissable;
13
import org.tela_botanica.client.interfaces.Rafraichissable;
14
import org.tela_botanica.client.modeles.Configuration;
14
import org.tela_botanica.client.modeles.Configuration;
15
import org.tela_botanica.client.modeles.Personne;
15
import org.tela_botanica.client.modeles.Personne;
16
import org.tela_botanica.client.modeles.Valeur;
16
import org.tela_botanica.client.modeles.Valeur;
17
import org.tela_botanica.client.modeles.ValeurListe;
17
import org.tela_botanica.client.modeles.ValeurListe;
18
import org.tela_botanica.client.util.UtilTruk;
18
import org.tela_botanica.client.util.UtilTruk;
19
 
19
 
20
import com.extjs.gxt.ui.client.Registry;
20
import com.extjs.gxt.ui.client.Registry;
21
import com.extjs.gxt.ui.client.Style.Scroll;
21
import com.extjs.gxt.ui.client.Style.Scroll;
22
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
22
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
23
import com.extjs.gxt.ui.client.widget.ContentPanel;
23
import com.extjs.gxt.ui.client.widget.ContentPanel;
24
import com.extjs.gxt.ui.client.widget.LayoutContainer;
24
import com.extjs.gxt.ui.client.widget.LayoutContainer;
25
import com.extjs.gxt.ui.client.widget.TabItem;
25
import com.extjs.gxt.ui.client.widget.TabItem;
26
import com.extjs.gxt.ui.client.widget.TabPanel;
26
import com.extjs.gxt.ui.client.widget.TabPanel;
27
import com.extjs.gxt.ui.client.widget.form.FieldSet;
27
import com.extjs.gxt.ui.client.widget.form.FieldSet;
28
import com.extjs.gxt.ui.client.widget.form.LabelField;
28
import com.extjs.gxt.ui.client.widget.form.LabelField;
29
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
29
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
30
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
30
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
31
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
31
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
32
import com.extjs.gxt.ui.client.widget.layout.TableData;
32
import com.extjs.gxt.ui.client.widget.layout.TableData;
33
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
33
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
34
 
34
 
35
import com.google.gwt.core.client.GWT;
35
import com.google.gwt.core.client.GWT;
36
import com.google.gwt.user.client.Window;
-
 
37
import com.google.gwt.user.client.ui.Image;
36
import com.google.gwt.user.client.ui.Image;
38
 
37
 
39
public class PersonneDetailPanneauVue extends LayoutContainer implements Rafraichissable {
38
public class PersonneDetailPanneauVue extends LayoutContainer implements Rafraichissable {
40
 
39
 
41
	// Le panneau détail se compose de formulaires tabulés
40
	// Le panneau détail se compose de formulaires tabulés
42
	private TabPanel tabPanel;
41
	private TabPanel tabPanel;
43
	
42
	
44
	// Onglet 1 : identite & contact
43
	// Onglet 1 : identite & contact
45
	private TabItem tabIdentite;
44
	private TabItem tabIdentite;
46
	
45
	
47
	private ContentPanel panneauIdentite;
46
	private ContentPanel panneauIdentite;
48
	private ContentPanel panneauImage;
47
	private ContentPanel panneauImage;
49
	
48
	
50
	private FieldSet fsIdentite;
49
	private FieldSet fsIdentite;
51
	private FieldSet fsContact;
50
	private FieldSet fsContact;
52
	
51
	
53
	// Onglet 2 : Adresses
52
	// Onglet 2 : Adresses
54
	private TabItem tabAdresse;
53
	private TabItem tabAdresse;
55
	private FieldSet fsAdressePerso;
54
	private FieldSet fsAdressePerso;
56
		// contient : adresse perso / adresse pro
55
		// contient : adresse perso / adresse pro
57
	
56
	
58
	// Onglet 3 : Informations naturalistes
57
	// Onglet 3 : Informations naturalistes
59
	private TabItem tabInfosNat;
58
	private TabItem tabInfosNat;
60
	private FieldSet fsSpec;
59
	private FieldSet fsSpec;
61
	
60
	
62
	private Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
61
	private Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
63
	
62
	
64
	public PersonneDetailPanneauVue() {
63
	public PersonneDetailPanneauVue() {
65
		
64
		
66
		tabPanel = new TabPanel();
65
		tabPanel = new TabPanel();
67
		this.add(tabPanel);
66
		this.add(tabPanel);
68
		
67
		
69
		//Constructeur de la classe
68
		//Constructeur de la classe
70
		Registry.register(RegistreId.PANNEAU_PERSONNE_DETAIL, this);
69
		Registry.register(RegistreId.PANNEAU_PERSONNE_DETAIL, this);
71
		setLayout(new FitLayout());
70
		setLayout(new FitLayout());
72
		
71
		
73
		tabIdentite = new TabItem("Identité");
72
		tabIdentite = new TabItem("Identité");
74
		TableLayout tLayout = new TableLayout(2);
73
		TableLayout tLayout = new TableLayout(2);
75
		tabIdentite.setLayout(tLayout);
74
		tabIdentite.setLayout(tLayout);
76
		tabIdentite.setScrollMode(Scroll.AUTO);
75
		tabIdentite.setScrollMode(Scroll.AUTO);
77
		
76
		
78
		panneauIdentite = new ContentPanel();
77
		panneauIdentite = new ContentPanel();
79
		panneauIdentite.setWidth("400px");
78
		panneauIdentite.setWidth("400px");
80
		panneauIdentite.setHeaderVisible(false);
79
		panneauIdentite.setHeaderVisible(false);
81
		panneauIdentite.setBorders(false);
80
		panneauIdentite.setBorders(false);
82
		panneauIdentite.setBodyBorder(false);
81
		panneauIdentite.setBodyBorder(false);
83
		panneauImage = new ContentPanel();
82
		panneauImage = new ContentPanel();
84
		panneauImage.setLayout(new FlowLayout());
83
		panneauImage.setLayout(new FlowLayout());
85
		panneauImage.setBorders(false);
84
		panneauImage.setBorders(false);
86
		panneauImage.setWidth(350);
85
		panneauImage.setWidth(350);
87
		panneauImage.setBodyBorder(false);
86
		panneauImage.setBodyBorder(false);
88
		panneauImage.setHeaderVisible(false);
87
		panneauImage.setHeaderVisible(false);
89
		
88
		
90
		//Gérer l'alignement vertical en haut
89
		//Gérer l'alignement vertical en haut
91
		TableData td = new TableData();
90
		TableData td = new TableData();
92
		td.setVerticalAlign(VerticalAlignment.TOP);
91
		td.setVerticalAlign(VerticalAlignment.TOP);
93
		
92
		
94
		tabIdentite.add(panneauIdentite, td);
93
		tabIdentite.add(panneauIdentite, td);
95
		tabIdentite.add(panneauImage, td);
94
		tabIdentite.add(panneauImage, td);
96
		
95
		
97
				
96
				
98
		fsIdentite = new FieldSet();
97
		fsIdentite = new FieldSet();
99
		fsIdentite.setLayout(new FormLayout());
98
		fsIdentite.setLayout(new FormLayout());
100
		
99
		
101
		
100
		
102
		fsContact = new FieldSet();
101
		fsContact = new FieldSet();
103
		fsContact.setLayout(new FormLayout());
102
		fsContact.setLayout(new FormLayout());
104
		
103
		
105
		tabPanel.add(tabIdentite);
104
		tabPanel.add(tabIdentite);
106
		
105
		
107
		//Onglet Adresse:
106
		//Onglet Adresse:
108
		tabAdresse = new TabItem("Adresses");
107
		tabAdresse = new TabItem("Adresses");
109
		fsAdressePerso = new FieldSet();
108
		fsAdressePerso = new FieldSet();
110
		fsAdressePerso.setLayout(new FormLayout());
109
		fsAdressePerso.setLayout(new FormLayout());
111
		
110
		
112
		tabPanel.add(tabAdresse);
111
		tabPanel.add(tabAdresse);
113
		
112
		
114
		//Onglet info naturalistes
113
		//Onglet info naturalistes
115
		tabInfosNat = new TabItem("Informations naturalistes");
114
		tabInfosNat = new TabItem("Informations naturalistes");
116
		fsSpec = new FieldSet();
115
		fsSpec = new FieldSet();
117
		fsSpec.setLayout(new FormLayout());
116
		fsSpec.setLayout(new FormLayout());
-
 
117
		tabInfosNat.setScrollMode(Scroll.AUTO);
118
		
118
		
119
		tabPanel.add(tabInfosNat);
119
		tabPanel.add(tabInfosNat);
120
		
120
		
121
	}
121
	}
122
 
122
 
123
	
123
	
124
	private HashMap hmComposants = new HashMap();
124
	private HashMap hmLabelFieldRegion = new HashMap();
125
	
125
	
126
	public void afficherDetailPersonne(Personne personne) {
126
	public void afficherDetailPersonne(Personne personne) {
127
		if (personne != null) {
127
		if (personne != null) {
128
			
128
			
129
			
129
			
130
			//MAJ Identité : Configurer les fieldSet
130
			//MAJ Identité : Configurer les fieldSet
131
			panneauIdentite.removeAll();
131
			panneauIdentite.removeAll();
132
			panneauImage.removeAll();
132
			panneauImage.removeAll();
133
			
133
			
134
			fsIdentite.setHeading("Identité");
134
			fsIdentite.setHeading("Identité");
135
			//fsIdentite.setWidth("350px");
135
			//fsIdentite.setWidth("350px");
136
			
136
			
137
			fsContact.setHeading("Contact");
137
			fsContact.setHeading("Contact");
138
			//fsContact.setWidth("350px");
138
			//fsContact.setWidth("350px");
139
			
139
			
140
			panneauIdentite.add(fsIdentite);
140
			panneauIdentite.add(fsIdentite);
141
			
141
			
142
			
142
			
143
			//La personne peut avoir un ou plusieurs logo
143
			//La personne peut avoir un ou plusieurs logo
144
			panneauImage.setHeight("100%");
144
			panneauImage.setHeight("100%");
145
			panneauImage.setPosition(0, 6);
145
			panneauImage.setPosition(0, 6);
146
			panneauImage.setBorders(false);
146
			panneauImage.setBorders(false);
147
			
147
			
148
			LinkedList<String> listeLogos = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_logo");
148
			LinkedList<String> listeLogos = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_logo");
149
			if ((listeLogos != null)&&(listeLogos.size() > 0))	{
149
			if ((listeLogos != null)&&(listeLogos.size() > 0))	{
150
				panneauImage.setBorders(true);
150
				panneauImage.setBorders(true);
151
				for (int i = 0; i < listeLogos.size(); i++)	{
151
				for (int i = 0; i < listeLogos.size(); i++)	{
152
					String logoUrl = listeLogos.get(i);
152
					String logoUrl = listeLogos.get(i);
153
					if ((logoUrl!=null)&&(!logoUrl.trim().equals("")))	{
153
					if ((logoUrl!=null)&&(!logoUrl.trim().equals("")))	{
154
						//Si c'est le cas, on l'affiche sur la même ligne que fsIdentité
154
						//Si c'est le cas, on l'affiche sur la même ligne que fsIdentité
155
						Image img = new Image();
155
						Image img = new Image();
156
						img.setUrl(logoUrl);
156
						img.setUrl(logoUrl);
157
									
157
									
158
						panneauImage.add(img);			
158
						panneauImage.add(img);			
159
						if (panneauImage.getWidth() < (img.getWidth() + 15))	{
159
						if (panneauImage.getWidth() < (img.getWidth() + 15))	{
160
							panneauImage.setWidth(img.getWidth() + 15);
160
							panneauImage.setWidth(img.getWidth() + 15);
161
						}
161
						}
162
						
162
						
163
					}
163
					}
164
				}
164
				}
165
				
165
				
166
			}
166
			}
167
			
167
			
168
			panneauIdentite.add(fsContact);
168
			panneauIdentite.add(fsContact);
169
			
169
			
170
			fsIdentite.removeAll();
170
			fsIdentite.removeAll();
171
			fsContact.removeAll();
171
			fsContact.removeAll();
172
			fsAdressePerso.removeAll();
172
			fsAdressePerso.removeAll();
173
			fsSpec.removeAll();
173
			fsSpec.removeAll();
-
 
174
			tabInfosNat.removeAll();
174
			//Ajout des champs Identité
175
			//Ajout des champs Identité
175
			
176
			
176
			
177
			
177
			
178
			
178
			// TODO: projet
179
			// TODO: projet
179
			
180
			
180
			// nom complet
181
			// nom complet
181
			Object nomComplet = personne.obtenirValeurChamp("fmt_nom_complet");
182
			Object nomComplet = personne.obtenirValeurChamp("fmt_nom_complet");
182
			ajouterLabelField(fsIdentite,"Nom Complet", nomComplet);
183
			ajouterLabelField(fsIdentite,"Nom Complet", nomComplet);
183
			
184
			
184
			// Nom autre : champ truk; non-typé
185
			// Nom autre : champ truk; non-typé
185
			LinkedList<String> nomsAutre = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_nom_autre");
186
			LinkedList<String> nomsAutre = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_nom_autre");
186
			if ((nomsAutre != null)&&(nomsAutre.size() > 0))	{
187
			if ((nomsAutre != null)&&(nomsAutre.size() > 0))	{
187
				
188
				
188
				LabelField noms = new LabelField();
189
				LabelField noms = new LabelField();
189
				noms.setFieldLabel("Autres noms:");
190
				noms.setFieldLabel("Autres noms:");
190
				String listeNoms = UtilTruk.traiterTrukListe(nomsAutre, ", ");				
191
				String listeNoms = UtilTruk.traiterTrukListe(nomsAutre, ", ");				
191
				noms.setValue(listeNoms);
192
				noms.setValue(listeNoms);
192
				fsIdentite.add(noms);				
193
				fsIdentite.add(noms);				
193
			}
194
			}
194
			
195
			
195
			// abreviation
196
			// abreviation
196
			Object abreviation = personne.obtenirValeurChamp("abreviation");
197
			Object abreviation = personne.obtenirValeurChamp("abreviation");
197
			ajouterLabelField(fsIdentite, "Abreviation", abreviation);
198
			ajouterLabelField(fsIdentite, "Abreviation", abreviation);
198
			
199
			
199
			// Abréviations, autre : non-typé
200
			// Abréviations, autre : non-typé
200
			LinkedList<String> abrevAutres = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_abreviation_autre");
201
			LinkedList<String> abrevAutres = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_abreviation_autre");
201
			if ((abrevAutres != null)&&(abrevAutres.size() > 0))	{
202
			if ((abrevAutres != null)&&(abrevAutres.size() > 0))	{
202
				
203
				
203
				LabelField abreviations = new LabelField();
204
				LabelField abreviations = new LabelField();
204
				abreviations.setFieldLabel("Autres abreviations:");
205
				abreviations.setFieldLabel("Autres abreviations:");
205
				String listeAbrev = UtilTruk.traiterTrukListe(abrevAutres, ", ");
206
				String listeAbrev = UtilTruk.traiterTrukListe(abrevAutres, ", ");
206
				abreviations.setValue(listeAbrev);
207
				abreviations.setValue(listeAbrev);
207
				fsIdentite.add(abreviations);				
208
				fsIdentite.add(abreviations);				
208
			}
209
			}
209
			fsIdentite.addText("<hr>");
210
			fsIdentite.addText("<hr>");
210
			
211
			
211
			// date naissance 
212
			// date naissance 
212
			// TODO : Mettre la date en format FR 10/12/09
213
			// TODO : Mettre la date en format FR 10/12/09
213
			Object dateNaissance = personne.obtenirValeurChamp("naissance_date");
214
			Object dateNaissance = personne.obtenirValeurChamp("naissance_date");
214
			ajouterLabelField(fsIdentite, "Né le", dateNaissance);
215
			ajouterLabelField(fsIdentite, "Né le", dateNaissance);
215
						
216
						
216
			// lieu naissance
217
			// lieu naissance
217
			Object lieuNaissance = personne.obtenirValeurChamp("naissance_lieu");
218
			Object lieuNaissance = personne.obtenirValeurChamp("naissance_lieu");
218
			ajouterLabelField(fsIdentite, "A", lieuNaissance);
219
			ajouterLabelField(fsIdentite, "A", lieuNaissance);
219
			
220
			
220
			// date deces
221
			// date deces
221
			Object dateDeces = personne.obtenirValeurChamp("deces_date");
222
			Object dateDeces = personne.obtenirValeurChamp("deces_date");
222
			ajouterLabelField(fsIdentite, "Date décès", dateDeces);
223
			ajouterLabelField(fsIdentite, "Date décès", dateDeces);
223
			
224
			
224
			// lieu deces
225
			// lieu deces
225
			Object lieuDeces = personne.obtenirValeurChamp("deces_lieu");
226
			Object lieuDeces = personne.obtenirValeurChamp("deces_lieu");
226
			ajouterLabelField(fsIdentite, "Lieu de décès", lieuDeces);
227
			ajouterLabelField(fsIdentite, "Lieu de décès", lieuDeces);
227
			
228
			
228
			fsIdentite.addText("<hr>");
229
			fsIdentite.addText("<hr>");
229
			
230
			
230
			//Description
231
			//Description
231
			String description = (String) personne.obtenirValeurChamp("description");
232
			String description = (String) personne.obtenirValeurChamp("description");
232
			if ((description!=null)&&(!description.trim().equals("")))	{
233
			if ((description!=null)&&(!description.trim().equals("")))	{
233
				LabelField txtDescription = new LabelField();
234
				LabelField txtDescription = new LabelField();
234
				txtDescription.setFieldLabel("Description:");
235
				txtDescription.setFieldLabel("Description:");
235
				txtDescription.setValue(description);
236
				txtDescription.setValue(description);
236
				
237
				
237
				//rendreNonEditable(txtDescription);
238
				//rendreNonEditable(txtDescription);
238
				
239
				
239
				fsIdentite.add(txtDescription);
240
				fsIdentite.add(txtDescription);
240
			}
241
			}
241
			
242
			
242
			
243
			
243
			// CONTACT
244
			// CONTACT
244
			// Téléphones
245
			// Téléphones
245
			// > Plusieurs téléphones possible, typés
246
			// > Plusieurs téléphones possible, typés
246
			Constantes constantesI18n = (Constantes) GWT.create(Constantes.class);
247
			Constantes constantesI18n = (Constantes) GWT.create(Constantes.class);
247
			
248
			
248
			HashMap<String, String> mapTelephones = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
249
			HashMap<String, String> mapTelephones = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
249
			if ((mapTelephones != null)&&(mapTelephones.size() > 0))	{
250
			if ((mapTelephones != null)&&(mapTelephones.size() > 0))	{
250
				
251
				
251
				Collection<String> telephoneKeys = mapTelephones.keySet();
252
				Collection<String> telephoneKeys = mapTelephones.keySet();
252
				Iterator<String> itTelephones = telephoneKeys.iterator();
253
				Iterator<String> itTelephones = telephoneKeys.iterator();
253
				
254
				
254
				while (itTelephones.hasNext())	{
255
				while (itTelephones.hasNext())	{
255
					String key = itTelephones.next();
256
					String key = itTelephones.next();
256
					LabelField telephoneLabel = new LabelField();
257
					LabelField telephoneLabel = new LabelField();
257
					String label = "";
258
					String label = "";
258
					try {
259
					try {
259
						label = constantesI18n.getString(key);
260
						label = constantesI18n.getString(key);
260
					}
261
					}
261
					catch (MissingResourceException e)	{
262
					catch (MissingResourceException e)	{
262
						label = key;
263
						label = key;
263
					}
264
					}
264
					
265
					
265
					telephoneLabel.setFieldLabel( label + ":");
266
					telephoneLabel.setFieldLabel( label + ":");
266
					
267
					
267
					telephoneLabel.setValue(mapTelephones.get(key));
268
					telephoneLabel.setValue(mapTelephones.get(key));
268
					
269
					
269
					fsContact.add(telephoneLabel);
270
					fsContact.add(telephoneLabel);
270
				}
271
				}
271
			}
272
			}
272
			
273
			
273
			// Fax
274
			// Fax
274
			// > Plusieurs fax possible, typés
275
			// > Plusieurs fax possible, typés
275
			
276
			
276
			HashMap<String, String> mapFax = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_fax");
277
			HashMap<String, String> mapFax = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_fax");
277
			if ((mapFax != null)&&(mapFax.size() > 0))	{
278
			if ((mapFax != null)&&(mapFax.size() > 0))	{
278
				
279
				
279
				Collection<String> faxKeys = mapFax.keySet();
280
				Collection<String> faxKeys = mapFax.keySet();
280
				Iterator<String> itFax = faxKeys.iterator();
281
				Iterator<String> itFax = faxKeys.iterator();
281
				
282
				
282
				while (itFax.hasNext())	{
283
				while (itFax.hasNext())	{
283
					String key = itFax.next();
284
					String key = itFax.next();
284
					LabelField faxLabel = new LabelField();
285
					LabelField faxLabel = new LabelField();
285
					String label = "";
286
					String label = "";
286
					try {
287
					try {
287
						label = constantesI18n.getString(key);
288
						label = constantesI18n.getString(key);
288
					}
289
					}
289
					catch (MissingResourceException e)	{
290
					catch (MissingResourceException e)	{
290
						label = key;
291
						label = key;
291
					}
292
					}
292
					
293
					
293
					faxLabel.setFieldLabel( label + ":");
294
					faxLabel.setFieldLabel( label + ":");
294
					
295
					
295
					faxLabel.setValue(mapTelephones.get(key));
296
					faxLabel.setValue(mapTelephones.get(key));
296
					
297
					
297
					fsContact.add(faxLabel);
298
					fsContact.add(faxLabel);
298
				}
299
				}
299
			}
300
			}
300
			
301
			
301
			// Courriel
302
			// Courriel
302
			// Courriel est un champ truk de la forme "Adresse@adr.com;; adr2@adr.fr ..."
303
			// Courriel est un champ truk de la forme "Adresse@adr.com;; adr2@adr.fr ..."
303
			
304
			
304
			LinkedList<String> listeCourriel = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
305
			LinkedList<String> listeCourriel = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
305
			if ((listeCourriel!=null)&&(listeCourriel.size() > 0))	{
306
			if ((listeCourriel!=null)&&(listeCourriel.size() > 0))	{
306
				String strLabelCourriel = "Courriel";
307
				String strLabelCourriel = "Courriel";
307
				if (listeCourriel.size() > 1)	{
308
				if (listeCourriel.size() > 1)	{
308
					strLabelCourriel += "s";	
309
					strLabelCourriel += "s";	
309
				}
310
				}
310
				
311
				
311
				LabelField labelCourriel = new LabelField();
312
				LabelField labelCourriel = new LabelField();
312
				labelCourriel.setFieldLabel(strLabelCourriel);
313
				labelCourriel.setFieldLabel(strLabelCourriel);
313
				
314
				
314
				String valeurCourriel = "";
315
				String valeurCourriel = "";
315
				Iterator<String> itCourriel = listeCourriel.iterator();
316
				Iterator<String> itCourriel = listeCourriel.iterator();
316
				while (itCourriel.hasNext())	{
317
				while (itCourriel.hasNext())	{
317
					String valeurCourante = itCourriel.next();
318
					String valeurCourante = itCourriel.next();
318
					valeurCourriel += "<a href=\"mailto:" + valeurCourante + "\">" + valeurCourante + "</a><br />";
319
					valeurCourriel += "<a href=\"mailto:" + valeurCourante + "\">" + valeurCourante + "</a><br />";
319
										
320
										
320
				}
321
				}
321
				
322
				
322
				labelCourriel.setValue(valeurCourriel);
323
				labelCourriel.setValue(valeurCourriel);
323
				fsContact.add(labelCourriel);
324
				fsContact.add(labelCourriel);
324
			}
325
			}
325
			
326
			
326
			
327
			
327
			// Url Site Webs
328
			// Url Site Webs
328
			LinkedList listeUrl = (LinkedList) personne.getChaineDenormaliseAsMapOrList("truk_url");
329
			LinkedList listeUrl = (LinkedList) personne.getChaineDenormaliseAsMapOrList("truk_url");
329
			if (listeUrl!=null && listeUrl.size() > 0)	{
330
			if (listeUrl!=null && listeUrl.size() > 0)	{
330
				String strUrl = "";
331
				String strUrl = "";
331
				Iterator<String> urlIt = listeUrl.iterator();
332
				Iterator<String> urlIt = listeUrl.iterator();
332
				while (urlIt.hasNext())	{
333
				while (urlIt.hasNext())	{
333
					String urlCourante = urlIt.next();
334
					String urlCourante = urlIt.next();
334
					strUrl += "<a href=\""+urlCourante+"\">" + urlCourante + "</a> <br/>";
335
					strUrl += "<a href=\""+urlCourante+"\">" + urlCourante + "</a> <br/>";
335
					
336
					
336
					
337
					
337
				}
338
				}
338
				
339
				
339
				LabelField urlLabelField = new LabelField();
340
				LabelField urlLabelField = new LabelField();
340
				urlLabelField.setFieldLabel("Url:");
341
				urlLabelField.setFieldLabel("Url:");
341
				urlLabelField.setValue(strUrl);
342
				urlLabelField.setValue(strUrl);
342
				fsContact.add(urlLabelField);
343
				fsContact.add(urlLabelField);
343
			}
344
			}
344
			
345
			
345
			
346
			
346
			panneauIdentite.add(fsContact);
347
			panneauIdentite.add(fsContact);
347
			
348
			
348
			
349
			
349
			fsAdressePerso.setHeading("Adresse personnelle");
350
			fsAdressePerso.setHeading("Adresse personnelle");
350
			
351
			
351
			/*
352
			/*
352
			 * Adresses :
353
			 * Adresses :
353
			 * */
354
			 * */
354
			String adresse01 = (String) personne.obtenirValeurChamp("adresse_01");
355
			String adresse01 = (String) personne.obtenirValeurChamp("adresse_01");
355
			ajouterLabelField(fsAdressePerso, "Adresse", adresse01);
356
			ajouterLabelField(fsAdressePerso, "Adresse", adresse01);
356
			
357
			
357
			String adresse02 = (String) personne.obtenirValeurChamp("adresse_02");
358
			String adresse02 = (String) personne.obtenirValeurChamp("adresse_02");
358
			ajouterLabelField(fsAdressePerso, "", adresse02);
359
			ajouterLabelField(fsAdressePerso, "", adresse02);
359
			
360
			
360
			String boitePostale = (String) personne.obtenirValeurChamp("bp");
361
			String boitePostale = (String) personne.obtenirValeurChamp("bp");
361
			ajouterLabelField(fsAdressePerso, "Boite Postale", boitePostale);
362
			ajouterLabelField(fsAdressePerso, "Boite Postale", boitePostale);
362
			
363
			
363
			String codePostal = (String) personne.obtenirValeurChamp("code_postal");
364
			String codePostal = (String) personne.obtenirValeurChamp("code_postal");
364
			ajouterLabelField(fsAdressePerso, "Code postal", codePostal);
365
			ajouterLabelField(fsAdressePerso, "Code postal", codePostal);
365
			
366
			
366
			String ville = (String) personne.obtenirValeurChamp("ville");
367
			String ville = (String) personne.obtenirValeurChamp("ville");
367
			ajouterLabelField(fsAdressePerso, "Ville", ville);
368
			ajouterLabelField(fsAdressePerso, "Ville", ville);
368
			
369
			
369
			String region = (String) personne.obtenirValeurChamp("region");
370
			String region = (String) personne.obtenirValeurChamp("region");
370
			ajouterLabelField(fsAdressePerso, "Région", region);
371
			ajouterLabelField(fsAdressePerso, "Région", region);
371
			
372
			
372
			String pays = (String) personne.obtenirValeurChamp("pays");
373
			String pays = (String) personne.obtenirValeurChamp("pays");
373
			ajouterLabelField(fsAdressePerso, "Pays", pays);
374
			ajouterLabelField(fsAdressePerso, "Pays", pays);
374
			
375
			
375
			fsAdressePerso.addText("<br >");	
376
			fsAdressePerso.addText("<br >");	
376
			fsAdressePerso.setWidth("350px");
377
			fsAdressePerso.setWidth("350px");
377
			
378
			
378
			tabAdresse.add(fsAdressePerso);
379
			tabAdresse.add(fsAdressePerso);
379
			
380
			
380
 
381
 
381
			// Infos naturalistes 
382
			// Infos naturalistes 
382
			
383
			
383
			// Biographie
384
			// Biographie
384
			// Spécialité (typé)
385
			// Spécialité (typé)
385
			
386
			
386
			fsSpec.setHeading("Spécialités");
387
			fsSpec.setHeading("Spécialités");
387
			tabInfosNat.add(fsSpec);
388
			tabInfosNat.add(fsSpec);
388
			
389
			
389
			HashMap hmSpecialite = (HashMap) personne.getChaineDenormaliseAsMapOrList("ce_truk_specialite");
390
			HashMap hmSpecialite = (HashMap) personne.getChaineDenormaliseAsMapOrList("ce_truk_specialite");
390
			if ((hmSpecialite != null)&&(hmSpecialite.size() > 0))	{
391
			if ((hmSpecialite != null)&&(hmSpecialite.size() > 0))	{
391
				
392
				
392
				Collection<String> specialiteKeys = hmSpecialite.keySet();
393
				Collection<String> specialiteKeys = hmSpecialite.keySet();
393
				Iterator<String> itSpec = specialiteKeys.iterator();
394
				Iterator<String> itSpec = specialiteKeys.iterator();
394
				
395
				
395
				while (itSpec.hasNext())	{
396
				while (itSpec.hasNext())	{
396
					String key = itSpec.next();
397
					String key = itSpec.next();
397
					LabelField specLabel = new LabelField();
398
					LabelField specLabel = new LabelField();
398
					String label = "";
399
					String label = "";
399
					try {
400
					try {
400
						label = constantesI18n.getString(key);
401
						label = constantesI18n.getString(key);
401
					}
402
					}
402
					catch (MissingResourceException e)	{
403
					catch (MissingResourceException e)	{
403
						label = key;
404
						label = key;
404
					}
405
					}
405
					
406
					
406
					specLabel.setFieldLabel( label + ":");
407
					specLabel.setFieldLabel( label + ":");
407
					
408
					
408
					specLabel.setValue(hmSpecialite.get(key));
409
					specLabel.setValue(hmSpecialite.get(key));
409
					
410
					
410
					fsSpec.add(specLabel);
411
					fsSpec.add(specLabel);
411
				}
412
				}
412
			}
413
			}
413
			
414
			
414
			// Récolte
415
			// Récolte
415
			LinkedList<String> lstRecolte = (LinkedList) personne.getChaineDenormaliseAsMapOrList("truk_recolte");
416
			LinkedList<String> lstRecolte = (LinkedList) personne.getChaineDenormaliseAsMapOrList("truk_recolte");
416
			if ((lstRecolte!=null)&&(lstRecolte.size()>0))	{
417
			if ((lstRecolte!=null)&&(lstRecolte.size()>0))	{
417
				FieldSet fsRecolte = new FieldSet();
418
				FieldSet fsRecolte = new FieldSet();
418
				fsRecolte.setHeading("Récoltes");
419
				fsRecolte.setHeading("Récoltes");
419
				fsRecolte.setLayout(new FormLayout());
420
				fsRecolte.setLayout(new FormLayout());
420
				
421
				
421
				Iterator<String> itRecolte = lstRecolte.iterator();
422
				Iterator<String> itRecolte = lstRecolte.iterator();
422
				while (itRecolte.hasNext())	{
423
				while (itRecolte.hasNext())	{
423
					
424
					
424
					String recolteCourante = itRecolte.next();
425
					String recolteCourante = itRecolte.next();
425
					LabelField lfRecolte = new LabelField();
426
					LabelField lfRecolte = new LabelField();
426
					String[] splitRecolte = recolteCourante.split("\\|");
427
					String[] splitRecolte = recolteCourante.split("\\|");
427
					
428
					
428
					String labelRecolte = "";
429
					String labelRecolte = "";
429
					if (splitRecolte.length > 1)	{
430
					if (splitRecolte.length > 1)	{
430
						lfRecolte.setValue(splitRecolte[1]);
431
						lfRecolte.setValue(splitRecolte[1]);
431
					}
432
					}
432
					
433
					
433
					lfRecolte.setFieldLabel(splitRecolte[0]);
434
					lfRecolte.setFieldLabel(splitRecolte[0]);
434
					fsRecolte.add(lfRecolte);
435
					fsRecolte.add(lfRecolte);
435
					
436
					
436
					LinkedList<LabelField> lstComposantsRegion = (LinkedList<LabelField>) hmComposants.get(splitRecolte[0]);
437
					LinkedList<LabelField> lstComposantsRegion = (LinkedList<LabelField>) hmLabelFieldRegion.get(splitRecolte[0]);
437
					
438
					
438
					if (lstComposantsRegion == null)	{
439
					if (lstComposantsRegion == null)	{
439
						lstComposantsRegion = new LinkedList<LabelField>();
440
						lstComposantsRegion = new LinkedList<LabelField>();
440
					}
441
					}
441
					
442
					
442
					lstComposantsRegion.add(lfRecolte);
443
					lstComposantsRegion.add(lfRecolte);
443
					hmComposants.remove(splitRecolte[0]);
444
					hmLabelFieldRegion.remove(splitRecolte[0]);
444
					hmComposants.put(splitRecolte[0], lstComposantsRegion);
445
					hmLabelFieldRegion.put(splitRecolte[0], lstComposantsRegion);
445
									
446
									
446
				}
447
				}
447
				
448
				
448
				tabInfosNat.add(fsRecolte);
449
				tabInfosNat.add(fsRecolte);
449
			}
450
			}
450
			
451
			
451
			changerLabelRegions();
452
			changerLabelRegions();
452
			// tabInfosNat
453
			// tabInfosNat
453
			layout();
454
			layout();
454
		} 
455
		} 
455
	}
456
	}
456
	
457
	
457
	
458
	
458
	private void changerLabelRegions()	{
459
	private void changerLabelRegions()	{
459
		
460
		
460
		Collection<String> colClesComposants = hmComposants.keySet();
461
		Collection<String> colClesComposants = hmLabelFieldRegion.keySet();
461
		Iterator<String> itComposants = colClesComposants.iterator();
462
		Iterator<String> itComposants = colClesComposants.iterator();
462
		
463
		
463
		while (itComposants.hasNext())	{
464
		while (itComposants.hasNext())	{
464
			String region = itComposants.next();
465
			String region = itComposants.next();
465
			mediateur.obtenirValeurEtRafraichir(this, "region", region);
466
			mediateur.obtenirValeurEtRafraichir(this, "region", region);
466
		}
467
		}
467
	}
468
	}
468
 
469
 
469
	private void ajouterLabelField(FieldSet fs, String tfLabel, Object tfValue)	{
470
	private void ajouterLabelField(FieldSet fs, String tfLabel, Object tfValue)	{
470
	
471
	
471
		if ((tfValue!=null)&&(!tfValue.toString().trim().equals("")))	{
472
		if ((tfValue!=null)&&(!tfValue.toString().trim().equals("")))	{
472
			
473
			
473
			
474
			
474
			LabelField tf = new LabelField();
475
			LabelField tf = new LabelField();
475
		
476
		
476
			tf.setFieldLabel(tfLabel + ":");
477
			tf.setFieldLabel(tfLabel + ":");
477
			if ((tfLabel==null)||("".equals(tfLabel)))	{
478
			if ((tfLabel==null)||("".equals(tfLabel)))	{
478
				tf.setHideLabel(true);
479
				tf.setHideLabel(true);
479
				tf.setStyleAttribute("margin", "0 0 0 105px");
480
				tf.setStyleAttribute("margin", "0 0 0 105px");
480
			}
481
			}
481
			tf.setValue(tfValue);
482
			tf.setValue(tfValue);
482
		
483
		
483
			//Ajout au fieldSet
484
			//Ajout au fieldSet
484
			fs.add(tf);
485
			fs.add(tf);
485
		}
486
		}
486
	}
487
	}
487
	
488
	
488
	
489
	
489
		
490
		
490
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
491
	private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
491
	
492
	
492
	public void rafraichir(Object nouvellesDonnees) {
493
	public void rafraichir(Object nouvellesDonnees) {
493
		
494
		
494
		// Si on a reçu une personne on en affiche les détails
495
		// Si on a reçu une personne on en affiche les détails
495
		if (nouvellesDonnees instanceof Personne) {
496
		if (nouvellesDonnees instanceof Personne) {
496
			afficherDetailPersonne((Personne) nouvellesDonnees);
497
			afficherDetailPersonne((Personne) nouvellesDonnees);
497
		} else if (nouvellesDonnees instanceof ValeurListe)	{
498
		} else if (nouvellesDonnees instanceof ValeurListe)	{
498
			
499
			
499
			ValeurListe listeValeur = (ValeurListe) nouvellesDonnees;
500
			ValeurListe listeValeur = (ValeurListe) nouvellesDonnees;
500
			if (listeValeur.getId().equals(config.getListeId("region")))	{
501
			if (listeValeur.getId().equals(config.getListeId("region")))	{
501
				
502
				
502
				Collection colCleListeValeur = listeValeur.keySet();
503
				Collection colCleListeValeur = listeValeur.keySet();
503
				
504
				
504
				Iterator<String> itLv = colCleListeValeur.iterator();
505
				Iterator<String> itLv = colCleListeValeur.iterator();
505
				
506
				
506
				while (itLv.hasNext())	{
507
				while (itLv.hasNext())	{
507
					String idRegion = itLv.next();
508
					String idRegion = itLv.next();
508
					Valeur region = listeValeur.get(idRegion);
509
					Valeur region = listeValeur.get(idRegion);
509
					
510
					
510
					
511
					
511
					
512
					
512
					if (region != null)	{
513
					if (region != null)	{
513
						
514
						
514
						String strRegionId = region.getAbreviation();
515
						String strRegionId = region.getAbreviation();
515
						
516
						
516
						LinkedList<LabelField> listComposantsRegion = (LinkedList) hmComposants.get(strRegionId);
517
						LinkedList<LabelField> listComposantsRegion = (LinkedList) hmLabelFieldRegion.get(strRegionId);
517
						for (int i=0; i < listComposantsRegion.size(); i++)	{
518
						for (int i=0; i < listComposantsRegion.size(); i++)	{
518
							LabelField lfRegion = listComposantsRegion.get(i);
519
							LabelField lfRegion = listComposantsRegion.get(i);
519
							lfRegion.setFieldLabel(region.getNom());	
520
							lfRegion.setFieldLabel(region.getNom());	
520
						}
521
						}
521
					
522
					
522
					}
523
					}
523
				}
524
				}
524
			}
525
			}
525
		}
526
		}
526
	}
527
	}
527
 
528
 
528
}
529
}