Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 373 Rev 374
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
2
 
2
 
3
import org.tela_botanica.client.ComposantId;
3
import org.tela_botanica.client.ComposantId;
4
import org.tela_botanica.client.Mediateur;
4
import org.tela_botanica.client.Mediateur;
5
import org.tela_botanica.client.RegistreId;
-
 
6
import org.tela_botanica.client.interfaces.Rafraichissable;
5
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.modeles.Structure;
6
import org.tela_botanica.client.modeles.Structure;
8
 
7
 
9
import com.extjs.gxt.ui.client.Registry;
8
import com.extjs.gxt.ui.client.Events;
10
import com.extjs.gxt.ui.client.Style.Scroll;
9
import com.extjs.gxt.ui.client.Style.Scroll;
11
import com.extjs.gxt.ui.client.util.Format;
10
import com.extjs.gxt.ui.client.util.Format;
12
import com.extjs.gxt.ui.client.util.Params;
11
import com.extjs.gxt.ui.client.util.Params;
13
import com.extjs.gxt.ui.client.widget.ContentPanel;
12
import com.extjs.gxt.ui.client.widget.ContentPanel;
-
 
13
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
-
 
14
import com.extjs.gxt.ui.client.widget.Html;
14
import com.extjs.gxt.ui.client.widget.HtmlContainer;
15
import com.extjs.gxt.ui.client.widget.HtmlContainer;
15
import com.extjs.gxt.ui.client.widget.LayoutContainer;
16
import com.extjs.gxt.ui.client.widget.LayoutContainer;
16
import com.extjs.gxt.ui.client.widget.TabItem;
17
import com.extjs.gxt.ui.client.widget.TabItem;
17
import com.extjs.gxt.ui.client.widget.TabPanel;
18
import com.extjs.gxt.ui.client.widget.TabPanel;
18
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
19
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
-
 
20
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
19
import com.google.gwt.core.client.GWT;
21
import com.google.gwt.core.client.GWT;
20
 
22
 
21
public class StructureDetailPanneauVue extends LayoutContainer implements Rafraichissable {
23
public class StructureDetailPanneauVue extends LayoutContainer implements Rafraichissable {
22
 
24
 
23
	private Mediateur mediateur = null;
25
	private Mediateur mediateur = null;
24
	
26
	
25
	private String enteteHTML = "<div class='coel-detail'><h1>{0}</h1><h2>{1}</h2></div>";
27
	private String enteteTpl = null;
26
	private String contenuHTML = null;
28
	private String contenuTpl = null;
27
	
29
	
28
	private Structure structure = null;
30
	private Structure structure = null;
29
	
31
	
30
	private ContentPanel panneauPrincipal = null;
32
	private ContentPanel panneauPrincipal = null;
31
	private HtmlContainer entete = null;
33
	private Html entete = null;
32
	private TabPanel onglets = null;
34
	private TabPanel onglets = null;
33
	private TabItem identificationOnglet = null;
35
	private TabItem identificationOnglet = null;
34
 
36
 
35
	public StructureDetailPanneauVue(Mediateur mediateurCourant) {
37
	public StructureDetailPanneauVue(Mediateur mediateurCourant) {
36
		mediateur = mediateurCourant;
38
		mediateur = mediateurCourant;
37
		Registry.register(RegistreId.PANNEAU_INSTITUTION_DETAIL, this);
-
 
38
		initialiserEnteteHtmlTpl();
39
		initialiserEnteteHtmlTpl();
39
		initialiserContenuHtmlTpl();
40
		initialiserContenuHtmlTpl();
40
		
41
		
41
		setLayout(new FitLayout());
42
		setLayout(new FitLayout());
42
		setBorders(false);
43
		setBorders(false);
43
		setScrollMode(Scroll.AUTO);
44
		setScrollMode(Scroll.AUTO);
44
		
45
		
45
		panneauPrincipal = new ContentPanel();
46
		panneauPrincipal = new ContentPanel();
-
 
47
		panneauPrincipal.setLayout(new FlowLayout());
-
 
48
		panneauPrincipal.setHeaderVisible(false);
-
 
49
		panneauPrincipal.setBodyBorder(false);
46
		
-
 
47
		entete = new HtmlContainer();
50
		
48
		
51
		
49
		onglets = new TabPanel();
52
	    entete = new Html();
-
 
53
	    entete.setId(ComposantId.ZONE_DETAIL);
-
 
54
	    panneauPrincipal.setTopComponent(entete);
-
 
55
		
-
 
56
		onglets = new TabPanel();
-
 
57
		onglets.setHeight("100%");
50
		onglets.setAutoHeight(true);
58
		onglets.setBorders(false);
51
		onglets.setAutoWidth(true);
59
		onglets.setBodyBorder(false);
52
		
60
 
53
		identificationOnglet = new TabItem("Général");
61
		identificationOnglet = new TabItem("Général");
54
		onglets.add(identificationOnglet);
62
		onglets.add(identificationOnglet);
55
		
-
 
56
		panneauPrincipal.add(entete);
63
		
57
		panneauPrincipal.add(onglets);
64
		panneauPrincipal.add(onglets);
58
		add(panneauPrincipal);
65
		add(panneauPrincipal);
59
	}
66
	}
60
 
67
 
61
	private void afficherDetailInstitution(Structure structureCourante) {
68
	private void afficherDetailInstitution(Structure structureCourante) {
62
		removeAll();
-
 
63
		if (structureCourante != null) {
69
		if (structureCourante != null) {
64
			structure = structureCourante;
70
			structure = structureCourante;
65
 
71
 
66
			afficherEntete();
72
			afficherEntete();
67
			afficherIdentification();
73
			afficherIdentification();
68
		}
74
		}
69
		panneauPrincipal.layout();
75
		layout();
70
	}
76
	}
71
	
77
	
72
	private void afficherEntete() {
78
	private void afficherEntete() {
73
		Params enteteParams = new Params();
79
		Params enteteParams = new Params();
74
		enteteParams.add(ComposantId.ZONE_DETAIL);
80
		enteteParams.add(ComposantId.ZONE_DETAIL);
75
		enteteParams.add(structure.getNom());
81
		enteteParams.add(structure.getNom());
76
		enteteParams.add(structure.getVille());
82
		enteteParams.add(structure.getVille());
77
		
83
		
78
		String eHtml = Format.substitute(enteteHTML, enteteParams);
84
		String eHtml = Format.substitute(enteteTpl, enteteParams);
79
		entete.getElement().setInnerHTML(eHtml);
85
		entete.getElement().setInnerHTML(eHtml);
80
	}
86
	}
81
	
87
	
82
	private void afficherIdentification() {
88
	private void afficherIdentification() {
83
		Params contenuParams = new Params();
89
		Params contenuParams = new Params();
84
		contenuParams.add(structure.getDescription());
90
		contenuParams.add(structure.getDescription());
85
		contenuParams.add(structure.getAdresse());
91
		contenuParams.add(structure.getAdresse());
86
		contenuParams.add(structure.getCodePostal());
92
		contenuParams.add(structure.getCodePostal());
87
		contenuParams.add(structure.getVille());
93
		contenuParams.add(structure.getVille());
88
		contenuParams.add(structure.getRegion());
94
		contenuParams.add(structure.getRegion());
89
		contenuParams.add(structure.getPays());
95
		contenuParams.add(structure.getPays());
90
		contenuParams.add(structure.getTelephone());
96
		contenuParams.add(structure.getTelephone());
91
		contenuParams.add(structure.getFax());
97
		contenuParams.add(structure.getFax());
92
		contenuParams.add(structure.getCourriel());
98
		contenuParams.add(structure.getCourriel());
93
		contenuParams.add(structure.getConditionAcces());
99
		contenuParams.add(structure.getConditionAcces());
94
		contenuParams.add(ComposantId.ZONE_DETAIL_CORPS);
100
		contenuParams.add(ComposantId.ZONE_DETAIL_CORPS);
95
 
101
 
96
		String cHtml = Format.substitute(contenuHTML, contenuParams);
102
		String cHtml = Format.substitute(contenuTpl, contenuParams);
-
 
103
		HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml);
97
		HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml);
104
		identificationOnglet.removeAll();
98
		identificationOnglet.add(corpsConteneurDuHtml);
105
		identificationOnglet.add(corpsConteneurDuHtml);
99
	}
106
	}
