Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 183 Rev 189
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
-
 
2
 
-
 
3
 
-
 
4
 
-
 
5
import java.util.List;
2
 
6
 
3
import org.tela_botanica.client.RegistreId;
7
import org.tela_botanica.client.RegistreId;
-
 
8
import org.tela_botanica.client.interfaces.Rafraichissable;
4
import org.tela_botanica.client.interfaces.Rafraichissable;
9
import org.tela_botanica.client.modeles.Information;
5
import org.tela_botanica.client.modeles.Personne;
10
import org.tela_botanica.client.modeles.Personne;
6
import org.tela_botanica.client.modeles.Projet;
11
import org.tela_botanica.client.modeles.Projet;
7
import org.tela_botanica.client.modeles.ProjetsListeAsyncDao;
12
import org.tela_botanica.client.modeles.ProjetsListeAsyncDao;
8
import org.tela_botanica.client.modeles.Structure;
13
import org.tela_botanica.client.modeles.Structure;
9
import org.tela_botanica.client.modeles.StructureListe;
14
import org.tela_botanica.client.modeles.StructureListe;
10
 
15
 
11
import com.extjs.gxt.ui.client.Registry;
16
import com.extjs.gxt.ui.client.Registry;
12
import com.extjs.gxt.ui.client.Style.Scroll;
17
import com.extjs.gxt.ui.client.Style.Scroll;
13
import com.extjs.gxt.ui.client.util.Format;
18
import com.extjs.gxt.ui.client.util.Format;
14
import com.extjs.gxt.ui.client.util.Params;
19
import com.extjs.gxt.ui.client.util.Params;
15
import com.extjs.gxt.ui.client.widget.ContentPanel;
20
import com.extjs.gxt.ui.client.widget.ContentPanel;
16
import com.extjs.gxt.ui.client.widget.Html;
21
import com.extjs.gxt.ui.client.widget.Html;
-
 
22
import com.extjs.gxt.ui.client.widget.TabItem;
-
 
23
import com.extjs.gxt.ui.client.widget.TabPanel;
17
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
24
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
-
 
25
import com.google.gwt.user.client.ui.FlexTable;
-
 
26
import com.google.gwt.user.client.ui.Grid;
-
 
27
import com.google.gwt.user.client.ui.Hyperlink;
-
 
28
import com.google.gwt.user.client.ui.Label;
-
 
29
import com.google.gwt.user.client.ui.Widget;
-
 
30
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-
 
31
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
18
 
32
 
