Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 374 Rev 379
Line 1... Line 1...
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
Line -... Line 2...
-
 
2
 
-
 
3
import java.util.Iterator;
-
 
4
import java.util.Map.Entry;
-
 
5
 
2
 
6
import org.tela_botanica.client.ComposantClass;
3
import org.tela_botanica.client.ComposantId;
7
import org.tela_botanica.client.ComposantId;
4
import org.tela_botanica.client.Mediateur;
8
import org.tela_botanica.client.Mediateur;
-
 
9
import org.tela_botanica.client.interfaces.Rafraichissable;
5
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.modeles.Information;
-
 
11
import org.tela_botanica.client.modeles.Structure;
-
 
12
import org.tela_botanica.client.modeles.StructureAPersonne;
-
 
13
import org.tela_botanica.client.modeles.StructureAPersonneListe;
-
 
14
import org.tela_botanica.client.modeles.StructureConservation;
Line 6... Line 15...
6
import org.tela_botanica.client.modeles.Structure;
15
import org.tela_botanica.client.modeles.StructureValorisation;
7
 
16
 
8
import com.extjs.gxt.ui.client.Events;
17
import com.extjs.gxt.ui.client.Events;
9
import com.extjs.gxt.ui.client.Style.Scroll;
18
import com.extjs.gxt.ui.client.Style.Scroll;
Line 23... Line 32...
23
public class StructureDetailPanneauVue extends LayoutContainer implements Rafraichissable {
32
public class StructureDetailPanneauVue extends LayoutContainer implements Rafraichissable {
Line 24... Line 33...
24
 
33
 
Line 25... Line 34...
25
	private Mediateur mediateur = null;
34
	private Mediateur mediateur = null;
-
 
35
	
26
	
36
	private String enteteTpl = null;
-
 
37
	private String identificationTpl = null;
Line 27... Line 38...
27
	private String enteteTpl = null;
38
	private String personnelTpl = null;
-
 
39
	private String lignePersonnelTpl = null;
-
 
40
	
-
 
41
	private Structure structure = null;
Line 28... Line 42...
28
	private String contenuTpl = null;
42
	private StructureAPersonneListe personnel = null;
29
	
43
	private StructureValorisation valorisation = null;
30
	private Structure structure = null;
44
	private StructureConservation conservation = null;
31
	
45
	
-
 
46
	private ContentPanel panneauPrincipal = null;
Line 32... Line 47...
32
	private ContentPanel panneauPrincipal = null;
47
	private Html entete = null;
33
	private Html entete = null;
48
	private TabPanel onglets = null;
34
	private TabPanel onglets = null;
-
 
35
	private TabItem identificationOnglet = null;
49
	private TabItem identificationOnglet = null;
Line 36... Line 50...
36
 
50
	private TabItem personnelOnglet = null;
37
	public StructureDetailPanneauVue(Mediateur mediateurCourant) {
51
 
38
		mediateur = mediateurCourant;
52
	public StructureDetailPanneauVue(Mediateur mediateurCourant) {
Line 48... Line 62...
48
		panneauPrincipal.setHeaderVisible(false);
62
		panneauPrincipal.setHeaderVisible(false);
49
		panneauPrincipal.setBodyBorder(false);
63
		panneauPrincipal.setBodyBorder(false);
Line 50... Line 64...
50
		
64
		
51
		
65
		
52
	    entete = new Html();
66
	    entete = new Html();
Line 53... Line 67...
53
	    entete.setId(ComposantId.ZONE_DETAIL);
67
	    entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
-
 
68
	    panneauPrincipal.setTopComponent(entete);
54
	    panneauPrincipal.setTopComponent(entete);
69
		
55
		
70
		onglets = new TabPanel();
56
		onglets = new TabPanel();
71
		onglets.setId(ComposantId.ZONE_DETAIL_CORPS);
Line 57... Line 72...
57
		onglets.setHeight("100%");
72
		onglets.setHeight("100%");
-
 
73
		onglets.setBorders(false);
-
 
74
		onglets.setBodyBorder(false);
58
		onglets.setBorders(false);
75
 
Line -... Line 76...
-
 
76
		identificationOnglet = new TabItem("Général");
-
 
77
		identificationOnglet.setBorders(false);
-
 
78
		identificationOnglet.setScrollMode(Scroll.AUTO);
-
 
79
		onglets.add(identificationOnglet);
-
 
80
		
59
		onglets.setBodyBorder(false);
81
		personnelOnglet = new TabItem("Personnel");
60
 
82
		personnelOnglet.setBorders(false);
61
		identificationOnglet = new TabItem("Général");
83
		personnelOnglet.setScrollMode(Scroll.AUTO);
Line 62... Line 84...
62
		onglets.add(identificationOnglet);
84
		onglets.add(personnelOnglet);
63
		
85
		
64
		panneauPrincipal.add(onglets);
86
		panneauPrincipal.add(onglets);
-
 
87
		add(panneauPrincipal);
-
 
88
	}
-
 
89
 
65
		add(panneauPrincipal);
90
	private void afficherDetailInstitution(Structure structureCourante) {
66
	}
91
		if (structureCourante != null) {
67
 
92
			structure = structureCourante;
68
	private void afficherDetailInstitution(Structure structureCourante) {
93
			personnel = structure.getPersonnel();
69
		if (structureCourante != null) {
94
			valorisation = structure.getValorisation();
70
			structure = structureCourante;
95
			conservation = structure.getConservation();
Line 71... Line 96...
71
 
96
			
72
			afficherEntete();
97
			afficherEntete();
73
			afficherIdentification();
98
			afficherIdentification();
74
		}
99
		}
75
		layout();
100
		layout();
Line 76... Line 101...
76
	}
101
	}
77
	
102
	
78
	private void afficherEntete() {
103
	private void afficherEntete() {
Line 79... Line 104...
79
		Params enteteParams = new Params();
104
		Params enteteParams = new Params();
80
		enteteParams.add(ComposantId.ZONE_DETAIL);
105
		enteteParams.set("id", ComposantId.ZONE_DETAIL_ENTETE);
-
 
106
		enteteParams.set("nom", structure.getNom());
81
		enteteParams.add(structure.getNom());
107
		enteteParams.set("ville", structure.getVille());
82
		enteteParams.add(structure.getVille());
108
		
83
		
109
		String eHtml = Format.substitute(enteteTpl, enteteParams);
84
		String eHtml = Format.substitute(enteteTpl, enteteParams);
110
		entete.getElement().setInnerHTML(eHtml);
85
		entete.getElement().setInnerHTML(eHtml);
111
	}
86
	}
112
	
87
	
113
	private void afficherIdentification() {
88
	private void afficherIdentification() {
114
		Params contenuParams = new Params();
89
		Params contenuParams = new Params();
115
		contenuParams.set("css_class", ComposantClass.DETAIL_CORPS_CONTENU);
90
		contenuParams.add(structure.getDescription());
116
		contenuParams.set("description", structure.getDescription());
91
		contenuParams.add(structure.getAdresse());
-
 
92
		contenuParams.add(structure.getCodePostal());
117
		contenuParams.set("adresse", structure.getAdresse());
93
		contenuParams.add(structure.getVille());
118
		contenuParams.set("code_postal", structure.getCodePostal());
94
		contenuParams.add(structure.getRegion());
119
		contenuParams.set("ville", structure.getVille());
95
		contenuParams.add(structure.getPays());
120
		contenuParams.set("region", structure.getRegion());
96
		contenuParams.add(structure.getTelephone());
121
		contenuParams.set("pays", structure.getPays());
97
		contenuParams.add(structure.getFax());
122
		contenuParams.set("tel", structure.getTelephone());
Line -... Line 123...
-
 
123
		contenuParams.set("fax", structure.getFax());
-
 
124
		contenuParams.set("courriel", structure.getCourriel());
-
 
125
		contenuParams.set("acces", structure.getConditionAcces());
-
 
126
		
-
 
127
		String cHtml = Format.substitute(identificationTpl, contenuParams);
-
 
128
		HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml);
-
 
129
		identificationOnglet.removeAll();
-
 
130
		identificationOnglet.add(corpsConteneurDuHtml);
-
 
131
	}
-
 
132
	
-
 
133
	private void afficherPersonnel() {
-
 
134
		Params contenuParams = new Params();
-
 
135
		contenuParams.set("css_class", ComposantClass.DETAIL_CORPS_CONTENU);
-
 
136
		contenuParams.set("fonction", mediateur.i18nC.fonction());
-
 
137
		contenuParams.set("prenom", mediateur.i18nC.prenom());
-
 
138
		contenuParams.set("nom", mediateur.i18nC.nom());
-
 
139
		contenuParams.set("tel", mediateur.i18nC.telephoneFixe());
-
 
140
		contenuParams.set("fax", mediateur.i18nC.fax());
-
 
141
		contenuParams.set("courriel", mediateur.i18nC.courrielPrincipal());
-
 
142
		contenuParams.set("statut", mediateur.i18nC.statut());
-
 
143
		contenuParams.set("tps_w", mediateur.i18nC.tpsTravail());
-
 
144
		contenuParams.set("specialite", mediateur.i18nC.specialite());
-
 
145
		contenuParams.set("contact", mediateur.i18nC.boolContact());
-
 
146
		
-
 
147
		String lignesPersonnel = ""; 
-
 
148
		personnel = structure.getPersonnel();
-
 
149
		Iterator<String> it = personnel.keySet().iterator();
-
 
150
		while (it.hasNext()) {
-
 
151
			StructureAPersonne personne = personnel.get(it.next());
-
 
152
			Params ligneParams = new Params();
-
 
153
			ligneParams.set("fonction", personne.getFonction());
-
 
154
			ligneParams.set("prenom", personne.getPrenom());
-
 
155
			ligneParams.set("nom", personne.getNom());
-
 
156
			ligneParams.set("tel", personne.getTelephone());
-
 
157
			ligneParams.set("fax", personne.getFax());
-
 
158
			ligneParams.set("courriel", personne.getCourriel());
-
 
159
			ligneParams.set("statut", personne.getStatut());
-
 
160
			ligneParams.set("tps_w", personne.getBotaTravailHebdoTps());
-
 
161
			ligneParams.set("specialite", personne.afficherSpecialite());
-
 
162
			ligneParams.set("contact", personne.getContact());
-
 
163
			lignesPersonnel += Format.substitute(lignePersonnelTpl, ligneParams);
-
 
164
		}
-
 
165
		contenuParams.set("lignes", lignesPersonnel);
-
 
166
		
-
 
167
		String cHtml = Format.substitute(personnelTpl, contenuParams);
-
 
168
		HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml);
-
 
169
		personnelOnglet.removeAll();
98
		contenuParams.add(structure.getCourriel());
170
		personnelOnglet.add(corpsConteneurDuHtml);
99
		contenuParams.add(structure.getConditionAcces());
171
	}
100
		contenuParams.add(ComposantId.ZONE_DETAIL_CORPS);
172
	
101
 
173
	private void initialiserTousLesTpl() {
102
		String cHtml = Format.substitute(contenuTpl, contenuParams);
174
		initialiserEnteteHtmlTpl();
103
		HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml);
175
		initialiserIdentificationTpl();
Line 104... Line 176...
104
		identificationOnglet.removeAll();
176
		initialiserPersonnelTpl();
-
 
177
		initialiserLignePersonnelTpl();
105
		identificationOnglet.add(corpsConteneurDuHtml);
178
	}
