Subversion Repositories eFlore/Applications.del

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1162 aurelien 1
package org.tela_botanica.del.client.composants.motsclesimages.motcle;
2
 
3
import com.google.gwt.event.dom.client.BlurEvent;
4
import com.google.gwt.event.dom.client.BlurHandler;
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.FocusEvent;
8
import com.google.gwt.event.dom.client.FocusHandler;
9
import com.google.gwt.event.dom.client.HasBlurHandlers;
10
import com.google.gwt.event.dom.client.HasClickHandlers;
11
import com.google.gwt.event.dom.client.HasFocusHandlers;
12
import com.google.gwt.event.dom.client.HasMouseOutHandlers;
13
import com.google.gwt.event.dom.client.HasMouseOverHandlers;
14
import com.google.gwt.event.dom.client.MouseOutEvent;
15
import com.google.gwt.event.dom.client.MouseOutHandler;
16
import com.google.gwt.event.dom.client.MouseOverEvent;
17
import com.google.gwt.event.dom.client.MouseOverHandler;
18
import com.google.gwt.user.client.Window;
19
import com.google.gwt.user.client.ui.HasWidgets;
20
import com.google.gwt.user.client.ui.IsWidget;
21
 
22
public abstract class MotClePresenteur {
23
 
24
	String motCle;
25
	String idMotCle;
26
 
27
	public interface Vue extends IsWidget {
28
		HasClickHandlers getZoneSuppressionMotCle();
29
		void afficherZoneSuppression();
30
		void cacherZoneSuppression();
31
		HasMouseOverHandlers getZoneMotCleMouseHover();
32
		HasMouseOutHandlers getZoneMotCleMouseOut();
33
	}
34
 
35
	private Vue vue;
36
 
37
	public MotClePresenteur(Vue vue, String motCleText, String motCleId) {
38
		this.vue = vue;
39
		this.idMotCle = motCleId;
40
	}
41
 
42
	public void go(HasWidgets composite) {
43
		composite.add(vue.asWidget());
44
		gererEvenements();
45
	}
46
 
47
	public void gererEvenements() {
48
		vue.getZoneSuppressionMotCle().addClickHandler(new ClickHandler() {
49
			@Override
50
			public void onClick(ClickEvent event) {
51
				surSuppression(idMotCle);
52
			}
53
		});
54
 
55
		vue.getZoneMotCleMouseHover().addMouseOverHandler(new MouseOverHandler() {
56
			@Override
57
			public void onMouseOver(MouseOverEvent event) {
58
				vue.afficherZoneSuppression();
59
			}
60
		});
61
 
62
		vue.getZoneMotCleMouseOut().addMouseOutHandler(new MouseOutHandler() {
63
			@Override
64
			public void onMouseOut(MouseOutEvent event) {
65
				vue.cacherZoneSuppression();
66
			}
67
		});
68
	}
69
 
70
	public abstract void surSuppression(String idMotCle);
71
}