Rev 197 | Rev 220 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.del.client.composants.presenteur;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
public abstract class Presenteur {
private Composite vue;
private Panel overlay;
private Panel overlayContenu;
// Constructeur
public Presenteur(Composite vue) {
this.vue = vue;
}
// Afficheur
public void go() {
go(null);
}
public abstract void go(HasWidgets composite);
// Gestion des évènements
protected abstract void handleEvents();
protected Composite getVue() {
return this.vue;
}
public void ouvrirFenetreModale(Presenteur presenteurModal) {
overlay = new HTMLPanel("");
overlay.setStyleName("overlay");
overlay.setVisible(false);
RootPanel.get().add(overlay);
overlayContenu = new HTMLPanel("");
overlayContenu.setStyleName("overlayContenu");
Button boutonFermer = new Button("Fermer");
boutonFermer.setStyleName("fermerOverlay");
boutonFermer.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
fermerFenetreModale();
}
});
presenteurModal.go(overlayContenu);
RootPanel.get().add(overlayContenu);
overlayContenu.setVisible(true);
overlayContenu.add(boutonFermer);
overlay.setVisible(true);
}
public void fermerFenetreModale() {
RootPanel.get().remove(overlay);
RootPanel.get().remove(overlayContenu);
}
}