Subversion Repositories eFlore/Applications.coel

Rev

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

Rev Author Line No. Line
60 jpm 1
package org.tela_botanica.client.vues;
2
 
653 jp_milcent 3
import java.util.Iterator;
4
 
277 jp_milcent 5
import org.tela_botanica.client.Mediateur;
6
import org.tela_botanica.client.interfaces.Rafraichissable;
468 jp_milcent 7
import org.tela_botanica.client.modeles.CollectionListe;
277 jp_milcent 8
import org.tela_botanica.client.modeles.Information;
9
import org.tela_botanica.client.modeles.PersonneListe;
10
import org.tela_botanica.client.modeles.ProjetListe;
11
import org.tela_botanica.client.modeles.PublicationListe;
12
import org.tela_botanica.client.modeles.StructureListe;
156 jp_milcent 13
 
653 jp_milcent 14
import com.extjs.gxt.ui.client.widget.Component;
277 jp_milcent 15
import com.extjs.gxt.ui.client.widget.Info;
60 jpm 16
import com.extjs.gxt.ui.client.widget.LayoutContainer;
17
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
277 jp_milcent 18
import com.google.gwt.core.client.GWT;
60 jpm 19
 
444 jp_milcent 20
public class ContenuVue extends LayoutContainer implements Rafraichissable {
60 jpm 21
 
373 jp_milcent 22
	private Mediateur mediateur = null;
23
 
444 jp_milcent 24
	public ContenuVue(Mediateur mediateurCourant) {
373 jp_milcent 25
		mediateur = mediateurCourant;
60 jpm 26
		setLayout(new FitLayout());
364 jp_milcent 27
		setBorders(true);
60 jpm 28
	}
277 jp_milcent 29
 
653 jp_milcent 30
	public Rafraichissable getContenu() {
31
		Rafraichissable contenuPanneauCentre = null;
32
		if (getItems() != null && getItems().size() == 1) {
33
			contenuPanneauCentre = (Rafraichissable) getItem(0);
34
		}
35
		return contenuPanneauCentre;
36
	}
37
 
277 jp_milcent 38
	//+----------------------------------------------------------------------------------------------------------------+
39
	//	RAFRAICHISSEMENT
40
	//+----------------------------------------------------------------------------------------------------------------+
41
 
416 gduche 42
	public void rafraichir(Object nouvellesDonnees) {
43
		if (nouvellesDonnees instanceof StructureListe) {
44
			mediateur.afficherListeStructures((StructureListe) nouvellesDonnees);
468 jp_milcent 45
		}  else if (nouvellesDonnees instanceof CollectionListe) {
46
			mediateur.afficherListeCollections((CollectionListe) nouvellesDonnees);
416 gduche 47
		} else if (nouvellesDonnees instanceof PublicationListe) {
48
			mediateur.afficherListePublication((PublicationListe) nouvellesDonnees);
49
		} else if (nouvellesDonnees instanceof PersonneListe) {
50
			mediateur.afficherListePersonnes((PersonneListe) nouvellesDonnees);
51
		} else if (nouvellesDonnees instanceof ProjetListe)	{
877 aurelien 52
			GWT.log("reception d'une liste de projets", null);
416 gduche 53
			mediateur.afficherListeProjets((ProjetListe) nouvellesDonnees);
54
		} else if (nouvellesDonnees instanceof Information)	{
55
			Information info = (Information) nouvellesDonnees;
667 gduche 56
			if (info.getType().equals("maj_utilisateur"))	{
911 jpm 57
				if (getContenu() != null)	{
672 gduche 58
					getContenu().rafraichir(info);
59
				}
667 gduche 60
			} else 	{
61
				// Affichage des éventuels messages de déboguage ou d'alerte
62
				if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
63
					GWT.log(info.getMessages().toString(), null);
64
				}
65
				// Traitement en fonction des types d'information
66
				if (info.getType().equals("liste_personne")) {
67
					mediateur.afficherListePersonnes((PersonneListe) info.getDonnee(0));
68
					Info.display("Chargement d'une liste de personnes", "");
69
				}
277 jp_milcent 70
			}
71
		}
358 jp_milcent 72
		mediateur.desactiverChargement();
277 jp_milcent 73
	}
60 jpm 74
}