60 |
jpm |
1 |
package org.tela_botanica.client.vues;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.client.RegistreId;
|
|
|
4 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
5 |
import org.tela_botanica.client.modeles.Structure;
|
69 |
jpm |
6 |
import org.tela_botanica.client.modeles.StructureListe;
|
60 |
jpm |
7 |
|
|
|
8 |
import com.extjs.gxt.ui.client.Registry;
|
|
|
9 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
|
|
10 |
import com.extjs.gxt.ui.client.util.Format;
|
|
|
11 |
import com.extjs.gxt.ui.client.util.Params;
|
|
|
12 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
|
|
13 |
import com.extjs.gxt.ui.client.widget.Html;
|
|
|
14 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
|
|
15 |
|
|
|
16 |
public class StructureDetailPanneauVue extends ContentPanel implements Rafraichissable {
|
|
|
17 |
|
|
|
18 |
private ContentPanel content;
|
|
|
19 |
private Html header;
|
|
|
20 |
private String enteteHTML = "<div class='coel-detail'><h1>{0}</h1><h2>{1}</h2></div>";
|
|
|
21 |
private String contenuHTML = "<div style='padding: 12px;'><h2>Renseignements administratifs</h2><span style='font-weight:bold;'>Condition d'accès :</span> {9}<br /><span style='font-weight:bold;'>Adresse :</span> {1}, {2} {3}, {4}, {5}<br /><span style='font-weight:bold;'>Téléphone :</span> {6}<br /><span style='font-weight:bold;'>Fax :</span> {7}<br /><span style='font-weight:bold;'>Courriel :</span> {8}<br />{0}</div>";
|
|
|
22 |
private String structureNom = null;
|
|
|
23 |
private String structureVille = null;
|
|
|
24 |
private String structureDescription = null;
|
|
|
25 |
|
|
|
26 |
public StructureDetailPanneauVue() {
|
|
|
27 |
Registry.register(RegistreId.PANNEAU_INSTITUTION_DETAIL, this);
|
|
|
28 |
|
|
|
29 |
setHeaderVisible(false);
|
|
|
30 |
setLayout(new FitLayout());
|
|
|
31 |
|
|
|
32 |
content = new ContentPanel();
|
|
|
33 |
content.setBodyBorder(false);
|
|
|
34 |
content.setHeaderVisible(false);
|
|
|
35 |
content.setScrollMode(Scroll.AUTO);
|
|
|
36 |
|
|
|
37 |
header = new Html();
|
|
|
38 |
header.setStyleName("coel-detail");
|
|
|
39 |
content.setTopComponent(header);
|
|
|
40 |
|
|
|
41 |
add(content);
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
public void afficherDetailInstitution(Structure structure) {
|
|
|
45 |
if (structure != null) {
|
|
|
46 |
content.removeAll();
|
|
|
47 |
|
|
|
48 |
structureNom = structure.getNom();
|
|
|
49 |
structureVille = structure.getVille();
|
|
|
50 |
structureDescription = structure.getDescription();
|
|
|
51 |
|
|
|
52 |
Params enteteParams = new Params();
|
|
|
53 |
enteteParams.add(structureNom);
|
|
|
54 |
enteteParams.add(structureVille);
|
|
|
55 |
|
|
|
56 |
String eHtml = Format.substitute(enteteHTML, enteteParams);
|
|
|
57 |
header.getElement().setInnerHTML(eHtml);
|
|
|
58 |
|
|
|
59 |
Params contenuParams = new Params();
|
|
|
60 |
contenuParams.add(structureDescription);
|
|
|
61 |
contenuParams.add(structure.getAdresse01());
|
|
|
62 |
contenuParams.add(structure.getCodePostal());
|
|
|
63 |
contenuParams.add(structure.getVille());
|
|
|
64 |
contenuParams.add(structure.getRegion());
|
|
|
65 |
contenuParams.add(structure.getPays());
|
|
|
66 |
contenuParams.add(structure.getTelephone());
|
|
|
67 |
contenuParams.add(structure.getFax());
|
|
|
68 |
contenuParams.add(structure.getCourriel());
|
|
|
69 |
contenuParams.add(structure.getConditionAcces());
|
|
|
70 |
|
|
|
71 |
String cHtml = Format.substitute(contenuHTML, contenuParams);
|
|
|
72 |
content.addText(cHtml);
|
|
|
73 |
|
|
|
74 |
layout();
|
|
|
75 |
} else {
|
|
|
76 |
header.setHtml("");
|
|
|
77 |
content.removeAll();
|
|
|
78 |
}
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
public void rafraichir(Object nouvelleDonnees) {
|
|
|
82 |
if (nouvelleDonnees instanceof Structure) {
|
|
|
83 |
afficherDetailInstitution((Structure) nouvelleDonnees);
|
69 |
jpm |
84 |
} else if (nouvelleDonnees instanceof StructureListe) {
|
|
|
85 |
StructureListe listeInstitutions = (StructureListe) nouvelleDonnees;
|
60 |
jpm |
86 |
// Test pour savoir si la liste contient des éléments
|
|
|
87 |
if (listeInstitutions.size() == 0) {
|
|
|
88 |
afficherDetailInstitution(null);
|
|
|
89 |
}
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
}
|