935 |
jpm |
1 |
package org.tela_botanica.client.vues.structure;
|
60 |
jpm |
2 |
|
373 |
jp_milcent |
3 |
import org.tela_botanica.client.Mediateur;
|
60 |
jpm |
4 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
379 |
jp_milcent |
5 |
import org.tela_botanica.client.modeles.Information;
|
1613 |
aurelien |
6 |
import org.tela_botanica.client.modeles.MenuApplicationId;
|
935 |
jpm |
7 |
import org.tela_botanica.client.modeles.structure.Structure;
|
|
|
8 |
import org.tela_botanica.client.modeles.structure.StructureListe;
|
1322 |
gduche |
9 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
60 |
jpm |
10 |
|
|
|
11 |
import com.extjs.gxt.ui.client.Style.LayoutRegion;
|
|
|
12 |
import com.extjs.gxt.ui.client.util.Margins;
|
|
|
13 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
|
|
14 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
|
|
|
15 |
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
|
156 |
jp_milcent |
16 |
import com.google.gwt.core.client.GWT;
|
1613 |
aurelien |
17 |
import com.google.gwt.user.client.Window;
|
60 |
jpm |
18 |
|
|
|
19 |
public class StructureVue extends LayoutContainer implements Rafraichissable {
|
|
|
20 |
|
373 |
jp_milcent |
21 |
private Mediateur mediateur = null;
|
442 |
jp_milcent |
22 |
private StructureListeVue panneauInstitutionListe = null;
|
441 |
jp_milcent |
23 |
private StructureDetailVue panneauInstitutionDetail = null;
|
60 |
jpm |
24 |
|
1322 |
gduche |
25 |
private Sequenceur sequenceur = new Sequenceur();
|
|
|
26 |
|
373 |
jp_milcent |
27 |
public StructureVue(Mediateur mediateurCourant) {
|
|
|
28 |
mediateur = mediateurCourant;
|
|
|
29 |
|
60 |
jpm |
30 |
BorderLayout layout = new BorderLayout();
|
|
|
31 |
layout.setEnableState(false);
|
|
|
32 |
setLayout(layout);
|
|
|
33 |
|
442 |
jp_milcent |
34 |
panneauInstitutionListe = new StructureListeVue(mediateur);
|
373 |
jp_milcent |
35 |
add(panneauInstitutionListe, new BorderLayoutData(LayoutRegion.CENTER));
|
60 |
jpm |
36 |
|
1322 |
gduche |
37 |
panneauInstitutionDetail = new StructureDetailVue(mediateur, sequenceur);
|
373 |
jp_milcent |
38 |
BorderLayoutData dispositionSud = new BorderLayoutData(LayoutRegion.SOUTH, .5f, 200, 1000);
|
|
|
39 |
dispositionSud.setSplit(true);
|
|
|
40 |
dispositionSud.setMargins(new Margins(5, 0, 0, 0));
|
|
|
41 |
add(panneauInstitutionDetail, dispositionSud);
|
60 |
jpm |
42 |
}
|
|
|
43 |
|
851 |
gduche |
44 |
public void rafraichir(Object nouvellesDonnees) {
|
156 |
jp_milcent |
45 |
// Nous passons l'objet aux méthodes rafraichir des panneaux composant le panneau principal Structure
|
851 |
gduche |
46 |
if (nouvellesDonnees instanceof Structure) {
|
|
|
47 |
panneauInstitutionDetail.rafraichir(nouvellesDonnees);
|
|
|
48 |
} else if (nouvellesDonnees instanceof StructureListe) {
|
|
|
49 |
panneauInstitutionListe.rafraichir(nouvellesDonnees);
|
|
|
50 |
} else if (nouvellesDonnees instanceof Information) {
|
|
|
51 |
Information info = (Information) nouvellesDonnees;
|
379 |
jp_milcent |
52 |
if (info.getType().equals("liste_structure_a_personne")) {
|
851 |
gduche |
53 |
panneauInstitutionDetail.rafraichir(nouvellesDonnees);
|
1613 |
aurelien |
54 |
} else {
|
|
|
55 |
if(info.getType().equals("structure_ajoutee")) {
|
|
|
56 |
mediateur.clicMenu(MenuApplicationId.STRUCTURE);
|
|
|
57 |
} else {
|
|
|
58 |
panneauInstitutionListe.rafraichir(nouvellesDonnees);
|
|
|
59 |
}
|
|
|
60 |
|
379 |
jp_milcent |
61 |
}
|
373 |
jp_milcent |
62 |
} else {
|
851 |
gduche |
63 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
373 |
jp_milcent |
64 |
}
|
60 |
jpm |
65 |
}
|
|
|
66 |
|
|
|
67 |
}
|