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