Subversion Repositories eFlore/Applications.del

Rev

Rev 197 | Rev 220 | 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;
197 gduche 21
 
161 gduche 22
	}
23
 
24
	// Afficheur
25
	public void go() {
26
		go(null);
27
	}
28
 
29
	public abstract void go(HasWidgets composite);
30
 
31
	// Gestion des évènements
32
	protected abstract void handleEvents();
33
 
34
	protected Composite getVue() {
35
		return this.vue;
36
	}
197 gduche 37
 
38
	public void ouvrirFenetreModale(Presenteur presenteurModal) {
39
 
40
		overlay = new HTMLPanel("");
41
		overlay.setStyleName("overlay");
42
		overlay.setVisible(false);
43
		RootPanel.get().add(overlay);
44
 
45
		overlayContenu = new HTMLPanel("");
46
		overlayContenu.setStyleName("overlayContenu");
47
 
48
		Button boutonFermer = new Button("Fermer");
49
		boutonFermer.setStyleName("fermerOverlay");
50
		boutonFermer.addClickHandler(new ClickHandler() {
51
 
52
			public void onClick(ClickEvent event) {
53
				fermerFenetreModale();
54
			}
55
		});
56
 
57
		presenteurModal.go(overlayContenu);
58
 
59
		RootPanel.get().add(overlayContenu);
60
		overlayContenu.setVisible(true);
61
 
62
		overlayContenu.add(boutonFermer);
63
		overlay.setVisible(true);
64
	}
65
 
66
	public void fermerFenetreModale() {
67
		RootPanel.get().remove(overlay);
68
		RootPanel.get().remove(overlayContenu);
69
	}
161 gduche 70
}