Subversion Repositories eFlore/Applications.coel

Rev

Rev 453 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 453 Rev 468
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
2
 
2
 
3
import org.tela_botanica.client.ComposantClass;
3
import org.tela_botanica.client.ComposantClass;
4
import org.tela_botanica.client.ComposantId;
4
import org.tela_botanica.client.ComposantId;
5
import org.tela_botanica.client.Mediateur;
5
import org.tela_botanica.client.Mediateur;
6
import org.tela_botanica.client.interfaces.Rafraichissable;
6
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.modeles.Collection;
7
import org.tela_botanica.client.modeles.Collection;
8
import org.tela_botanica.client.modeles.ProjetListe;
8
import org.tela_botanica.client.modeles.ProjetListe;
9
import org.tela_botanica.client.modeles.Structure;
9
import org.tela_botanica.client.modeles.Structure;
10
import org.tela_botanica.client.modeles.StructureListe;
-
 
11
import org.tela_botanica.client.modeles.ValeurListe;
10
import org.tela_botanica.client.modeles.ValeurListe;
12
 
11
 
13
import com.extjs.gxt.ui.client.Style.Scroll;
12
import com.extjs.gxt.ui.client.Style.Scroll;
14
import com.extjs.gxt.ui.client.util.Format;
13
import com.extjs.gxt.ui.client.util.Format;
15
import com.extjs.gxt.ui.client.util.Params;
14
import com.extjs.gxt.ui.client.util.Params;
16
import com.extjs.gxt.ui.client.widget.ContentPanel;
15
import com.extjs.gxt.ui.client.widget.ContentPanel;
17
import com.extjs.gxt.ui.client.widget.Html;
16
import com.extjs.gxt.ui.client.widget.Html;
18
import com.extjs.gxt.ui.client.widget.TabItem;
17
import com.extjs.gxt.ui.client.widget.TabItem;
19
import com.extjs.gxt.ui.client.widget.TabPanel;
18
import com.extjs.gxt.ui.client.widget.TabPanel;
20
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
19
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
21
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
20
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
22
import com.google.gwt.core.client.GWT;
21
import com.google.gwt.core.client.GWT;
23
 
22
 
