Subversion Repositories eFlore/Applications.coel

Rev

Rev 247 | Rev 259 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 247 Rev 253
Line 1... Line 1...
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
Line -... Line 2...
-
 
2
 
-
 
3
 
-
 
4
 
2
 
5
 
3
 
6
 
-
 
7
import java.util.Collection;
-
 
8
import java.util.HashMap;
Line 4... Line 9...
4
 
9
import java.util.Iterator;
-
 
10
import java.util.LinkedList;
5
import java.util.HashMap;
11
import java.util.MissingResourceException;
6
import java.util.Iterator;
12
 
7
 
-
 
8
 
-
 
Line 9... Line 13...
9
import org.tela_botanica.client.RegistreId;
13
 
-
 
14
import org.tela_botanica.client.RegistreId;
-
 
15
import org.tela_botanica.client.i18n.Constantes;
10
import org.tela_botanica.client.interfaces.Rafraichissable;
16
import org.tela_botanica.client.interfaces.Rafraichissable;
-
 
17
import org.tela_botanica.client.modeles.Personne;
11
import org.tela_botanica.client.modeles.Personne;
18
 
12
import org.tela_botanica.client.modeles.PersonneListe;
19
import com.extjs.gxt.ui.client.Registry;
13
import org.tela_botanica.client.modeles.StructureListe;
-
 
14
 
20
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
15
import com.extjs.gxt.ui.client.Registry;
-
 
16
import com.extjs.gxt.ui.client.Style.Scroll;
-
 
17
import com.extjs.gxt.ui.client.event.ComponentEvent;
-
 
18
import com.extjs.gxt.ui.client.event.KeyListener;
21
import com.extjs.gxt.ui.client.Style.LayoutRegion;
19
import com.extjs.gxt.ui.client.util.Params;
22
import com.extjs.gxt.ui.client.Style.Scroll;
20
import com.extjs.gxt.ui.client.widget.ContentPanel;
23
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
21
import com.extjs.gxt.ui.client.widget.Html;
24
import com.extjs.gxt.ui.client.event.ComponentEvent;
22
import com.extjs.gxt.ui.client.widget.LayoutContainer;
25
import com.extjs.gxt.ui.client.event.KeyListener;
23
import com.extjs.gxt.ui.client.widget.PagingToolBar;
26
import com.extjs.gxt.ui.client.widget.ContentPanel;
24
import com.extjs.gxt.ui.client.widget.TabItem;
-
 
25
import com.extjs.gxt.ui.client.widget.TabPanel;
27
import com.extjs.gxt.ui.client.widget.TabItem;
26
import com.extjs.gxt.ui.client.widget.form.Field;
28
import com.extjs.gxt.ui.client.widget.TabPanel;
27
import com.extjs.gxt.ui.client.widget.form.FieldSet;
29
import com.extjs.gxt.ui.client.widget.form.Field;
28
import com.extjs.gxt.ui.client.widget.form.LabelField;
30
import com.extjs.gxt.ui.client.widget.form.FieldSet;
-
 
31
import com.extjs.gxt.ui.client.widget.form.LabelField;
-
 
32
import com.extjs.gxt.ui.client.widget.form.TextArea;
29
import com.extjs.gxt.ui.client.widget.form.TextArea;
33
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
30
import com.extjs.gxt.ui.client.widget.form.TextField;
-
 
31
import com.extjs.gxt.ui.client.widget.layout.CenterLayout;
-
 
32
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
-
 
33
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
34
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
34
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
35
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
35
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
-
 
36
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
36
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
37
import com.extjs.gxt.ui.client.widget.toolbar.ToolItem;
-
 
38
import com.google.gwt.dom.client.LinkElement;
-
 
39
import com.google.gwt.dom.client.NodeList;
-
 
40
import com.google.gwt.user.client.Window;
-
 
41
import com.google.gwt.user.client.ui.Hyperlink;
-
 
42
import com.google.gwt.user.client.ui.Image;
-
 
Line 43... Line 37...
43
import com.google.gwt.user.client.ui.Label;
37
import com.extjs.gxt.ui.client.widget.layout.LayoutData;
Line 44... Line 38...
44
import com.google.gwt.user.client.ui.Panel;
38
import com.extjs.gxt.ui.client.widget.layout.TableData;
Line 86... Line 80...
86
		panneauIdentite.setWidth("400px");
80
		panneauIdentite.setWidth("400px");
87
		panneauIdentite.setHeaderVisible(false);
81
		panneauIdentite.setHeaderVisible(false);
88
		panneauIdentite.setBorders(false);
82
		panneauIdentite.setBorders(false);
89
		panneauIdentite.setBodyBorder(false);
83
		panneauIdentite.setBodyBorder(false);
90
		panneauImage = new ContentPanel();
84
		panneauImage = new ContentPanel();
91
		panneauImage.setWidth("350px");
85
		panneauImage.setLayout(new FlowLayout());
92
		panneauImage.setBorders(false);
86
		panneauImage.setBorders(false);
-
 
87
		panneauImage.setWidth(350);
