Subversion Repositories eFlore/Applications.coel

Rev

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

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