24
public class CollectionDetailVue extends DetailVue implements Rafraichissable {
23
public class CollectionDetailVue extends DetailVue implements Rafraichissable {
25
 
24
 
26
	private StructureListe structures = null;
25
	private Structure structure = null;
27
	
26
	
28
	private String enteteTpl = null;
27
	private String enteteTpl = null;
29
	private String generalTpl = null;
28
	private String generalTpl = null;
30
	
29
	
31
	private Collection collection = null;
30
	private Collection collection = null;
32
	
31
	
33
	private ContentPanel panneauPrincipal = null;
32
	private ContentPanel panneauPrincipal = null;
34
	private Html entete = null;
33
	private Html entete = null;
35
	private TabPanel onglets = null;
34
	private TabPanel onglets = null;
36
	private TabItem generalOnglet = null;
35
	private TabItem generalOnglet = null;
37
	
36
	
38
	public CollectionDetailVue(Mediateur mediateurCourant) {
37
	public CollectionDetailVue(Mediateur mediateurCourant) {
39
		super(mediateurCourant);
38
		super(mediateurCourant);
40
		initialiserTousLesTpl();
39
		initialiserTousLesTpl();
41
		chargerOntologie();
40
		chargerOntologie();
42
		
41
		
43
		panneauPrincipal = new ContentPanel();
42
		panneauPrincipal = new ContentPanel();
44
		panneauPrincipal.setLayout(new FlowLayout());
43
		panneauPrincipal.setLayout(new FlowLayout());
45
		panneauPrincipal.setHeaderVisible(false);
44
		panneauPrincipal.setHeaderVisible(false);
46
		panneauPrincipal.setBodyBorder(false);
45
		panneauPrincipal.setBodyBorder(false);
47
			
46
			
48
	    entete = new Html();
47
	    entete = new Html();
49
	    entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
48
	    entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
50
	    panneauPrincipal.setTopComponent(entete);
49
	    panneauPrincipal.setTopComponent(entete);
51
		
50
		
52
		onglets = new TabPanel();
51
		onglets = new TabPanel();
53
		onglets.setId(ComposantId.ZONE_DETAIL_CORPS);
52
		onglets.setId(ComposantId.ZONE_DETAIL_CORPS);
54
		onglets.setHeight("100%");
53
		onglets.setHeight("100%");
55
		onglets.setBodyBorder(false);
54
		onglets.setBodyBorder(false);
56
 
55
 
57
		generalOnglet = new TabItem(i18nC.structureInfoGeneral());
56
		generalOnglet = new TabItem(i18nC.structureInfoGeneral());
58
		generalOnglet.setLayout(new AnchorLayout());
57
		generalOnglet.setLayout(new AnchorLayout());
59
		generalOnglet.setScrollMode(Scroll.AUTO);
58
		generalOnglet.setScrollMode(Scroll.AUTO);
60
		onglets.add(generalOnglet);
59
		onglets.add(generalOnglet);
61
		
60
		
62
		panneauPrincipal.add(onglets);
61
		panneauPrincipal.add(onglets);
63
		add(panneauPrincipal);
62
		add(panneauPrincipal);
64
	}
63
	}
65
	
64
	
66
	private void initialiserTousLesTpl() {
65
	private void initialiserTousLesTpl() {
67
		initialiserEnteteHtmlTpl();
66
		initialiserEnteteHtmlTpl();
68
		initialiserGeneralTpl();
67
		initialiserGeneralTpl();
69
	}
68
	}
70
	
69
	
71
	private void initialiserEnteteHtmlTpl() {
70
	private void initialiserEnteteHtmlTpl() {
72
		enteteTpl = 	
71
		enteteTpl = 	
73
			"<div id='{css_id}'>"+
72
			"<div id='{css_id}'>"+
74
			"	<h1>{nom}</h1>"+
73
			"	<h1>{nom}</h1>"+
75
			"	<h2>{structure}<span class='{css_meta}'>{projet} - {id} - {guid}</span></h2>" +
74
			"	<h2>{structure}<span class='{css_meta}'>{projet} - {id} - {guid}</span></h2>" +
76
			"	" +
75
			"	" +
77
			"</div>";
76
			"</div>";
78
	}
77
	}
79
	
78
	
80
	private void initialiserGeneralTpl() {
79
	private void initialiserGeneralTpl() {
81
		generalTpl =
80
		generalTpl =
82
			"<div class='{css_corps}'>"+
81
			"<div class='{css_corps}'>"+
83
			"	<div class='{css_fieldset}'>"+
82
			"	<div class='{css_fieldset}'>"+
84
			"		<h2>{i18n_titre_identification}</h2>"+
83
			"		<h2>{i18n_titre_identification}</h2>"+
85
			"		<span class='{css_label}'>{i18n_sigle} :</span> {sigle}<br />"+
84
			"		<span class='{css_label}'>{i18n_sigle} :</span> {sigle}<br />"+
86
			"	</div>"+
85
			"	</div>"+
87
			"</div>";
86
			"</div>";
88
	}
87
	}
89
	
88
	
90
	private void chargerOntologie() {
89
	private void chargerOntologie() {
91
		
90
		
92
	}
91
	}
93
	
92
	
94
	public void rafraichir(Object nouvelleDonnees) {
93
	public void rafraichir(Object nouvelleDonnees) {
95
		if (nouvelleDonnees instanceof Collection) {
94
		if (nouvelleDonnees instanceof Collection) {
96
			collection = (Collection) nouvelleDonnees;
95
			collection = (Collection) nouvelleDonnees;
97
			afficherDetail();
96
			afficherDetail();
98
		} else if (nouvelleDonnees instanceof ProjetListe) {
97
		} else if (nouvelleDonnees instanceof ProjetListe) {
99
			projets = (ProjetListe) nouvelleDonnees;
98
			projets = (ProjetListe) nouvelleDonnees;
100
		} else if (nouvelleDonnees instanceof ValeurListe) {
99
		} else if (nouvelleDonnees instanceof ValeurListe) {
101
			ValeurListe ontologieReceptionnee = (ValeurListe) nouvelleDonnees;
100
			ValeurListe ontologieReceptionnee = (ValeurListe) nouvelleDonnees;
102
			ajouterListeValeursAOntologie(ontologieReceptionnee);
101
			ajouterListeValeursAOntologie(ontologieReceptionnee);
103
		} else {
102
		} else {
104
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
103
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
105
		}
104
		}
106
	}
105
	}
107
	
106
	
108
	private void afficherDetail() {
107
	private void afficherDetail() {
109
		if (collection != null) {
108
		if (collection != null) {
110
			afficherEntete();
109
			afficherEntete();
111
			afficherIdentification();
110
			afficherIdentification();
112
		}
111
		}
113
		layout();
112
		layout();
114
	}
113
	}
115
	
114
	
116
	private void afficherEntete() {
115
	private void afficherEntete() {
117
		Params enteteParams = new Params();
116
		Params enteteParams = new Params();
118
		enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
117
		enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
119
		enteteParams.set("css_meta", ComposantClass.META);
118
		enteteParams.set("css_meta", ComposantClass.META);
120
		
119
		
121
		enteteParams.set("nom", collection.getNom());
120
		enteteParams.set("nom", collection.getNom());
122
		enteteParams.set("structure", construireTxtStructure(collection.getIdStructure()));
121
		enteteParams.set("structure", collection.getStructureNom());
123
		enteteParams.set("id", collection.getId());
122
		enteteParams.set("id", collection.getId());
124
		enteteParams.set("guid", collection.getGuid());
123
		enteteParams.set("guid", collection.getGuid());
125
		enteteParams.set("projet", construireTxtProjet(collection.getIdProjet()));
124
		enteteParams.set("projet", construireTxtProjet(collection.getIdProjet()));
126
		
125
		
127
		String eHtml = Format.substitute(enteteTpl, enteteParams);
126
		String eHtml = Format.substitute(enteteTpl, enteteParams);
128
		entete.getElement().setInnerHTML(eHtml);
127
		entete.getElement().setInnerHTML(eHtml);
129
	}
128
	}
130
	
129
	
131
	private void afficherIdentification() {
130
	private void afficherIdentification() {
132
		Params generalParams = new Params();
131
		Params generalParams = new Params();
133
		generalParams.set("i18n_titre_identification", i18nC.titreAdministratif());
132
		generalParams.set("i18n_titre_identification", i18nC.titreAdministratif());
134
		generalParams.set("i18n_acronyme", i18nC.acronyme());
133
		generalParams.set("i18n_acronyme", i18nC.acronyme());
135
 
134
 
136
		String acronyme = construireTxtTruck(collection.getIdAlternatif());
135
		String acronyme = construireTxtTruck(collection.getIdAlternatif());
137
		
136
		
138
		generalParams.set("acronyme", acronyme);
137
		generalParams.set("acronyme", acronyme);
139
		
138
		
140
		afficherOnglet(generalTpl, generalParams, generalOnglet);
139
		afficherOnglet(generalTpl, generalParams, generalOnglet);
141
	}
140
	}
142
	
141
	
143
	protected String construireTxtStructure(String idStructure) {
142
	protected String getNomStructure() {
144
		String chaineARetourner = idStructure;
-
 
145
		
143
		String nomStructure = "";
146
		if (structures != null) {
-
 
147
			Structure structure = structures.get(idStructure);
144
		if (structure != null) {
148
			String nomStructure = structure.getNom();
145
			nomStructure = structure.getNom();
149
			if  (!nomStructure.equals("")) {
146
		} else {
150
				chaineARetourner = nomStructure;
-
 
151
			}
147
			nomStructure = collection.getIdStructure();
152
		}
-
 
153
		
148
		}
154
		return chaineARetourner;
149
		return nomStructure;
155
	}
150
	}
156
}
151
}