1 |
package org.tela_botanica.client.vues;
|
1 |
package org.tela_botanica.client.vues;
|
2 |
|
2 |
|
3 |
import org.tela_botanica.client.Mediateur;
|
3 |
import org.tela_botanica.client.Mediateur;
|
4 |
import org.tela_botanica.client.RegistreId;
|
4 |
import org.tela_botanica.client.RegistreId;
|
5 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
5 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
6 |
import org.tela_botanica.client.modeles.Information;
|
6 |
import org.tela_botanica.client.modeles.Information;
|
7 |
import org.tela_botanica.client.modeles.PersonneListe;
|
7 |
import org.tela_botanica.client.modeles.PersonneListe;
|
8 |
|
8 |
|
9 |
import com.extjs.gxt.ui.client.Registry;
|
9 |
import com.extjs.gxt.ui.client.Registry;
|
10 |
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
10 |
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
11 |
import com.extjs.gxt.ui.client.util.Margins;
|
11 |
import com.extjs.gxt.ui.client.util.Margins;
|
12 |
import com.extjs.gxt.ui.client.widget.Info;
|
12 |
import com.extjs.gxt.ui.client.widget.Info;
|
13 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
13 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
14 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
|
14 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
|
15 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
|
15 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
|
16 |
import com.google.gwt.core.client.GWT;
|
16 |
import com.google.gwt.core.client.GWT;
|
17 |
|
17 |
|
18 |
public class PersonneVue extends LayoutContainer implements Rafraichissable {
|
18 |
public class PersonneVue extends LayoutContainer implements Rafraichissable {
|
19 |
|
19 |
|
20 |
private PanneauPersonneListe panneauPersonneListe;
|
20 |
private PanneauPersonneListe panneauPersonneListe;
|
21 |
private PersonneDetailPanneauVue panneauPersonneDetail;
|
21 |
private PersonneDetailPanneauVue panneauPersonneDetail;
|
22 |
|
22 |
|
23 |
public PersonneVue() {
|
23 |
public PersonneVue() {
|
24 |
BorderLayout layout = new BorderLayout();
|
24 |
BorderLayout layout = new BorderLayout();
|
25 |
layout.setEnableState(false);
|
25 |
layout.setEnableState(false);
|
26 |
setLayout(layout);
|
26 |
setLayout(layout);
|
27 |
|
27 |
|
28 |
panneauPersonneListe = new PanneauPersonneListe();
|
28 |
panneauPersonneListe = new PanneauPersonneListe();
|
29 |
this.add(panneauPersonneListe, new BorderLayoutData(LayoutRegion.CENTER));
|
29 |
this.add(panneauPersonneListe, new BorderLayoutData(LayoutRegion.CENTER));
|
30 |
|
30 |
|
31 |
panneauPersonneDetail = new PersonneDetailPanneauVue();
|
31 |
panneauPersonneDetail = new PersonneDetailPanneauVue();
|
32 |
BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, .5f, 200, 1000);
|
32 |
BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, .5f, 200, 1000);
|
33 |
southData.setSplit(true);
|
33 |
southData.setSplit(true);
|
34 |
southData.setMargins(new Margins(5, 0, 0, 0));
|
34 |
southData.setMargins(new Margins(5, 0, 0, 0));
|
35 |
this.add(panneauPersonneDetail, southData);
|
35 |
this.add(panneauPersonneDetail, southData);
|
36 |
}
|
36 |
}
|
37 |
|
37 |
|
38 |
public void rafraichir(Object nouvelleDonnees) {
|
38 |
public void rafraichir(Object nouvelleDonnees) {
|
39 |
if (nouvelleDonnees instanceof PersonneListe) {
|
39 |
if (nouvelleDonnees instanceof PersonneListe) {
|
40 |
remplirListe((PersonneListe) nouvelleDonnees);
|
40 |
panneauPersonneListe.rafraichir((PersonneListe) nouvelleDonnees);
|
41 |
} else if (nouvelleDonnees instanceof Information) {
|
41 |
} else if (nouvelleDonnees instanceof Information) {
|
42 |
Information info = (Information) nouvelleDonnees;
|
42 |
Information info = (Information) nouvelleDonnees;
|
43 |
// Affichage des éventuels messages de déboguage ou d'alerte
|
43 |
// Affichage des éventuels messages de déboguage ou d'alerte
|
44 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
44 |
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
|
45 |
GWT.log(info.getMessages().toString(), null);
|
45 |
GWT.log(info.getMessages().toString(), null);
|
46 |
}
|
46 |
}
|
47 |
// Traitement en fonction des types d'information
|
47 |
// Traitement en fonction des types d'information
|
48 |
if (info.getType().equals("liste_personne")) {
|
48 |
if (info.getType().equals("liste_personne")) {
|
49 |
((Mediateur) Registry.get(RegistreId.MEDIATEUR)).afficherListePersonnes((PersonneListe) info.getDonnee(0));
|
49 |
((Mediateur) Registry.get(RegistreId.MEDIATEUR)).afficherListePersonnes((PersonneListe) info.getDonnee(0));
|
50 |
Info.display("Chargement d'une liste de personnes", "");
|
50 |
Info.display("Chargement d'une liste de personnes", "");
|
51 |
}
|
51 |
}
|
52 |
} else {
|
52 |
} else {
|
53 |
GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
|
53 |
GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
|
54 |
}
|
54 |
}
|
55 |
}
|
55 |
}
|
56 |
|
- |
|
57 |
private void remplirListe(PersonneListe personneListe) {
|
- |
|
58 |
|
- |
|
59 |
LayoutContainer panneauCentre = (LayoutContainer) Registry.get(RegistreId.PANNEAU_CENTRE);
|
- |
|
60 |
panneauPersonneListe.rafraichir(personneListe);
|
- |
|
61 |
//panneauInstitutionDetail.rafraichir(listeInstitutions);
|
- |
|
62 |
panneauCentre.layout();
|
- |
|
63 |
}
|
- |
|
64 |
|
- |
|
65 |
}
|
56 |
}
|
66 |
|
57 |
|