Subversion Repositories eFlore/Applications.coel

Rev

Rev 468 | Rev 630 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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;
8
import org.tela_botanica.client.modeles.ProjetListe;
9
import org.tela_botanica.client.modeles.Structure;
10
import org.tela_botanica.client.modeles.ValeurListe;
11
 
12
import com.extjs.gxt.ui.client.Style.Scroll;
13
import com.extjs.gxt.ui.client.util.Format;
14
import com.extjs.gxt.ui.client.util.Params;
15
import com.extjs.gxt.ui.client.widget.ContentPanel;
16
import com.extjs.gxt.ui.client.widget.Html;
17
import com.extjs.gxt.ui.client.widget.TabItem;
18
import com.extjs.gxt.ui.client.widget.TabPanel;
19
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
20
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
21
import com.google.gwt.core.client.GWT;
22
 
23
public class CollectionDetailVue extends DetailVue implements Rafraichissable {
24
 
468 jp_milcent 25
	private Structure structure = null;
453 jp_milcent 26
 
27
	private String enteteTpl = null;
28
	private String generalTpl = null;
29
 
30
	private Collection collection = null;
31
 
32
	private ContentPanel panneauPrincipal = null;
33
	private Html entete = null;
34
	private TabPanel onglets = null;
35
	private TabItem generalOnglet = null;
36
 
37
	public CollectionDetailVue(Mediateur mediateurCourant) {
38
		super(mediateurCourant);
39
		initialiserTousLesTpl();
40
		chargerOntologie();
41
 
42
		panneauPrincipal = new ContentPanel();
43
		panneauPrincipal.setLayout(new FlowLayout());
44
		panneauPrincipal.setHeaderVisible(false);
45
		panneauPrincipal.setBodyBorder(false);
46
 
47
	    entete = new Html();
48
	    entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
49
	    panneauPrincipal.setTopComponent(entete);
50
 
51
		onglets = new TabPanel();
52
		onglets.setId(ComposantId.ZONE_DETAIL_CORPS);
53
		onglets.setHeight("100%");
54
		onglets.setBodyBorder(false);
55
 
56
		generalOnglet = new TabItem(i18nC.structureInfoGeneral());
57
		generalOnglet.setLayout(new AnchorLayout());
58
		generalOnglet.setScrollMode(Scroll.AUTO);
59
		onglets.add(generalOnglet);
60
 
61
		panneauPrincipal.add(onglets);
62
		add(panneauPrincipal);
63
	}
64
 
65
	private void initialiserTousLesTpl() {
66
		initialiserEnteteHtmlTpl();
67
		initialiserGeneralTpl();
68
	}
69
 
70
	private void initialiserEnteteHtmlTpl() {
71
		enteteTpl =
72
			"<div id='{css_id}'>"+
73
			"	<h1>{nom}</h1>"+
74
			"	<h2>{structure}<span class='{css_meta}'>{projet} - {id} - {guid}</span></h2>" +
75
			"	" +
76
			"</div>";
77
	}
78
 
79
	private void initialiserGeneralTpl() {
80
		generalTpl =
81
			"<div class='{css_corps}'>"+
82
			"	<div class='{css_fieldset}'>"+
83
			"		<h2>{i18n_titre_identification}</h2>"+
477 jp_milcent 84
			"		<span class='{css_label}'>{i18n_acronyme} :</span> {acronyme}<br />"+
85
			"		<span class='{css_label}'>{i18n_code} :</span> {code}<br />"+
453 jp_milcent 86
			"	</div>"+
477 jp_milcent 87
			"	<div class='{css_fieldset}'>"+
88
			"		<h2>{i18n_description_collection_titre}</h2>"+
89
			"		<span class='{css_label}'>{i18n_description} :</span> {description}<br />"+
90
			"		<span class='{css_label}'>{i18n_description_specialiste} :</span> {description_specialiste}<br />"+
91
			"	</div>"+
92
			"	<hr class='{css_clear}'/>"+
453 jp_milcent 93
			"</div>";
94
	}
95
 
96
	private void chargerOntologie() {
97
 
98
	}
99
 
100
	public void rafraichir(Object nouvelleDonnees) {
101
		if (nouvelleDonnees instanceof Collection) {
102
			collection = (Collection) nouvelleDonnees;
103
			afficherDetail();
104
		} else if (nouvelleDonnees instanceof ProjetListe) {
105
			projets = (ProjetListe) nouvelleDonnees;
106
		} else if (nouvelleDonnees instanceof ValeurListe) {
107
			ValeurListe ontologieReceptionnee = (ValeurListe) nouvelleDonnees;
108
			ajouterListeValeursAOntologie(ontologieReceptionnee);
109
		} else {
110
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
111
		}
112
	}
113
 
114
	private void afficherDetail() {
115
		if (collection != null) {
116
			afficherEntete();
117
			afficherIdentification();
118
		}
119
		layout();
120
	}
121
 
122
	private void afficherEntete() {
123
		Params enteteParams = new Params();
124
		enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
125
		enteteParams.set("css_meta", ComposantClass.META);
126
 
127
		enteteParams.set("nom", collection.getNom());
468 jp_milcent 128
		enteteParams.set("structure", collection.getStructureNom());
453 jp_milcent 129
		enteteParams.set("id", collection.getId());
130
		enteteParams.set("guid", collection.getGuid());
131
		enteteParams.set("projet", construireTxtProjet(collection.getIdProjet()));
132
 
133
		String eHtml = Format.substitute(enteteTpl, enteteParams);
134
		entete.getElement().setInnerHTML(eHtml);
135
	}
136
 
137
	private void afficherIdentification() {
138
		Params generalParams = new Params();
139
		generalParams.set("i18n_titre_identification", i18nC.titreAdministratif());
140
		generalParams.set("i18n_acronyme", i18nC.acronyme());
477 jp_milcent 141
		generalParams.set("i18n_code", i18nC.code());
142
		generalParams.set("i18n_cote", i18nC.cote());
143
		generalParams.set("i18n_mere", i18nC.collectionMere());
144
		generalParams.set("i18n_description_collection_titre", i18nC.collectionDescriptionTitre());
145
		generalParams.set("i18n_description", i18nC.description());
146
		generalParams.set("i18n_description_specialiste", i18nC.descriptionSpecialiste());
147
		generalParams.set("i18n_historique", i18nC.historique());
148
		generalParams.set("i18n_web", i18nC.siteWeb());
149
		generalParams.set("i18n_groupement_principe", i18nC.groupementPrincipe());
150
		generalParams.set("i18n_groupement_but", i18nC.groupementBut());
151
		generalParams.set("i18n_type_ncd", i18nC.typeCollectionNcd());
152
		generalParams.set("i18n_type_botanique", i18nC.typeCollectionBotanique());
153
 
154
		String acronyme = construireTxtTruck(collection.getIdAlternatif());
453 jp_milcent 155
 
156
		generalParams.set("acronyme", acronyme);
477 jp_milcent 157
		generalParams.set("code", collection.getCode());
158
		//generalParams.set("cote", collection.getCote());
159
		//generalParams.set("mere", collection.getCollectionMereNom());
160
		generalParams.set("description", collection.getDescription());
161
		generalParams.set("description_specialiste", collection.getDescriptionSpecialiste());
162
		//generalParams.set("historique", collection.getHistorique());
163
		//generalParams.set("web", collection.getUrls());
164
		//generalParams.set("groupement_principe", collection.getGroupementPrincipe());
165
		//generalParams.set("groupement_but", collection.getGroupementBut());
166
		//generalParams.set("type_ncd", collection.getTypeNcd());
167
		//generalParams.set("type_botanique", collection.getTypeBotanique());
453 jp_milcent 168
 
477 jp_milcent 169
 
453 jp_milcent 170
		afficherOnglet(generalTpl, generalParams, generalOnglet);
171
	}
172
 
468 jp_milcent 173
	protected String getNomStructure() {
174
		String nomStructure = "";
175
		if (structure != null) {
176
			nomStructure = structure.getNom();
177
		} else {
178
			nomStructure = collection.getIdStructure();
453 jp_milcent 179
		}
468 jp_milcent 180
		return nomStructure;
453 jp_milcent 181
	}
182
}