453 |
jp_milcent |
1 |
package org.tela_botanica.client.vues;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.client.ComposantClass;
|
|
|
4 |
import org.tela_botanica.client.ComposantId;
|
|
|
5 |
import org.tela_botanica.client.Mediateur;
|
|
|
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
7 |
import org.tela_botanica.client.modeles.Collection;
|
630 |
jp_milcent |
8 |
import org.tela_botanica.client.modeles.CollectionBotanique;
|
453 |
jp_milcent |
9 |
import org.tela_botanica.client.modeles.ProjetListe;
|
|
|
10 |
import org.tela_botanica.client.modeles.Structure;
|
|
|
11 |
import org.tela_botanica.client.modeles.ValeurListe;
|
|
|
12 |
|
|
|
13 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
|
|
14 |
import com.extjs.gxt.ui.client.util.Format;
|
|
|
15 |
import com.extjs.gxt.ui.client.util.Params;
|
|
|
16 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
|
|
17 |
import com.extjs.gxt.ui.client.widget.Html;
|
|
|
18 |
import com.extjs.gxt.ui.client.widget.TabItem;
|
|
|
19 |
import com.extjs.gxt.ui.client.widget.TabPanel;
|
|
|
20 |
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
|
|
|
21 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
|
|
22 |
import com.google.gwt.core.client.GWT;
|
|
|
23 |
|
|
|
24 |
public class CollectionDetailVue extends DetailVue implements Rafraichissable {
|
|
|
25 |
|
468 |
jp_milcent |
26 |
private Structure structure = null;
|
453 |
jp_milcent |
27 |
|
|
|
28 |
private String enteteTpl = null;
|
|
|
29 |
private String generalTpl = null;
|
630 |
jp_milcent |
30 |
private String auteurTpl = null;
|
|
|
31 |
private String descriptionTpl = null;
|
|
|
32 |
private String contenuTpl = null;
|
|
|
33 |
private String documentTpl = null;
|
|
|
34 |
private String inventaireTpl = null;
|
453 |
jp_milcent |
35 |
|
|
|
36 |
private Collection collection = null;
|
|
|
37 |
|
|
|
38 |
private ContentPanel panneauPrincipal = null;
|
|
|
39 |
private Html entete = null;
|
|
|
40 |
private TabPanel onglets = null;
|
|
|
41 |
private TabItem generalOnglet = null;
|
630 |
jp_milcent |
42 |
private TabItem auteurOnglet = null;
|
|
|
43 |
private TabItem descriptionOnglet = null;
|
|
|
44 |
private TabItem contenuOnglet = null;
|
|
|
45 |
private TabItem documentOnglet = null;
|
|
|
46 |
private TabItem inventaireOnglet = null;
|
453 |
jp_milcent |
47 |
|
|
|
48 |
public CollectionDetailVue(Mediateur mediateurCourant) {
|
|
|
49 |
super(mediateurCourant);
|
|
|
50 |
initialiserTousLesTpl();
|
|
|
51 |
chargerOntologie();
|
|
|
52 |
|
|
|
53 |
panneauPrincipal = new ContentPanel();
|
|
|
54 |
panneauPrincipal.setLayout(new FlowLayout());
|
|
|
55 |
panneauPrincipal.setHeaderVisible(false);
|
|
|
56 |
panneauPrincipal.setBodyBorder(false);
|
|
|
57 |
|
|
|
58 |
entete = new Html();
|
|
|
59 |
entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
|
|
|
60 |
panneauPrincipal.setTopComponent(entete);
|
|
|
61 |
|
|
|
62 |
onglets = new TabPanel();
|
|
|
63 |
onglets.setId(ComposantId.ZONE_DETAIL_CORPS);
|
|
|
64 |
onglets.setHeight("100%");
|
|
|
65 |
onglets.setBodyBorder(false);
|
|
|
66 |
|
|
|
67 |
generalOnglet = new TabItem(i18nC.structureInfoGeneral());
|
|
|
68 |
generalOnglet.setLayout(new AnchorLayout());
|
|
|
69 |
generalOnglet.setScrollMode(Scroll.AUTO);
|
|
|
70 |
onglets.add(generalOnglet);
|
|
|
71 |
|
630 |
jp_milcent |
72 |
auteurOnglet = new TabItem(i18nC.collectionAuteur());
|
|
|
73 |
auteurOnglet.setLayout(new AnchorLayout());
|
|
|
74 |
auteurOnglet.setScrollMode(Scroll.AUTO);
|
|
|
75 |
onglets.add(auteurOnglet);
|
|
|
76 |
|
|
|
77 |
descriptionOnglet = new TabItem(i18nC.collectionDescription());
|
|
|
78 |
descriptionOnglet.setLayout(new AnchorLayout());
|
|
|
79 |
descriptionOnglet.setScrollMode(Scroll.AUTO);
|
|
|
80 |
onglets.add(descriptionOnglet);
|
|
|
81 |
|
|
|
82 |
contenuOnglet = new TabItem(i18nC.collectionContenu());
|
|
|
83 |
contenuOnglet.setLayout(new AnchorLayout());
|
|
|
84 |
contenuOnglet.setScrollMode(Scroll.AUTO);
|
|
|
85 |
onglets.add(contenuOnglet);
|
|
|
86 |
|
|
|
87 |
documentOnglet = new TabItem(i18nC.collectionDocument());
|
|
|
88 |
documentOnglet.setLayout(new AnchorLayout());
|
|
|
89 |
documentOnglet.setScrollMode(Scroll.AUTO);
|
|
|
90 |
onglets.add(documentOnglet);
|
|
|
91 |
|
|
|
92 |
inventaireOnglet = new TabItem(i18nC.collectionInventaire());
|
|
|
93 |
inventaireOnglet.setLayout(new AnchorLayout());
|
|
|
94 |
inventaireOnglet.setScrollMode(Scroll.AUTO);
|
|
|
95 |
onglets.add(inventaireOnglet);
|
|
|
96 |
|
453 |
jp_milcent |
97 |
panneauPrincipal.add(onglets);
|
|
|
98 |
add(panneauPrincipal);
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
private void initialiserTousLesTpl() {
|
|
|
102 |
initialiserEnteteHtmlTpl();
|
|
|
103 |
initialiserGeneralTpl();
|
630 |
jp_milcent |
104 |
initialiserAuteurTpl();
|
|
|
105 |
initialiserContenuTpl();
|
|
|
106 |
initialiserDescriptionTpl();
|
|
|
107 |
initialiserDocumentTpl();
|
|
|
108 |
initialiserInventaireTpl();
|
453 |
jp_milcent |
109 |
}
|
|
|
110 |
|
|
|
111 |
private void initialiserEnteteHtmlTpl() {
|
|
|
112 |
enteteTpl =
|
|
|
113 |
"<div id='{css_id}'>"+
|
|
|
114 |
" <h1>{nom}</h1>"+
|
|
|
115 |
" <h2>{structure}<span class='{css_meta}'>{projet} - {id} - {guid}</span></h2>" +
|
|
|
116 |
" " +
|
|
|
117 |
"</div>";
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
private void initialiserGeneralTpl() {
|
|
|
121 |
generalTpl =
|
|
|
122 |
"<div class='{css_corps}'>"+
|
|
|
123 |
" <div class='{css_fieldset}'>"+
|
|
|
124 |
" <h2>{i18n_titre_identification}</h2>"+
|
630 |
jp_milcent |
125 |
" <span class='{css_label}'>{i18n_nom_alternatif} :</span> {nom_alternatif}<br />"+
|
477 |
jp_milcent |
126 |
" <span class='{css_label}'>{i18n_acronyme} :</span> {acronyme}<br />"+
|
|
|
127 |
" <span class='{css_label}'>{i18n_code} :</span> {code}<br />"+
|
630 |
jp_milcent |
128 |
" <span class='{css_label}'>{i18n_cote} :</span> {cote}<br />"+
|
|
|
129 |
" <span class='{css_label}'>{i18n_mere} :</span> {mere}<br />"+
|
453 |
jp_milcent |
130 |
" </div>"+
|
477 |
jp_milcent |
131 |
" <div class='{css_fieldset}'>"+
|
630 |
jp_milcent |
132 |
" <h2>{i18n_general_collection_titre}</h2>"+
|
477 |
jp_milcent |
133 |
" <span class='{css_label}'>{i18n_description} :</span> {description}<br />"+
|
|
|
134 |
" <span class='{css_label}'>{i18n_description_specialiste} :</span> {description_specialiste}<br />"+
|
630 |
jp_milcent |
135 |
" <span class='{css_label}'>{i18n_historique} :</span> {historique}<br />"+
|
|
|
136 |
" <span class='{css_label}'>{i18n_web} :</span> {web}<br />"+
|
|
|
137 |
" <span class='{css_label}'>{i18n_groupement_principe} :</span> {groupement_principe}<br />"+
|
|
|
138 |
" <span class='{css_label}'>{i18n_groupement_but} :</span> {groupement_but}<br />"+
|
|
|
139 |
" <span class='{css_label}'>{i18n_type_ncd} :</span> {type_ncd}<br />"+
|
|
|
140 |
" <span class='{css_label}'>{i18n_type_botanique} :</span> {type_botanique}<br />"+
|
477 |
jp_milcent |
141 |
" </div>"+
|
|
|
142 |
" <hr class='{css_clear}'/>"+
|
453 |
jp_milcent |
143 |
"</div>";
|
|
|
144 |
}
|
|
|
145 |
|
630 |
jp_milcent |
146 |
private void initialiserAuteurTpl() {
|
|
|
147 |
auteurTpl =
|
|
|
148 |
"<div class='{css_corps}'>"+
|
|
|
149 |
" <div class='{css_fieldset}'>"+
|
|
|
150 |
" <h2>{i18n_titre_auteur}</h2>"+
|
|
|
151 |
" </div>"+
|
|
|
152 |
" <hr class='{css_clear}'/>"+
|
|
|
153 |
"</div>";
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
private void initialiserDescriptionTpl() {
|
|
|
157 |
descriptionTpl =
|
|
|
158 |
"<div class='{css_corps}'>"+
|
|
|
159 |
" <div class='{css_fieldset}'>"+
|
|
|
160 |
" <h2>{i18n_titre_description}</h2>"+
|
|
|
161 |
" </div>"+
|
|
|
162 |
" <hr class='{css_clear}'/>"+
|
|
|
163 |
"</div>";
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
private void initialiserContenuTpl() {
|
|
|
167 |
contenuTpl =
|
|
|
168 |
"<div class='{css_corps}'>"+
|
|
|
169 |
" <div class='{css_fieldset}'>"+
|
|
|
170 |
" <h2>{i18n_titre_contenu}</h2>"+
|
|
|
171 |
" </div>"+
|
|
|
172 |
" <hr class='{css_clear}'/>"+
|
|
|
173 |
"</div>";
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
private void initialiserDocumentTpl() {
|
|
|
177 |
documentTpl =
|
|
|
178 |
"<div class='{css_corps}'>"+
|
|
|
179 |
" <div class='{css_fieldset}'>"+
|
|
|
180 |
" <h2>{i18n_titre_document}</h2>"+
|
|
|
181 |
" </div>"+
|
|
|
182 |
" <hr class='{css_clear}'/>"+
|
|
|
183 |
"</div>";
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
private void initialiserInventaireTpl() {
|
|
|
187 |
inventaireTpl =
|
|
|
188 |
"<div class='{css_corps}'>"+
|
|
|
189 |
" <div class='{css_fieldset}'>"+
|
|
|
190 |
" <h2>{i18n_titre_inventaire}</h2>"+
|
|
|
191 |
" </div>"+
|
|
|
192 |
" <hr class='{css_clear}'/>"+
|
|
|
193 |
"</div>";
|
|
|
194 |
}
|
|
|
195 |
|
453 |
jp_milcent |
196 |
private void chargerOntologie() {
|
630 |
jp_milcent |
197 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeCollectionBota");
|
|
|
198 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeCollectionNcd");
|
|
|
199 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeDepot");
|
453 |
jp_milcent |
200 |
}
|
|
|
201 |
|
|
|
202 |
public void rafraichir(Object nouvelleDonnees) {
|
|
|
203 |
if (nouvelleDonnees instanceof Collection) {
|
|
|
204 |
collection = (Collection) nouvelleDonnees;
|
|
|
205 |
afficherDetail();
|
|
|
206 |
} else if (nouvelleDonnees instanceof ProjetListe) {
|
|
|
207 |
projets = (ProjetListe) nouvelleDonnees;
|
|
|
208 |
} else if (nouvelleDonnees instanceof ValeurListe) {
|
|
|
209 |
ValeurListe ontologieReceptionnee = (ValeurListe) nouvelleDonnees;
|
|
|
210 |
ajouterListeValeursAOntologie(ontologieReceptionnee);
|
|
|
211 |
} else {
|
|
|
212 |
GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
|
|
|
213 |
}
|
|
|
214 |
}
|
|
|
215 |
|
|
|
216 |
private void afficherDetail() {
|
|
|
217 |
if (collection != null) {
|
|
|
218 |
afficherEntete();
|
|
|
219 |
afficherIdentification();
|
630 |
jp_milcent |
220 |
afficherAuteur();
|
|
|
221 |
afficherDescription();
|
|
|
222 |
afficherContenu();
|
|
|
223 |
afficherDocument();
|
|
|
224 |
afficherInventaire();
|
453 |
jp_milcent |
225 |
}
|
|
|
226 |
layout();
|
|
|
227 |
}
|
|
|
228 |
|
|
|
229 |
private void afficherEntete() {
|
|
|
230 |
Params enteteParams = new Params();
|
|
|
231 |
enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
|
|
|
232 |
enteteParams.set("css_meta", ComposantClass.META);
|
|
|
233 |
|
|
|
234 |
enteteParams.set("nom", collection.getNom());
|
468 |
jp_milcent |
235 |
enteteParams.set("structure", collection.getStructureNom());
|
453 |
jp_milcent |
236 |
enteteParams.set("id", collection.getId());
|
|
|
237 |
enteteParams.set("guid", collection.getGuid());
|
|
|
238 |
enteteParams.set("projet", construireTxtProjet(collection.getIdProjet()));
|
|
|
239 |
|
|
|
240 |
String eHtml = Format.substitute(enteteTpl, enteteParams);
|
|
|
241 |
entete.getElement().setInnerHTML(eHtml);
|
|
|
242 |
}
|
|
|
243 |
|
|
|
244 |
private void afficherIdentification() {
|
|
|
245 |
Params generalParams = new Params();
|
|
|
246 |
generalParams.set("i18n_titre_identification", i18nC.titreAdministratif());
|
|
|
247 |
generalParams.set("i18n_acronyme", i18nC.acronyme());
|
477 |
jp_milcent |
248 |
generalParams.set("i18n_code", i18nC.code());
|
|
|
249 |
generalParams.set("i18n_cote", i18nC.cote());
|
630 |
jp_milcent |
250 |
generalParams.set("i18n_nom_alternatif", i18nC.nomAlternatif());
|
477 |
jp_milcent |
251 |
generalParams.set("i18n_mere", i18nC.collectionMere());
|
630 |
jp_milcent |
252 |
generalParams.set("i18n_general_collection_titre", i18nC.collectionGeneralTitre());
|
477 |
jp_milcent |
253 |
generalParams.set("i18n_description", i18nC.description());
|
|
|
254 |
generalParams.set("i18n_description_specialiste", i18nC.descriptionSpecialiste());
|
|
|
255 |
generalParams.set("i18n_historique", i18nC.historique());
|
|
|
256 |
generalParams.set("i18n_web", i18nC.siteWeb());
|
|
|
257 |
generalParams.set("i18n_groupement_principe", i18nC.groupementPrincipe());
|
|
|
258 |
generalParams.set("i18n_groupement_but", i18nC.groupementBut());
|
|
|
259 |
generalParams.set("i18n_type_ncd", i18nC.typeCollectionNcd());
|
|
|
260 |
generalParams.set("i18n_type_botanique", i18nC.typeCollectionBotanique());
|
630 |
jp_milcent |
261 |
generalParams.set("i18n_type_depot", i18nC.typeDepot());
|
477 |
jp_milcent |
262 |
|
|
|
263 |
String acronyme = construireTxtTruck(collection.getIdAlternatif());
|
630 |
jp_milcent |
264 |
String code = construireTxtTruck(collection.getCode());
|
|
|
265 |
String nomAlternatif = construireTxtTruck(collection.getNomAlternatif());
|
|
|
266 |
String urls = construireTxtTruck(collection.getUrls());
|
|
|
267 |
String typeNcd = construireTxtListeOntologie(collection.getTypeNcd());
|
|
|
268 |
String typeBota = construireTxtListeOntologie(collection.getBotanique().getType());
|
|
|
269 |
String typeDepot = construireTxtListeOntologie(collection.getTypeDepot());
|
|
|
270 |
|
|
|
271 |
generalParams.set("nom_alternatif", nomAlternatif);
|
453 |
jp_milcent |
272 |
generalParams.set("acronyme", acronyme);
|
630 |
jp_milcent |
273 |
generalParams.set("code", code);
|
|
|
274 |
generalParams.set("cote", collection.getCote());
|
|
|
275 |
generalParams.set("mere", collection.getCollectionMereNom());
|
477 |
jp_milcent |
276 |
generalParams.set("description", collection.getDescription());
|
|
|
277 |
generalParams.set("description_specialiste", collection.getDescriptionSpecialiste());
|
630 |
jp_milcent |
278 |
generalParams.set("historique", collection.getHistorique());
|
|
|
279 |
generalParams.set("web", urls);
|
|
|
280 |
generalParams.set("groupement_principe", collection.getGroupementPrincipe());
|
|
|
281 |
generalParams.set("groupement_but", collection.getGroupementBut());
|
|
|
282 |
generalParams.set("type_ncd", typeNcd);
|
|
|
283 |
generalParams.set("type_botanique", typeBota);
|
|
|
284 |
generalParams.set("type_depot", typeDepot);
|
453 |
jp_milcent |
285 |
|
|
|
286 |
afficherOnglet(generalTpl, generalParams, generalOnglet);
|
|
|
287 |
}
|
|
|
288 |
|
630 |
jp_milcent |
289 |
private void afficherAuteur() {
|
|
|
290 |
Params auteurParams = new Params();
|
|
|
291 |
auteurParams.set("i18n_titre_auteur", i18nC.collectionAuteurTitre());
|
|
|
292 |
|
|
|
293 |
afficherOnglet(auteurTpl, auteurParams, auteurOnglet);
|
|
|
294 |
}
|
|
|
295 |
|
|
|
296 |
private void afficherDescription() {
|
|
|
297 |
Params descriptionParams = new Params();
|
|
|
298 |
descriptionParams.set("i18n_titre_description", i18nC.collectionDescriptionTitre());
|
|
|
299 |
|
|
|
300 |
afficherOnglet(descriptionTpl, descriptionParams, descriptionOnglet);
|
|
|
301 |
}
|
|
|
302 |
|
|
|
303 |
private void afficherContenu() {
|
|
|
304 |
Params contenuParams = new Params();
|
|
|
305 |
contenuParams.set("i18n_titre_contenu", i18nC.collectionContenuTitre());
|
|
|
306 |
|
|
|
307 |
afficherOnglet(contenuTpl, contenuParams, contenuOnglet);
|
|
|
308 |
}
|
|
|
309 |
|
|
|
310 |
private void afficherDocument() {
|
|
|
311 |
Params documentParams = new Params();
|
|
|
312 |
documentParams.set("i18n_titre_document", i18nC.collectionDocumentTitre());
|
|
|
313 |
|
|
|
314 |
afficherOnglet(documentTpl, documentParams, documentOnglet);
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
private void afficherInventaire() {
|
|
|
318 |
Params inventaireParams = new Params();
|
|
|
319 |
inventaireParams.set("i18n_titre_inventaire", i18nC.collectionInventaireTitre());
|
|
|
320 |
|
|
|
321 |
afficherOnglet(inventaireTpl, inventaireParams, inventaireOnglet);
|
|
|
322 |
}
|
|
|
323 |
|
468 |
jp_milcent |
324 |
protected String getNomStructure() {
|
|
|
325 |
String nomStructure = "";
|
|
|
326 |
if (structure != null) {
|
|
|
327 |
nomStructure = structure.getNom();
|
|
|
328 |
} else {
|
|
|
329 |
nomStructure = collection.getIdStructure();
|
453 |
jp_milcent |
330 |
}
|
468 |
jp_milcent |
331 |
return nomStructure;
|
453 |
jp_milcent |
332 |
}
|
|
|
333 |
}
|