93
		panneauImage.setBodyBorder(false);
88
		panneauImage.setBodyBorder(false);
94
		panneauImage.setHeaderVisible(false);
89
		panneauImage.setHeaderVisible(false);
95
		panneauImage.setStyleName("conteneur-image-centre");
90
		panneauImage.setStyleName("conteneur-image-centre");
Line 96... Line 91...
96
		
91
		
-
 
92
		tabIdentite.add(panneauIdentite);
97
		tabIdentite.add(panneauIdentite);
93
		TableData td = new TableData();
-
 
94
		tabIdentite.add(panneauImage, td);
98
		tabIdentite.add(panneauImage);
95
		td.setVerticalAlign(VerticalAlignment.TOP);
99
		
96
				
100
		fsIdentite = new FieldSet();
97
		fsIdentite = new FieldSet();
Line 101... Line 98...
101
		fsIdentite.setLayout(new FormLayout());
98
		fsIdentite.setLayout(new FormLayout());
Line 135... Line 132...
135
			fsContact.setWidth("350px");
132
			fsContact.setWidth("350px");
Line 136... Line 133...
136
			
133
			
Line 137... Line 134...
137
			
134
			
138
			panneauIdentite.add(fsIdentite);
135
			panneauIdentite.add(fsIdentite);
Line 139... Line -...
139
			
-
 
140
			//La personne peut avoir un logo
136
			
141
			String logoUrl = (String) personne.obtenirValeurChamp("truk_logo");
-
 
142
			
-
 
