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