106
	}
179
	
107
	
180
	private void initialiserEnteteHtmlTpl() {
108
	private void initialiserEnteteHtmlTpl() {
181
		enteteTpl = 	"<div id='{id}'>"+
109
		enteteTpl = 	"<div id='{0}'>"+
182
						"	<h1>{nom}</h1>"+
110
						"	<h1>{1}</h1>"+
183
						"	<h2>{ville}</h2>" +
111
						"	<h2>{2}</h2>" +
184
						"</div>";
112
						"</div>";
185
	}
113
	}
186
	
114
	
187
	private void initialiserIdentificationTpl() {
Line -... Line 188...
-
 
188
		identificationTpl =
-
 
189
						"<div class='{css_class}'>"+
-
 
190
						"	<h2>Renseignements administratifs</h2>"+
-
 
191
						"	<span style='font-weight:bold;'>Condition d'accès :</span> {acces}<br />"+
-
 
192
						"	<span style='font-weight:bold;'>Adresse :</span> {adresse}, {code_postal} {ville}, {region}, {pays}<br />"+
-
 
193
						"	<span style='font-weight:bold;'>Téléphone :</span> {tel}<br />"+
-
 
194
						"	<span style='font-weight:bold;'>Fax :</span> {fax}<br />"+
-
 
195
						"	<span style='font-weight:bold;'>Courriel :</span> {courriel}<br />"+
-
 
196
						"	{description}"+
-
 
197
						"</div>";
-
 
198
	}
