| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.vues;
|
1 |
package org.tela_botanica.client.vues;
|
| Line -... |
Line 2... |
| - |
|
2 |
|
| - |
|
3 |
import org.tela_botanica.client.ComposantId;
|
| 2 |
|
4 |
import org.tela_botanica.client.Mediateur;
|
| 3 |
import org.tela_botanica.client.RegistreId;
|
5 |
import org.tela_botanica.client.RegistreId;
|
| 4 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 5 |
import org.tela_botanica.client.modeles.Structure;
|
- |
|
| Line 6... |
Line 7... |
| 6 |
import org.tela_botanica.client.modeles.StructureListe;
|
7 |
import org.tela_botanica.client.modeles.Structure;
|
| 7 |
|
8 |
|
| 8 |
import com.extjs.gxt.ui.client.Registry;
|
9 |
import com.extjs.gxt.ui.client.Registry;
|
| 9 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
10 |
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.Format;
|
| - |
|
12 |
import com.extjs.gxt.ui.client.util.Params;
|
| - |
|
13 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
| 11 |
import com.extjs.gxt.ui.client.util.Params;
|
14 |
import com.extjs.gxt.ui.client.widget.HtmlContainer;
|
| - |
|
15 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
| 12 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
16 |
import com.extjs.gxt.ui.client.widget.TabItem;
|
| - |
|
17 |
import com.extjs.gxt.ui.client.widget.TabPanel;
|
| Line 13... |
Line 18... |
| 13 |
import com.extjs.gxt.ui.client.widget.Html;
|
18 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
| Line 14... |
Line 19... |
| 14 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
19 |
import com.google.gwt.core.client.GWT;
|
| 15 |
|
- |
|
| - |
|
20 |
|
| 16 |
public class StructureDetailPanneauVue extends ContentPanel implements Rafraichissable {
|
21 |
public class StructureDetailPanneauVue extends LayoutContainer implements Rafraichissable {
|
| 17 |
|
22 |
|
| - |
|
23 |
private Mediateur mediateur = null;
|
| 18 |
private ContentPanel content;
|
24 |
|
| - |
|
25 |
private String enteteHTML = "<div class='coel-detail'><h1>{0}</h1><h2>{1}</h2></div>";
|
| - |
|
26 |
private String contenuHTML = null;
|
| 19 |
private Html header;
|
27 |
|
| - |
|
28 |
private Structure structure = null;
|
| 20 |
private String enteteHTML = "<div class='coel-detail'><h1>{0}</h1><h2>{1}</h2></div>";
|
29 |
|
| Line 21... |
Line 30... |
| 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>";
|
30 |
private ContentPanel panneauPrincipal = null;
|
| - |
|
31 |
private HtmlContainer entete = null;
|
| 22 |
private String structureNom = null;
|
32 |
private TabPanel onglets = null;
|
| - |
|
33 |
private TabItem identificationOnglet = null;
|
| - |
|
34 |
|
| Line 23... |
Line -... |
| 23 |
private String structureVille = null;
|
- |
|
| 24 |
private String structureDescription = null;
|
35 |
public StructureDetailPanneauVue(Mediateur mediateurCourant) {
|
| - |
|
36 |
mediateur = mediateurCourant;
|
| - |
|
37 |
Registry.register(RegistreId.PANNEAU_INSTITUTION_DETAIL, this);
|
| - |
|
38 |
initialiserEnteteHtmlTpl();
|
| - |
|
39 |
initialiserContenuHtmlTpl();
|
| - |
|
40 |
|
| - |
|
41 |
setLayout(new FitLayout());
|
| - |
|
42 |
setBorders(false);
|
| - |
|
43 |
setScrollMode(Scroll.AUTO);
|
| - |
|
44 |
|
| - |
|
45 |
panneauPrincipal = new ContentPanel();
|
| - |
|
46 |
|
| - |
|
47 |
entete = new HtmlContainer();
|
| - |
|
48 |
|
| - |
|
49 |
onglets = new TabPanel();
|
| - |
|
50 |
onglets.setAutoHeight(true);
|
| - |
|
51 |
onglets.setAutoWidth(true);
|
| - |
|
52 |
|
| - |
|
53 |
identificationOnglet = new TabItem("Général");
|
| Line 25... |
Line -... |
| 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();
|
54 |
onglets.add(identificationOnglet);
|
| 38 |
header.setStyleName("coel-detail");
|
- |
|
| 39 |
content.setTopComponent(header);
|
55 |
|
| 40 |
|
- |
|
| 41 |
add(content);
|
56 |
panneauPrincipal.add(entete);
|
| 42 |
}
|
57 |
panneauPrincipal.add(onglets);
|
| 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.getAdresse());
|
- |
|
| 62 |
contenuParams.add(structure.getCodePostal());
|
- |
|
| 63 |
contenuParams.add(structure.getVille());
|
- |
|
| 64 |
contenuParams.add(structure.getRegion());
|
- |
|
| 65 |
contenuParams.add(structure.getPays());
|
- |
|
| Line 66... |
Line -... |
| 66 |
contenuParams.add(structure.getTelephone());
|
- |
|
| 67 |
contenuParams.add(structure.getFax());
|
- |
|
| 68 |
contenuParams.add(structure.getCourriel());
|
58 |
add(panneauPrincipal);
|
| 69 |
contenuParams.add(structure.getConditionAcces());
|
59 |
}
|
| 70 |
|
60 |
|
| - |
|
61 |
private void afficherDetailInstitution(Structure structureCourante) {
|
| 71 |
String cHtml = Format.substitute(contenuHTML, contenuParams);
|
62 |
removeAll();
|
| - |
|
63 |
if (structureCourante != null) {
|
| - |
|
64 |
structure = structureCourante;
|
| - |
|
65 |
|
| - |
|
66 |
afficherEntete();
|
| - |
|
67 |
afficherIdentification();
|
| - |
|
68 |
}
|
| - |
|
69 |
panneauPrincipal.layout();
|
| - |
|
70 |
}
|
| - |
|
71 |
|
| - |
|
72 |
private void afficherEntete() {
|
| - |
|
73 |
Params enteteParams = new Params();
|
| - |
|
74 |
enteteParams.add(ComposantId.ZONE_DETAIL);
|
| - |
|
75 |
enteteParams.add(structure.getNom());
|
| - |
|
76 |
enteteParams.add(structure.getVille());
|
| - |
|
77 |
|
| - |
|
78 |
String eHtml = Format.substitute(enteteHTML, enteteParams);
|
| - |
|
79 |
entete.getElement().setInnerHTML(eHtml);
|
| - |
|
80 |
}
|
| - |
|
81 |
|
| - |
|
82 |
private void afficherIdentification() {
|
| - |
|
83 |
Params contenuParams = new Params();
|
| - |
|
84 |
contenuParams.add(structure.getDescription());
|
| - |
|
85 |
contenuParams.add(structure.getAdresse());
|
| - |
|
86 |
contenuParams.add(structure.getCodePostal());
|
| - |
|
87 |
contenuParams.add(structure.getVille());
|
| - |
|
88 |
contenuParams.add(structure.getRegion());
|
| - |
|
89 |
contenuParams.add(structure.getPays());
|
| - |
|
90 |
contenuParams.add(structure.getTelephone());
|
| - |
|
91 |
contenuParams.add(structure.getFax());
|
| - |
|
92 |
contenuParams.add(structure.getCourriel());
|
| - |
|
93 |
contenuParams.add(structure.getConditionAcces());
|
| - |
|
94 |
contenuParams.add(ComposantId.ZONE_DETAIL_CORPS);
|
| - |
|
95 |
|
| - |
|
96 |
String cHtml = Format.substitute(contenuHTML, contenuParams);
|
| - |
|
97 |
HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml);
|
| - |
|
98 |
identificationOnglet.add(corpsConteneurDuHtml);
|
| - |
|
99 |
}
|
| - |
|
100 |
|
| - |
|
101 |
private void initialiserEnteteHtmlTpl() {
|
| - |
|
102 |
enteteHTML = "<div id='{0}'>"+
|
| - |
|
103 |
" <h1>{1}</h1>"+
|
| - |
|
104 |
" <h2>{2}</h2>" +
|
| - |
|
105 |
"</div>";
|
| - |
|
106 |
}
|
| - |
|
107 |
|
| - |
|
108 |
private void initialiserContenuHtmlTpl() {
|
| - |
|
109 |
contenuHTML = "<div id='{10}'>"+
|
| - |
|
110 |
" <h2>Renseignements administratifs</h2>"+
|
| 72 |
content.addText(cHtml);
|
111 |
" <span style='font-weight:bold;'>Condition d'accès :</span> {9}<br />"+
|
| 73 |
|
112 |
" <span style='font-weight:bold;'>Adresse :</span> {1}, {2} {3}, {4}, {5}<br />"+
|
| 74 |
layout();
|
113 |
" <span style='font-weight:bold;'>Téléphone :</span> {6}<br />"+
|
| 75 |
} else {
|
114 |
" <span style='font-weight:bold;'>Fax :</span> {7}<br />"+
|
| 76 |
header.setHtml("");
|
115 |
" <span style='font-weight:bold;'>Courriel :</span> {8}<br />"+
|
| 77 |
content.removeAll();
|
116 |
" {0}"+
|
| 78 |
}
|
- |
|
| 79 |
}
|
- |
|
| 80 |
|
- |
|
| 81 |
public void rafraichir(Object nouvelleDonnees) {
|
- |
|
| 82 |
if (nouvelleDonnees instanceof Structure) {
|
117 |
"</div>";
|
| 83 |
afficherDetailInstitution((Structure) nouvelleDonnees);
|
118 |
}
|
| Line 84... |
Line 119... |
| 84 |
} else if (nouvelleDonnees instanceof StructureListe) {
|
119 |
|