106 |
aurelien |
1 |
package org.tela_botanica.client.vues;
|
|
|
2 |
|
803 |
jpm |
3 |
import org.tela_botanica.client.ComposantClass;
|
|
|
4 |
import org.tela_botanica.client.ComposantId;
|
553 |
jp_milcent |
5 |
import org.tela_botanica.client.Mediateur;
|
106 |
aurelien |
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
7 |
import org.tela_botanica.client.modeles.Publication;
|
|
|
8 |
|
|
|
9 |
import com.extjs.gxt.ui.client.util.Format;
|
|
|
10 |
import com.extjs.gxt.ui.client.util.Params;
|
|
|
11 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
|
|
12 |
import com.extjs.gxt.ui.client.widget.Html;
|
|
|
13 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
803 |
jpm |
14 |
import com.google.gwt.core.client.GWT;
|
106 |
aurelien |
15 |
|
803 |
jpm |
16 |
public class PublicationDetailVue extends DetailVue implements Rafraichissable {
|
553 |
jp_milcent |
17 |
|
803 |
jpm |
18 |
private String enteteTpl = null;
|
|
|
19 |
private String contenuTpl = null;
|
|
|
20 |
|
|
|
21 |
private ContentPanel panneauPrincipal = null;
|
|
|
22 |
private Html entete = null;
|
|
|
23 |
private Html contenu = null;
|
553 |
jp_milcent |
24 |
|
803 |
jpm |
25 |
private Publication publication = null;
|
106 |
aurelien |
26 |
|
553 |
jp_milcent |
27 |
public PublicationDetailVue(Mediateur mediateurCourant) {
|
803 |
jpm |
28 |
super(mediateurCourant);
|
553 |
jp_milcent |
29 |
|
803 |
jpm |
30 |
initialiserTousLesTpl();
|
|
|
31 |
|
|
|
32 |
panneauPrincipal = new ContentPanel();
|
|
|
33 |
panneauPrincipal.setLayout(new FitLayout());
|
|
|
34 |
panneauPrincipal.setHeaderVisible(false);
|
|
|
35 |
panneauPrincipal.setBodyBorder(false);
|
|
|
36 |
|
|
|
37 |
entete = new Html();
|
|
|
38 |
entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
|
|
|
39 |
panneauPrincipal.setTopComponent(entete);
|
|
|
40 |
|
|
|
41 |
contenu = new Html();
|
|
|
42 |
panneauPrincipal.add(contenu);
|
|
|
43 |
|
|
|
44 |
add(panneauPrincipal);
|
|
|
45 |
}
|
106 |
aurelien |
46 |
|
803 |
jpm |
47 |
private void initialiserTousLesTpl() {
|
|
|
48 |
initialiserEnteteHtmlTpl();
|
|
|
49 |
initialiserGeneralTpl();
|
106 |
aurelien |
50 |
}
|
803 |
jpm |
51 |
|
|
|
52 |
private void initialiserEnteteHtmlTpl() {
|
|
|
53 |
enteteTpl =
|
|
|
54 |
"<div id='{css_id}'>"+
|
|
|
55 |
" <h1>{titre}</h1>"+
|
|
|
56 |
" <h2>{auteurs} ({annee})<span class='{css_meta}'>{projet} - {id} - {guid}</span></h2>" +
|
|
|
57 |
"</div>";
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
private void initialiserGeneralTpl() {
|
|
|
61 |
contenuTpl =
|
|
|
62 |
"<div class='{css_corps}'>"+
|
|
|
63 |
" <div class='{css_fieldset}'>"+
|
|
|
64 |
" <h2>{i18n_titre_detail}</h2>"+
|
|
|
65 |
" <span class='{css_label}'>{i18n_auteurs} :</span> {auteurs}<br />"+
|
|
|
66 |
" <span class='{css_label}'>{i18n_titre} :</span> {titre}<br />"+
|
|
|
67 |
" <span class='{css_label}'>{i18n_collection} :</span> {collection}<br />"+
|
|
|
68 |
" <span class='{css_label}'>{i18n_editeur} :</span> {editeur}<br />"+
|
|
|
69 |
" <span class='{css_label}'>{i18n_annee} :</span> {annee}<br />"+
|
|
|
70 |
" <span class='{css_label}'>{i18n_nvt} :</span> {nvt}<br />"+
|
|
|
71 |
" <span class='{css_label}'>{i18n_fascicule} :</span> {fascicule}<br />"+
|
|
|
72 |
" <span class='{css_label}'>{i18n_pages} :</span> {pages}<br />"+
|
|
|
73 |
" </div>"+
|
|
|
74 |
" <hr class='{css_clear}'/>"+
|
|
|
75 |
"</div>";
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public void afficherDetail() {
|
106 |
aurelien |
79 |
if (publication != null) {
|
803 |
jpm |
80 |
afficherEntete();
|
|
|
81 |
afficherDetailPublication();
|
106 |
aurelien |
82 |
}
|
803 |
jpm |
83 |
layout();
|
106 |
aurelien |
84 |
}
|
803 |
jpm |
85 |
|
|
|
86 |
private void afficherEntete() {
|
|
|
87 |
Params enteteParams = new Params();
|
|
|
88 |
enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
|
|
|
89 |
enteteParams.set("css_meta", ComposantClass.META);
|
716 |
aurelien |
90 |
|
803 |
jpm |
91 |
enteteParams.set("titre", publication.getTitre());
|
|
|
92 |
enteteParams.set("auteurs", publication.getAuteur());
|
|
|
93 |
enteteParams.set("annee", publication.getAnneeParution());
|
|
|
94 |
enteteParams.set("id", publication.getId());
|
|
|
95 |
enteteParams.set("guid", getGuid());
|
|
|
96 |
enteteParams.set("projet", construireTxtProjet(publication.getIdProjet()));
|
|
|
97 |
|
|
|
98 |
String eHtml = Format.substitute(enteteTpl, enteteParams);
|
|
|
99 |
entete.getElement().setInnerHTML(eHtml);
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
public String getGuid() {
|
|
|
103 |
String guid = "URN:tela-botanica.org:";
|
|
|
104 |
guid += "coel"+publication.getIdProjet()+":";
|
|
|
105 |
guid += "pub"+publication.getId();
|
|
|
106 |
return guid;
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
public void afficherDetailPublication() {
|
|
|
110 |
Params contenuParams = new Params();
|
|
|
111 |
|
|
|
112 |
contenuParams.set("i18n_titre_detail", i18nC.publicationTitre());
|
|
|
113 |
contenuParams.set("i18n_auteurs", i18nC.publicationAuteurs());
|
|
|
114 |
contenuParams.set("i18n_titre", i18nC.publicationTitre());
|
|
|
115 |
contenuParams.set("i18n_collection", i18nC.publicationRevueCollection());
|
|
|
116 |
contenuParams.set("i18n_editeur", i18nC.publicationEditeur());
|
|
|
117 |
contenuParams.set("i18n_annee", i18nC.publicationDateParution());
|
|
|
118 |
contenuParams.set("i18n_nvt", i18nC.publicationNvt());
|
|
|
119 |
contenuParams.set("i18n_fascicule", i18nC.publicationFascicule());
|
|
|
120 |
contenuParams.set("i18n_pages", i18nC.publicationPage());
|
|
|
121 |
|
|
|
122 |
contenuParams.set("auteurs", publication.getAuteur());
|
|
|
123 |
contenuParams.set("titre", publication.getTitre());
|
|
|
124 |
contenuParams.set("collection", publication.getCollection());
|
|
|
125 |
contenuParams.set("editeur", publication.getNomEditeur());
|
|
|
126 |
contenuParams.set("annee", publication.getAnneeParution());
|
|
|
127 |
contenuParams.set("nvt", publication.getIndicationNvt());
|
|
|
128 |
contenuParams.set("fascicule", publication.getFascicule());
|
|
|
129 |
contenuParams.set("pages", publication.getPages());
|
|
|
130 |
|
|
|
131 |
String gHtml = formaterContenu(contenuTpl, contenuParams);
|
|
|
132 |
contenu.getElement().setInnerHTML(gHtml);
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
public void rafraichir(Object nouvellesDonnees) {
|
|
|
136 |
if (nouvellesDonnees instanceof Publication) {
|
|
|
137 |
publication = (Publication) nouvellesDonnees;
|
|
|
138 |
afficherDetail();
|
|
|
139 |
} else {
|
|
|
140 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
106 |
aurelien |
141 |
}
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
}
|