Subversion Repositories eFlore/Applications.coel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
60 jpm 1
package org.tela_botanica.client.vues;
2
 
3
import org.tela_botanica.client.RegistreId;
4
import org.tela_botanica.client.interfaces.Rafraichissable;
5
import org.tela_botanica.client.modeles.ListeStructure;
6
 
7
import com.extjs.gxt.ui.client.Registry;
8
import com.extjs.gxt.ui.client.Style.LayoutRegion;
9
import com.extjs.gxt.ui.client.util.Margins;
10
import com.extjs.gxt.ui.client.widget.LayoutContainer;
11
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
12
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
13
import com.google.gwt.user.client.Window;
14
 
15
public class StructureVue extends LayoutContainer implements Rafraichissable {
16
 
17
	private StructureListePanneauVue panneauInstitutionListe;
18
	private StructureDetailPanneauVue panneauInstitutionDetail;
19
 
20
	public StructureVue() {
21
		BorderLayout layout = new BorderLayout();
22
		layout.setEnableState(false);
23
		setLayout(layout);
24
 
25
		panneauInstitutionListe = new StructureListePanneauVue();
26
		this.add(panneauInstitutionListe, new BorderLayoutData(LayoutRegion.CENTER));
27
 
28
		panneauInstitutionDetail = new StructureDetailPanneauVue();
29
		BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, .5f, 200, 1000);
30
		southData.setSplit(true);
31
		southData.setMargins(new Margins(5, 0, 0, 0));
32
		this.add(panneauInstitutionDetail, southData);
33
	}
34
 
35
	public void rafraichir(Object nouvelleDonnees) {
36
		if (nouvelleDonnees instanceof ListeStructure) {
37
			remplirListe((ListeStructure) nouvelleDonnees);
38
		} else {
39
			Window.alert("Problème!");
40
		}
41
	}
42
 
43
	private void remplirListe(ListeStructure listeInstitutions) {
44
		LayoutContainer panneauCentre = (LayoutContainer) Registry.get(RegistreId.PANNEAU_CENTRE);
45
		panneauInstitutionListe.rafraichir(listeInstitutions);
46
		panneauInstitutionDetail.rafraichir(listeInstitutions);
47
		panneauCentre.layout();
48
	}
49
 
50
}