Subversion Repositories eFlore/Applications.coel

Rev

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

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