100
	
107
	
101
	private void initialiserEnteteHtmlTpl() {
108
	private void initialiserEnteteHtmlTpl() {
102
		enteteHTML = 	"<div id='{0}'>"+
109
		enteteTpl = 	"<div id='{0}'>"+
103
						"	<h1>{1}</h1>"+
110
						"	<h1>{1}</h1>"+
104
						"	<h2>{2}</h2>" +
111
						"	<h2>{2}</h2>" +
105
						"</div>";
112
						"</div>";
106
	}
113
	}
107
	
114
	
108
	private void initialiserContenuHtmlTpl() {
115
	private void initialiserContenuHtmlTpl() {
109
		contenuHTML = 	"<div id='{10}'>"+
116
		contenuTpl = 	"<div id='{10}'>"+
110
						"	<h2>Renseignements administratifs</h2>"+
117
						"	<h2>Renseignements administratifs</h2>"+
111
						"	<span style='font-weight:bold;'>Condition d'accès :</span> {9}<br />"+
118
						"	<span style='font-weight:bold;'>Condition d'accès :</span> {9}<br />"+
112
						"	<span style='font-weight:bold;'>Adresse :</span> {1}, {2} {3}, {4}, {5}<br />"+
119
						"	<span style='font-weight:bold;'>Adresse :</span> {1}, {2} {3}, {4}, {5}<br />"+
113
						"	<span style='font-weight:bold;'>Téléphone :</span> {6}<br />"+
120
						"	<span style='font-weight:bold;'>Téléphone :</span> {6}<br />"+
114
						"	<span style='font-weight:bold;'>Fax :</span> {7}<br />"+
121
						"	<span style='font-weight:bold;'>Fax :</span> {7}<br />"+
115
						"	<span style='font-weight:bold;'>Courriel :</span> {8}<br />"+
122
						"	<span style='font-weight:bold;'>Courriel :</span> {8}<br />"+
116
						"	{0}"+
123
						"	{0}"+
117
						"</div>";
124
						"</div>";
118
	}
125
	}
119
	
126
	
120
	public void rafraichir(Object nouvelleDonnees) {
127
	public void rafraichir(Object nouvelleDonnees) {
121
		if (nouvelleDonnees instanceof Structure) {
128
		if (nouvelleDonnees instanceof Structure) {
122
			afficherDetailInstitution((Structure) nouvelleDonnees);
129
			afficherDetailInstitution((Structure) nouvelleDonnees);
123
		} else {
130
		} else {
124
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
131
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
125
		}
132
		}
126
	}
133
	}
127
 
134
 
128
}
135
}