143
			if ((logoUrl!=null)&&(!logoUrl.trim().equals("")))	{
137
			//La personne peut avoir un ou plusieurs logo
144
				//Si c'est le cas, on l'affiche sur la même ligne que fsIdentité
-
 
145
				Image img = new Image();
-
 
Line -... Line 138...
-
 
138
			panneauImage.setHeight("100%");
-
 
139
			
-
 
140
			LinkedList<String> listeLogos = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_logo");
146
				img.setUrl(logoUrl);
141
			if ((listeLogos != null)&&(listeLogos.size() > 0))	{
-
 
142
				
-
 
143
				for (int i = 0; i < listeLogos.size(); i++)	{
-
 
144
					String logoUrl = listeLogos.get(i);
-
 
145
					if ((logoUrl!=null)&&(!logoUrl.trim().equals("")))	{
-
 
146
						//Si c'est le cas, on l'affiche sur la même ligne que fsIdentité
-
 
147
						Image img = new Image();
-
 
148
						img.setUrl(logoUrl);
-
 
149
									
-
 
150
						panneauImage.add(img);			
-
 
151
			
-
 
152
							
-
 
153
						
-
 
154
						if (panneauImage.getWidth() < (img.getWidth() + 15))	{
Line 147... Line -...
147
				img.setStyleName("logo-personne");
-
 
148
 
155
							panneauImage.setWidth(img.getWidth() + 15);
Line 149... Line 156...
149
				panneauImage.add(img);			
156
						}
Line 150... Line 157...
150
				
157
						
Line 164... Line 171...
164
			
171
			
Line 165... Line 172...
165
			// TODO: projet
172
			// TODO: projet
166
			
173
			
167
			// nom complet
174
			// nom complet
Line 168... Line 175...
168
			Object nomComplet = personne.obtenirValeurChamp("fmt_nom_complet");
175
			Object nomComplet = personne.obtenirValeurChamp("fmt_nom_complet");
Line 169... Line 176...
169
			ajouterTextFieldNonEditable(fsIdentite,"Nom", nomComplet);
176
			ajouterTextFieldNonEditable(fsIdentite,"Nom Complet", nomComplet);
Line 192... Line 199...
192
			ajouterTextFieldNonEditable(fsIdentite, "Lieu de décès", lieuDeces);
199
			ajouterTextFieldNonEditable(fsIdentite, "Lieu de décès", lieuDeces);
Line 193... Line 200...
193
			
200
			
194
			//Description
201
			//Description
195
			String description = (String) personne.obtenirValeurChamp("description");
202
			String description = (String) personne.obtenirValeurChamp("description");
196
			if ((description!=null)&&(!description.trim().equals("")))	{
203
			if ((description!=null)&&(!description.trim().equals("")))	{
197
				TextArea txtDescription = new TextArea();
204
				LabelField txtDescription = new LabelField();
198
				txtDescription.setFieldLabel("Description");
205
				txtDescription.setFieldLabel("Description:");
Line 199... Line 206...
199
				txtDescription.setValue(description);
206
				txtDescription.setValue(description);
Line 200... Line 207...
200
				
207
				
201
				rendreNonEditable(txtDescription);
208
				//rendreNonEditable(txtDescription);
Line 202... Line 209...
202
				
209
				
-
 
210
				fsIdentite.add(txtDescription);
-
 
211
			}
-
 
212
			
Line -... Line 213...
-
 
213
			
203
				fsIdentite.add(txtDescription);
214
			// CONTACT
-
 
215
			// Téléphones
204
			}
216
			// > Plusieurs téléphones possible, typés
205
			
217
			Constantes constantesI18n = (Constantes) GWT.create(Constantes.class);
-
 
218
			
206
			
219
			HashMap<String, String> mapTelephones = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone");
207
			//CONTACT
220
			if ((mapTelephones != null)&&(mapTelephones.size() > 0))	{
208
			
221
				
-
 
222
				Collection<String> telephoneKeys = mapTelephones.keySet();
-
 
223
				Iterator<String> itTelephones = telephoneKeys.iterator();
209
			// Courriel est un champ TRUK
224
				
210
			// on doit afficher N entrées
225
				while (itTelephones.hasNext())	{
211
			// Voir si le | (pipe) est bien le bon séparateur
226
					String key = itTelephones.next();
212
			String courriels =  (String) personne.obtenirValeurChamp("truk_courriel");
227
					LabelField telephoneLabel = new LabelField();
-
 
228
					String label = "";
-
 
229
					try {
213
			String[] tabCourriel = courriels.split("\\|");
230
						label = constantesI18n.getString(key);
-
 
231
					}
214
			Html intituleHTML = new Html("<b style=\"margin:0 50px 0 0 ; color:black;\">Courriel:</b>");
232
					catch (MissingResourceException e)	{
-
 
233
						label = key;
215
			fsContact.add(intituleHTML);
234
					}
-
 
235
					
216
 
236
					telephoneLabel.setFieldLabel( label + ":");
Line -... Line 237...
-
 
237
					
-
 
238
					telephoneLabel.setValue(mapTelephones.get(key));
-
 
239
					
-
 
240
					fsContact.add(telephoneLabel);
-
 
241
				}
-
 
242
			}
-
 
243
			
-
 
244
			// Fax
-
 
245
			// > Plusieurs fax possible, typés
-
 
246
			
-
 
247
			HashMap<String, String> mapFax = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_fax");
-
 
248
			if ((mapFax != null)&&(mapFax.size() > 0))	{
-
 
249
				
-
 
250
				Collection<String> faxKeys = mapFax.keySet();
-
 
251
				Iterator<String> itFax = faxKeys.iterator();
-
 
252
				
-
 
253
				while (itFax.hasNext())	{
-
 
254
					String key = itFax.next();
-
 
255
					LabelField faxLabel = new LabelField();
-
 
256
					String label = "";
-
 
257
					try {
-
 
258
						label = constantesI18n.getString(key);
-
 
259
					}
-
 
260
					catch (MissingResourceException e)	{
-
 
261
						label = key;
-
 
262
					}
-
 
263
					
-
 
264
					faxLabel.setFieldLabel( label + ":");
-
 
265
					
-
 
266
					faxLabel.setValue(mapTelephones.get(key));
-
 
267
					
-
 
268
					fsContact.add(faxLabel);
-
 
269
				}
-
 
270
			}
-
 
271
			
-
 
272
			// Courriel
-
 
273
			// Courriel est un champ truk de la forme "Adresse@adr.com;; adr2@adr.fr ..."
-
 
274
			
-
 
275
			LinkedList<String> listeCourriel = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel");
-
 
276
			if ((listeCourriel!=null)&&(listeCourriel.size() > 0))	{
-
 
277
				String strLabelCourriel = "Courriel";
-
 
278
				if (listeCourriel.size() > 1)	{
-
 
279
					strLabelCourriel += "s";	
-
 
280
				}
-
 
281
				
-
 
282
				LabelField labelCourriel = new LabelField();
-
 
283
				labelCourriel.setFieldLabel(strLabelCourriel);
-
 
284
				
-
 
285
				String valeurCourriel = "";
-
 
286
				Iterator<String> itCourriel = listeCourriel.iterator();
-
 
287
				while (itCourriel.hasNext())	{
-
 
288
					String valeurCourante = itCourriel.next();
-
 
289
					valeurCourriel += "<a href=\"mailto:" + valeurCourante + "\">" + valeurCourante + "</a><br />";
-
 
290
										
217
			for(int i = 0 ; i < tabCourriel.length ; i++) {
291
				}
Line 218... Line 292...
218
				String courriel = tabCourriel[i];
292
				
Line 283... Line 357...
283
			//Ajout au fieldSet
357
			//Ajout au fieldSet
284
			fs.add(tf);
358
			fs.add(tf);
285
		}
359
		}
286
	}
360
	}
Line -... Line 361...
-
 
361
	
287
	
362
	/*
Line 288... Line 363...
288
	private void rendreNonEditable(Field field)	{
363
	 * private void rendreNonEditable(Field field)	{
289
			
364
			
290
		field.addKeyListener(new KeyListener()	{
365
		field.addKeyListener(new KeyListener()	{
291
			public void componentKeyPress(ComponentEvent ev)	{
366
			public void componentKeyPress(ComponentEvent ev)	{
292
				ev.stopEvent();
367
				ev.stopEvent();
293
			}
368
			}
-
 
369
			});
Line 294... Line 370...
294
			});
370
	}
Line 295... Line 371...
295
	}
371
	*/