| 4 |
aperonnet |
1 |
package org.tela_botanica.client.vues;
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
import org.tela_botanica.client.image.ImageMediateur;
|
|
|
5 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
6 |
|
|
|
7 |
|
| 5 |
aperonnet |
8 |
import com.google.gwt.user.client.DOM;
|
|
|
9 |
import com.google.gwt.user.client.Event;
|
|
|
10 |
import com.google.gwt.user.client.Window;
|
|
|
11 |
import com.google.gwt.user.client.ui.ClickListener;
|
| 4 |
aperonnet |
12 |
import com.google.gwt.user.client.ui.Image;
|
| 5 |
aperonnet |
13 |
import com.google.gwt.user.client.ui.Widget;
|
| 4 |
aperonnet |
14 |
import com.gwtext.client.core.RegionPosition;
|
|
|
15 |
import com.gwtext.client.widgets.Button;
|
|
|
16 |
import com.gwtext.client.widgets.Panel;
|
|
|
17 |
import com.gwtext.client.widgets.layout.BorderLayout;
|
|
|
18 |
import com.gwtext.client.widgets.layout.BorderLayoutData;
|
|
|
19 |
|
|
|
20 |
public class ZoomImageVue extends Panel implements Rafraichissable {
|
|
|
21 |
|
|
|
22 |
private ImageMediateur iMediateur = null ;
|
|
|
23 |
private Image image = null ;
|
|
|
24 |
private final com.google.gwt.user.client.ui.Button prev = new com.google.gwt.user.client.ui.Button("<");
|
|
|
25 |
private final com.google.gwt.user.client.ui.Button suiv = new com.google.gwt.user.client.ui.Button(">");
|
|
|
26 |
|
|
|
27 |
public ZoomImageVue(ImageMediateur im)
|
|
|
28 |
{
|
|
|
29 |
super("Zoom");
|
|
|
30 |
|
|
|
31 |
iMediateur = im ;
|
| 5 |
aperonnet |
32 |
image = new Image() {
|
|
|
33 |
public void onBrowserEvent(Event event) {
|
|
|
34 |
if (Event.ONDBLCLICK == DOM.eventGetType(event)) {
|
|
|
35 |
|
|
|
36 |
getIMediateur().DoubleClicZoomImage();
|
|
|
37 |
}
|
|
|
38 |
}
|
|
|
39 |
};
|
|
|
40 |
|
|
|
41 |
image.sinkEvents(Event.ONDBLCLICK);
|
| 4 |
aperonnet |
42 |
|
| 5 |
aperonnet |
43 |
image.setUrl("image/vide.jpg");
|
|
|
44 |
|
| 4 |
aperonnet |
45 |
this.setLayout(new BorderLayout());
|
|
|
46 |
|
|
|
47 |
prev.setWidth("5%");
|
|
|
48 |
suiv.setWidth("5%");
|
|
|
49 |
|
|
|
50 |
this.add(prev,new BorderLayoutData(RegionPosition.WEST));
|
|
|
51 |
this.add(image,new BorderLayoutData(RegionPosition.CENTER));
|
|
|
52 |
this.add(suiv,new BorderLayoutData(RegionPosition.EAST));
|
| 5 |
aperonnet |
53 |
|
|
|
54 |
ajouterListenersBoutons();
|
| 4 |
aperonnet |
55 |
}
|
|
|
56 |
|
|
|
57 |
|
|
|
58 |
public void rafraichir(Object nouvelleDonnees) {
|
|
|
59 |
|
| 5 |
aperonnet |
60 |
if(nouvelleDonnees instanceof String)
|
|
|
61 |
{
|
|
|
62 |
getImage().setUrl((String)nouvelleDonnees);
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
|
| 4 |
aperonnet |
66 |
}
|
| 5 |
aperonnet |
67 |
|
|
|
68 |
public void ajouterListenersBoutons()
|
|
|
69 |
{
|
|
|
70 |
prev.addClickListener(new ClickListener() {
|
| 4 |
aperonnet |
71 |
|
| 5 |
aperonnet |
72 |
public void onClick(Widget sender) {
|
|
|
73 |
|
|
|
74 |
getIMediateur().ClicBoutonZoomImage("prev");
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
});
|
|
|
78 |
|
|
|
79 |
suiv.addClickListener(new ClickListener() {
|
|
|
80 |
|
|
|
81 |
public void onClick(Widget sender) {
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
getIMediateur().ClicBoutonZoomImage("suiv");
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
});
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
public ImageMediateur getIMediateur() {
|
|
|
92 |
return iMediateur;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
public Image getImage() {
|
|
|
97 |
return image;
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
public com.google.gwt.user.client.ui.Button getPrev() {
|
|
|
102 |
return prev;
|
|
|
103 |
}
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
public com.google.gwt.user.client.ui.Button getSuiv() {
|
|
|
107 |
return suiv;
|
|
|
108 |
}
|
|
|
109 |
|
| 4 |
aperonnet |
110 |
}
|