| Line 1... |
Line 1... |
| 1 |
package org.tela_botanica.client.vues;
|
1 |
package org.tela_botanica.client.vues;
|
| Line -... |
Line 2... |
| - |
|
2 |
|
| 2 |
|
3 |
import org.tela_botanica.client.ComposantClass;
|
| 3 |
import java.util.ArrayList;
|
- |
|
| 4 |
|
4 |
import org.tela_botanica.client.ComposantId;
|
| 5 |
import org.tela_botanica.client.Mediateur;
|
- |
|
| 6 |
import org.tela_botanica.client.i18n.Constantes;
|
5 |
import org.tela_botanica.client.Mediateur;
|
| 7 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 8 |
import org.tela_botanica.client.modeles.Publication;
|
- |
|
| 9 |
import org.tela_botanica.client.modeles.PublicationListe;
|
- |
|
| Line 10... |
Line -... |
| 10 |
import org.tela_botanica.client.modeles.Structure;
|
- |
|
| 11 |
|
- |
|
| 12 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
7 |
import org.tela_botanica.client.modeles.Publication;
|
| 13 |
import com.extjs.gxt.ui.client.store.ListStore;
|
8 |
|
| 14 |
import com.extjs.gxt.ui.client.util.Format;
|
9 |
import com.extjs.gxt.ui.client.util.Format;
|
| 15 |
import com.extjs.gxt.ui.client.util.Params;
|
10 |
import com.extjs.gxt.ui.client.util.Params;
|
| 16 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
11 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
| 17 |
import com.extjs.gxt.ui.client.widget.Html;
|
12 |
import com.extjs.gxt.ui.client.widget.Html;
|
| Line 18... |
Line 13... |
| 18 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
13 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
| Line 19... |
Line 14... |
| 19 |
import com.google.gwt.user.client.Window;
|
14 |
import com.google.gwt.core.client.GWT;
|
| - |
|
15 |
|
| - |
|
16 |
public class PublicationDetailVue extends DetailVue implements Rafraichissable {
|
| - |
|
17 |
|
| - |
|
18 |
private String enteteTpl = null;
|
| 20 |
|
19 |
private String contenuTpl = null;
|
| Line 21... |
Line -... |
| 21 |
public class PublicationDetailVue extends ContentPanel implements Rafraichissable {
|
- |
|
| 22 |
|
- |
|
| 23 |
private Mediateur mediateur = null;
|
- |
|
| 24 |
private Constantes i18nC = null;
|
20 |
|
| 25 |
|
- |
|
| 26 |
private ContentPanel content;
|
- |
|
| 27 |
private Html header;
|
- |
|
| Line 28... |
Line 21... |
| 28 |
private String enteteHTML = "<div id='coel-detail-entete'><div id='css_id'><h1>{0}</h1><h2>{1}</h2><h2>{2}</h2></div></div>";
|
21 |
private ContentPanel panneauPrincipal = null;
|
| 29 |
private String contenuHTML = "<div id='coel-detail-corps'><div class='css_fieldset coel-detail-corps-contenu'><h2>Détails de la publication</h2><span style='font-weight:bold;'>Nom de la revue :</span> {0}<br /><span style='font-weight:bold;'>Editeur :</span> {1}<br /><span style='font-weight:bold;'>Année :</span> {2}<br /><span style='font-weight:bold;'>Tome :</span> {3}<br /><span style='font-weight:bold;'>Fascicule :</span> {4}<br /><span style='font-weight:bold;'>Pages :</span> {5}</div></div>";
|
22 |
private Html entete = null;
|
| 30 |
private String publicationNom = null;
|
- |
|
| Line 31... |
Line 23... |
| 31 |
private String publicationAuteur = null;
|
23 |
private Html contenu = null;
|
| 32 |
private String publicationDateParution = null;
|
- |
|
| 33 |
|
24 |
|
| 34 |
public PublicationDetailVue(Mediateur mediateurCourant) {
|
25 |
private Publication publication = null;
|
| 35 |
mediateur = mediateurCourant;
|
26 |
|
| 36 |
i18nC = mediateur.i18nC;
|
27 |
public PublicationDetailVue(Mediateur mediateurCourant) {
|
| 37 |
|
28 |
super(mediateurCourant);
|
| 38 |
setHeaderVisible(false);
|
29 |
|
| 39 |
setLayout(new FitLayout());
|
30 |
initialiserTousLesTpl();
|
| - |
|
31 |
|
| 40 |
|
32 |
panneauPrincipal = new ContentPanel();
|
| - |
|
33 |
panneauPrincipal.setLayout(new FitLayout());
|
| - |
|
34 |
panneauPrincipal.setHeaderVisible(false);
|
| - |
|
35 |
panneauPrincipal.setBodyBorder(false);
|
| 41 |
content = new ContentPanel();
|
36 |
|
| 42 |
content.setBodyBorder(false);
|
37 |
entete = new Html();
|
| 43 |
content.setHeaderVisible(false);
|
38 |
entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
|
| Line -... |
Line 39... |
| - |
|
39 |
panneauPrincipal.setTopComponent(entete);
|
| - |
|
40 |
|
| - |
|
41 |
contenu = new Html();
|
| - |
|
42 |
panneauPrincipal.add(contenu);
|
| - |
|
43 |
|
| - |
|
44 |
add(panneauPrincipal);
|
| - |
|
45 |
}
|
| - |
|
46 |
|
| - |
|
47 |
private void initialiserTousLesTpl() {
|
| - |
|
48 |
initialiserEnteteHtmlTpl();
|
| - |
|
49 |
initialiserGeneralTpl();
|
| - |
|
50 |
}
|
| - |
|
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 />"+
|
| 44 |
content.setScrollMode(Scroll.AUTO);
|
70 |
" <span class='{css_label}'>{i18n_nvt} :</span> {nvt}<br />"+
|
| 45 |
|
71 |
" <span class='{css_label}'>{i18n_fascicule} :</span> {fascicule}<br />"+
|
| 46 |
header = new Html();
|
72 |
" <span class='{css_label}'>{i18n_pages} :</span> {pages}<br />"+
|
| 47 |
content.setTopComponent(header);
|
- |
|
| 48 |
|
- |
|
| 49 |
add(content);
|
- |
|
| 50 |
}
|
- |
|
| 51 |
|
- |
|
| 52 |
public void afficherDetailPublication(Publication publication) {
|
- |
|
| 53 |
if (publication != null) {
|
- |
|
| 54 |
content.removeAll();
|
- |
|
| 55 |
|
- |
|
| 56 |
publicationNom = publication.getTitre();
|
73 |
" </div>"+
|
| 57 |
publicationAuteur = publication.getAuteur().replaceAll("\\|", ", ");;
|
- |
|
| 58 |
publicationDateParution = publication.getDateParution();
|
- |
|
| 59 |
if(publicationDateParution.matches("^[0-2][0-9]{3}(-[0-9]{2}){2}$")) {
|
- |
|
| 60 |
publicationDateParution = publicationDateParution.split("-")[0];
|
- |
|
| 61 |
}
|
- |
|
| 62 |
|
- |
|
| 63 |
Params enteteParams = new Params();
|
- |
|
| 64 |
enteteParams.add(publicationNom);
|
- |
|
| 65 |
enteteParams.add(publicationAuteur);
|
- |
|
| 66 |
enteteParams.add(publicationDateParution);
|
- |
|
| 67 |
|
- |
|
| 68 |
String eHtml = Format.substitute(enteteHTML, enteteParams);
|
- |
|
| 69 |
header.getElement().setInnerHTML(eHtml);
|
- |
|
| 70 |
|
- |
|
| 71 |
Params contenuParams = new Params();
|
- |
|
| 72 |
contenuParams.add(publication.getCollection());
|
- |
|
| 73 |
contenuParams.add(publication.getNomEditeur());
|
- |
|
| 74 |
|
- |
|
| 75 |
contenuParams.add(publicationDateParution);
|
- |
|
| 76 |
contenuParams.add(publication.getIndicationNvt());
|
- |
|
| 77 |
contenuParams.add(publication.getFascicule());
|
- |
|
| 78 |
contenuParams.add(publication.getPages());
|
- |
|
| 79 |
|
74 |
" <hr class='{css_clear}'/>"+
|
| - |
|
75 |
"</div>";
|
| 80 |
String cHtml = Format.substitute(contenuHTML, contenuParams);
|
76 |
}
|
| 81 |
content.addText(cHtml);
|
77 |
|
| 82 |
|
78 |
public void afficherDetail() {
|
| - |
|
79 |
if (publication != null) {
|
| - |
|
80 |
afficherEntete();
|
| - |
|
81 |
afficherDetailPublication();
|
| Line 83... |
Line 82... |
| 83 |
layout();
|
82 |
}
|
| - |
|
83 |
layout();
|
| 84 |
} else {
|
84 |
}
|
| 85 |
header.setHtml("");
|
85 |
|
| - |
|
86 |
private void afficherEntete() {
|
| 86 |
content.removeAll();
|
87 |
Params enteteParams = new Params();
|
| - |
|
88 |
enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
|
| 87 |
}
|
89 |
enteteParams.set("css_meta", ComposantClass.META);
|
| - |
|
90 |
|
| - |
|
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());
|
| 88 |
}
|
96 |
enteteParams.set("projet", construireTxtProjet(publication.getIdProjet()));
|
| - |
|
97 |
|
| - |
|
98 |
String eHtml = Format.substitute(enteteTpl, enteteParams);
|
| - |
|
99 |
entete.getElement().setInnerHTML(eHtml);
|
| 89 |
|
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());
|
| 90 |
public void rafraichir(Object nouvelleDonnees) {
|
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);
|
| 91 |
|
132 |
contenu.getElement().setInnerHTML(gHtml);
|
| 92 |
if (nouvelleDonnees instanceof Publication) {
|
133 |
}
|
| Line 93... |
Line 134... |
| 93 |
afficherDetailPublication((Publication) nouvelleDonnees);
|
134 |
|