19
public class PersonneDetailPanneauVue extends ContentPanel implements Rafraichissable {
-
 
-
 
33
public class PersonneDetailPanneauVue extends TabPanel implements Rafraichissable {
20
 
34
 
-
 
35
	
-
 
36
	private Html header;
21
	private ContentPanel content;
37
	
-
 
38
	//TABS
22
	private Html header;
39
	// Informations générales : nom, prénom, adresse, cp, ville, adresse email, sexe, projet
-
 
40
	private TabItem infoGenerales;
23
	private String enteteHTML = "<div class='coel-detail'><h1>{0}</h1><h2><a href=\"mailto:{1}\">{1}</a></h2></div>";
41
	private String contenuInfo = "<div style='padding: 12px;'><h1>{0}</h1><a href=\"{1}\">{1}</a><br /><br /><p><b>Adresse: </b>{2}<br />{3}<br />{4} {5}<br /> {7}</p><br />{6}</div>";
24
	private String contenuHTML = "<div style='padding: 12px;'><p>{0}</p><b>Adresse: </b>{1}<br />{2}<br /></div>";
42
	
25
	private String structureNom = null;
43
	private TabItem infoBio;
-
 
44
	private String contenuBio = "";
26
	private String structureVille = null;
45
			// <div style='padding: 12px;'><h1>{0} {1} {2}</h1><h2>{3}</h2><br><b>Date de naissance: </b>{4}<br /><b>Date de décès:{5}</b><p>{6}</p></div>";
27
	private String structureDescription = null;
46
	
28
 
-
 
29
	public PersonneDetailPanneauVue() {
47
	
30
		Registry.register(RegistreId.PANNEAU_PERSONNE_DETAIL, this);
48
	public PersonneDetailPanneauVue() {
31
		
49
		
32
		setHeaderVisible(false);
50
		Registry.register(RegistreId.PANNEAU_PERSONNE_DETAIL, this);
33
		setLayout(new FitLayout());
51
		setLayout(new FitLayout());
34
 
-
 
35
		content = new ContentPanel();
-
 
36
		content.setBodyBorder(false);
52
		
37
		content.setHeaderVisible(false);
-
 
38
		content.setScrollMode(Scroll.AUTO);
53
		infoGenerales = new TabItem("Informations Générales");
39
 
54
		this.add(infoGenerales);
40
		header = new Html();
-
 
41
		header.setStyleName("coel-detail");
55
		
42
		content.setTopComponent(header);
56
		infoBio = new TabItem("Biographie");
43
 
57
		infoBio.disable();
44
		add(content);
58
		this.add(infoBio);
45
	}
59
	}
46
 
60
 
47
	public void ajouterParam(Params parametres, String nomChamp, Personne personne)	{
61
	private void ajouterParam(Params parametres, String nomChamp, Personne personne)	{
48
		parametres.add(personne.obtenirValeurChamp(nomChamp));
62
		Object valeur = personne.obtenirValeurChamp(nomChamp);
49
		//return parametres;
63
		parametres.add(valeur);
50
	}	
64
	}	
51
	
65
	
52
	public void afficherDetailPersonne(Personne personne) {
66
	public void afficherDetailPersonne(Personne personne) {
53
		if (personne != null) {
67
		if (personne != null) {
54
			content.removeAll();
68
			infoGenerales.removeAll();
55
			
-
 
56
			//Header	
69
			infoBio.removeAll();
57
			Params enteteParams = new Params();
70
			infoBio.disable();
58
			ajouterParam(enteteParams, "fmt_nom_complet", personne);
-
 
59
			ajouterParam(enteteParams, "truk_courriel", personne);
-
 
60
			
-
 
61
			header.getElement().setInnerHTML(Format.substitute(enteteHTML, enteteParams));
-
 
62
			
71
			
63
			//Contenu
72
			//Contenu
-
 
73
			Params infoGenParams = new Params();
-
 
74
			ajouterParam(infoGenParams, "fmt_nom_complet", personne);
-
 
75
			ajouterParam(infoGenParams, "truk_courriel", personne);
-
 
76
			ajouterParam(infoGenParams, "adresse_01", personne);
-
 
77
			ajouterParam(infoGenParams, "adresse_02", personne);
-
 
78
			ajouterParam(infoGenParams, "code_postal", personne);
64
			Params contenuParams = new Params();
79
			ajouterParam(infoGenParams, "ville", personne);
-
 
80
			ajouterParam(infoGenParams, "description", personne);
-
 
81
			ajouterParam(infoGenParams, "cp_truk_fax", personne);
-
 
82
			
-
 
83
			//Info générales
-
 
84
			infoGenerales.addText(Format.substitute(contenuInfo, infoGenParams));
-
 
85
			
-
 
86
			Params bioParams = new Params();
-
 
87
			// Nécessaire que si une biographie existe...
-
 
88
			// FIXME : remplacer par un id role? 
-
 
89
			if ((personne.obtenirValeurChamp("biographie")!=null)&&(!((String) personne.obtenirValeurChamp("biographie")).trim().equals("")))	{
-
 
90
				
-
 
91
				contenuBio = "<div style='padding: 12px;'><h1>{0} {1} {2}</h1><h2>{3}</h2><br><b>Date de naissance: </b>{4}<br /><b>Date de décès:{5}</b><p>a{6}a</p></div>";
-
 
92
								
-
 
93
				ajouterParam(bioParams, "ce_truk_prefix", personne);
-
 
94
				ajouterParam(bioParams, "fmt_nom_complet", personne);
-
 
95
				ajouterParam(bioParams, "ce_truk_suffix", personne);
-
 
96
				ajouterParam(bioParams, "abreviation", personne);
-
 
97
				ajouterParam(bioParams, "naissance_date", personne);
-
 
98
				ajouterParam(bioParams, "deces_date", personne);
-
 
99
				ajouterParam(bioParams, "biographie", personne);
-
 
100
				infoBio.enable();
-
 
101
				
65
			ajouterParam(contenuParams, "description", personne);
-
 
66
			
-
 
67
			ajouterParam(contenuParams, "adresse_01", personne);
102
			}
68
			ajouterParam(contenuParams, "adresse_02", personne);
103
			
69
			
104
			
70
			
105
			
71
			content.addText(Format.substitute(contenuHTML, contenuParams));
106
			infoBio.addText(Format.substitute(contenuBio, bioParams));
72
 
107
			
73
			layout();
108
			layout();
74
		} else {
109
		} else {
75
			header.setHtml("");
110
			header.setHtml("");
76
			content.removeAll();
-
 
-
 
111
			
77
		}
112
		}
78
	}
113
	}
79
 
114
 
80
	public void rafraichir(Object nouvelleDonnees) {
115
	public void rafraichir(Object nouvelleDonnees) {
81
		if (nouvelleDonnees instanceof Personne) {
116
		if (nouvelleDonnees instanceof Personne) {
82
			afficherDetailPersonne((Personne) nouvelleDonnees);
117
			afficherDetailPersonne((Personne) nouvelleDonnees);
83
		} else if (nouvelleDonnees instanceof StructureListe) {
118
		} else if (nouvelleDonnees instanceof StructureListe) {
84
			StructureListe listeInstitutions = (StructureListe) nouvelleDonnees;
119
			StructureListe listeInstitutions = (StructureListe) nouvelleDonnees;
85
			// Test pour savoir si la liste contient des éléments
120
			// Test pour savoir si la liste contient des éléments
86
			if (listeInstitutions.size() == 0) {
121
			if (listeInstitutions.size() == 0) {
87
				afficherDetailPersonne(null);
122
				afficherDetailPersonne(null);
88
			}
123
			}
89
		}
124
		}
90
	}
125
	}
91
 
126
 
92
}
127
}