-
 
199
	
-
 
200
	private void initialiserPersonnelTpl() {
-
 
201
		personnelTpl =
-
 
202
						"<div class='{css_class}'>"+
-
 
203
						"	<h2>Personnel</h2>"+
-
 
204
						"	<table>"+
-
 
205
						"		<thead>"+
-
 
206
						"			<tr>" +
-
 
207
						"				<th>{fonction}</th>" +
-
 
208
						"				<th>{prenom}</th>" +
-
 
209
						"				<th>{nom}</th>" +
-
 
210
						"				<th>{tel}</th>" +
-
 
211
						"				<th>{fax}</th>" +
-
 
212
						"				<th>{courriel}</th>" +
-
 
213
						"				<th>{statut}</th>" +
-
 
214
						"				<th>{tps_w}</th>" +
-
 
215
						"				<th>{specialite}</th>" +
-
 
216
						"				<th>{contact}</th>" +
-
 
217
						"			</tr>"+
-
 
218
						"		</thead>"+
-
 
219
						"		<tbody>"+
-
 
220
						"			{lignes}"+
-
 
221
						"		</tbody>"+
-
 
222
						"	</table>"+
-
 
223
						"</div>";
-
 
224
	}
-
 
225
	
-
 
226
	private void initialiserLignePersonnelTpl() {
-
 
227
		lignePersonnelTpl =
-
 
228
						"<tr>"+
-
 
229
						"	<td>{fonction}</td>"+
115
	private void initialiserContenuHtmlTpl() {
230
						"	<td>{prenom}</td>"+
116
		contenuTpl = 	"<div id='{10}'>"+
231
						"	<td>{nom}</td>"+
117
						"	<h2>Renseignements administratifs</h2>"+
232
						"	<td>{tel}</td>" +
-
 
233
						"	<td>{fax}</td>" +
-
 
234
						"	<td>{courriel}</td>" +
-
 
235
						"	<td>{statut}</td>" +
-
 
236
						"	<td>{tps_w}</td>" +
-
 
237
						"	<td>{specialite}</td>" +
-
 
238
						"	<td>{contact}</td>" +
-
 
239
						"</tr>";
118
						"	<span style='font-weight:bold;'>Condition d'accès :</span> {9}<br />"+
240
	}
119
						"	<span style='font-weight:bold;'>Adresse :</span> {1}, {2} {3}, {4}, {5}<br />"+
241
	
120
						"	<span style='font-weight:bold;'>Téléphone :</span> {6}<br />"+
242
	public void rafraichir(Object nouvelleDonnees) {
121
						"	<span style='font-weight:bold;'>Fax :</span> {7}<br />"+
243
		if (nouvelleDonnees instanceof Structure) {
Line -... Line 244...
-
 
244
			afficherDetailInstitution((Structure) nouvelleDonnees);
-
 
245
		} if (nouvelleDonnees instanceof Information) {
-
 
246
			Information info = (Information) nouvelleDonnees;
-
 
247
			if (info.getType().equals("liste_structure_a_personne")) {
122
						"	<span style='font-weight:bold;'>Courriel :</span> {8}<br />"+
248
				allouerPersonnelAStructure((StructureAPersonneListe) info.getDonnee(0));