Subversion Repositories eFlore/Applications.del

Rev

Rev 210 | Rev 221 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
161 gduche 1
package org.tela_botanica.del.client.composants.presenteur;
2
 
197 gduche 3
import com.google.gwt.event.dom.client.ClickEvent;
4
import com.google.gwt.event.dom.client.ClickHandler;
5
import com.google.gwt.user.client.ui.Button;
161 gduche 6
import com.google.gwt.user.client.ui.Composite;
197 gduche 7
import com.google.gwt.user.client.ui.HTMLPanel;
161 gduche 8
import com.google.gwt.user.client.ui.HasWidgets;
197 gduche 9
import com.google.gwt.user.client.ui.Panel;
10
import com.google.gwt.user.client.ui.RootPanel;
161 gduche 11
 
12
public abstract class Presenteur {
13
 
14
	private Composite vue;
197 gduche 15
	private Panel overlay;
16
	private Panel overlayContenu;
161 gduche 17
 
18
	// Constructeur
19
	public Presenteur(Composite vue) {
20
		this.vue = vue;
21
	}
22
 
23
	// Afficheur
24
	public void go() {
25
		go(null);
26
	}
27
 
28
	public abstract void go(HasWidgets composite);
29
 
30
	// Gestion des évènements
220 gduche 31
	protected abstract void gererEvenements();
161 gduche 32
 
33
	protected Composite getVue() {
34
		return this.vue;
35
	}
197 gduche 36
 
37
	public void ouvrirFenetreModale(Presenteur presenteurModal) {
38
 
39
		overlay = new HTMLPanel("");
40
		overlay.setStyleName("overlay");
41
		overlay.setVisible(false);
42
		RootPanel.get().add(overlay);
43
 
44
		overlayContenu = new HTMLPanel("");
45
		overlayContenu.setStyleName("overlayContenu");
46
 
47
		Button boutonFermer = new Button("Fermer");
48
		boutonFermer.setStyleName("fermerOverlay");
49
		boutonFermer.addClickHandler(new ClickHandler() {
50
 
51
			public void onClick(ClickEvent event) {
52
				fermerFenetreModale();
53
			}
54
		});
55
 
56
		presenteurModal.go(overlayContenu);
57
 
58
		RootPanel.get().add(overlayContenu);
59
		overlayContenu.setVisible(true);
60
 
61
		overlayContenu.add(boutonFermer);
62
		overlay.setVisible(true);
63
	}
64
 
65
	public void fermerFenetreModale() {
66
		RootPanel.get().remove(overlay);
67
		RootPanel.get().remove(overlayContenu);
68
	}
161 gduche 69
}