414 |
aurelien |
1 |
package org.tela_botanica.del.client.composants.fenetreOverlayDefilante;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
|
|
4 |
|
|
|
5 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
6 |
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
7 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
|
|
8 |
import com.google.gwt.user.client.Window;
|
|
|
9 |
import com.google.gwt.user.client.ui.HasVisibility;
|
|
|
10 |
import com.google.gwt.user.client.ui.HasWidgets;
|
|
|
11 |
import com.google.gwt.user.client.ui.IsWidget;
|
|
|
12 |
import com.google.gwt.user.client.ui.RootPanel;
|
|
|
13 |
|
|
|
14 |
public abstract class FenetreOverlayDefilantePresenteur {
|
|
|
15 |
|
|
|
16 |
public interface Vue extends IsWidget {
|
|
|
17 |
public IsWidget getOverlay();
|
|
|
18 |
public HasVisibility getOverlayVisibility();
|
|
|
19 |
public IsWidget getOverlayContenu();
|
|
|
20 |
public HasVisibility getOverlayContenuVisibility();
|
|
|
21 |
public HasWidgets getOverlayContenuHasWidgets();
|
|
|
22 |
public HasClickHandlers getBoutonFermer();
|
|
|
23 |
public HasClickHandlers getBoutonSuivant();
|
|
|
24 |
public HasClickHandlers getBoutonPrecedent();
|
|
|
25 |
public void setStyleOverlay(String style);
|
|
|
26 |
public void setStyleOverlayContenu(String style);
|
|
|
27 |
public void setOverlayContenu(IsWidget w);
|
|
|
28 |
public void viderOverlay();
|
|
|
29 |
public void viderOverlayContenu();
|
427 |
aurelien |
30 |
public void surOuvertureFenetre();
|
|
|
31 |
public void surFermetureFenetre();
|
|
|
32 |
void surSetContenuFenetre();
|
414 |
aurelien |
33 |
}
|
|
|
34 |
|
|
|
35 |
private Vue vue;
|
|
|
36 |
|
|
|
37 |
private boolean fenetreModaleOuverte = false;
|
|
|
38 |
private int indexElementAffiche = 0;
|
|
|
39 |
|
|
|
40 |
// Constructeur
|
|
|
41 |
public FenetreOverlayDefilantePresenteur(int indexElementAffiche, Vue vue) {
|
|
|
42 |
this.indexElementAffiche = indexElementAffiche;
|
|
|
43 |
this.vue = vue;
|
|
|
44 |
gererEvenements();
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
// Afficheur
|
|
|
48 |
public void go() {
|
|
|
49 |
go(null);
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
public void go(HasWidgets composite) {
|
|
|
53 |
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
// Gestion des évènements
|
|
|
57 |
protected void gererEvenements() {
|
|
|
58 |
|
|
|
59 |
vue.getBoutonFermer().addClickHandler(new ClickHandler() {
|
|
|
60 |
public void onClick(ClickEvent event) {
|
|
|
61 |
fermerFenetreModale();
|
|
|
62 |
}
|
|
|
63 |
});
|
|
|
64 |
|
|
|
65 |
vue.getBoutonPrecedent().addClickHandler(new ClickHandler() {
|
|
|
66 |
public void onClick(ClickEvent event) {
|
|
|
67 |
surClicBoutonPrecedent(event);
|
|
|
68 |
}
|
|
|
69 |
});
|
|
|
70 |
|
|
|
71 |
vue.getBoutonSuivant().addClickHandler(new ClickHandler() {
|
|
|
72 |
public void onClick(ClickEvent event) {
|
|
|
73 |
surClicBoutonSuivant(event);
|
|
|
74 |
}
|
|
|
75 |
});
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public void ouvrirFenetreModaleDefilante(int indexElementAffiche, Presenteur presenteurModal) {
|
427 |
aurelien |
79 |
|
414 |
aurelien |
80 |
vue.setStyleOverlay("overlay");
|
|
|
81 |
vue.setStyleOverlayContenu("overlayContenu");
|
|
|
82 |
vue.getOverlayContenuVisibility().setVisible(true);
|
|
|
83 |
vue.getOverlayVisibility().setVisible(true);
|
|
|
84 |
RootPanel.get().add(vue.asWidget());
|
|
|
85 |
fenetreModaleOuverte = true;
|
427 |
aurelien |
86 |
|
|
|
87 |
setContenuFenetreModale(indexElementAffiche, presenteurModal);
|
|
|
88 |
vue.surOuvertureFenetre();
|
414 |
aurelien |
89 |
}
|
|
|
90 |
|
|
|
91 |
public void setContenuFenetreModale(int indexElementAffiche, Presenteur presenteurModal) {
|
|
|
92 |
this.indexElementAffiche = indexElementAffiche;
|
|
|
93 |
vue.viderOverlayContenu();
|
|
|
94 |
presenteurModal.go(vue.getOverlayContenuHasWidgets());
|
427 |
aurelien |
95 |
vue.surSetContenuFenetre();
|
414 |
aurelien |
96 |
}
|
|
|
97 |
|
|
|
98 |
public abstract void surClicBoutonSuivant(ClickEvent evt);
|
|
|
99 |
public abstract void surClicBoutonPrecedent(ClickEvent evt);
|
|
|
100 |
|
|
|
101 |
public boolean fenetreModaleEstOuverte() {
|
|
|
102 |
return fenetreModaleOuverte;
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
public void fermerFenetreModale() {
|
|
|
106 |
vue.viderOverlay();
|
|
|
107 |
vue.viderOverlayContenu();
|
|
|
108 |
RootPanel.get().remove(vue.asWidget());
|
|
|
109 |
fenetreModaleOuverte = false;
|
427 |
aurelien |
110 |
vue.surFermetureFenetre();
|
414 |
aurelien |
111 |
}
|
|
|
112 |
|
|
|
113 |
public int getIndexElementAffiche() {
|
|
|
114 |
return indexElementAffiche;
|
|
|
115 |
}
|
|
|
116 |
}
|