Subversion Repositories eFlore/Applications.cel

Rev

Rev 84 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 84 Rev 97
Line 1... Line 1...
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
Line 2... Line 2...
2
 
2
 
3
import org.tela_botanica.client.interfaces.Rafraichissable;
3
import org.tela_botanica.client.interfaces.Rafraichissable;
Line -... Line 4...
-
 
4
import org.tela_botanica.client.observation.ObservationMediateur;
-
 
5
 
-
 
6
import com.google.gwt.user.client.DOM;
4
import org.tela_botanica.client.observation.ObservationMediateur;
7
import com.google.gwt.user.client.Event;
5
 
8
import com.google.gwt.user.client.Window;
-
 
9
import com.google.gwt.user.client.ui.Image;
Line 6... Line 10...
6
import com.google.gwt.user.client.ui.Image;
10
import com.gwtext.client.widgets.Panel;
7
import com.gwtext.client.widgets.Panel;
11
import com.gwtext.client.widgets.Window.CloseAction;
8
 
12
 
9
/**
13
/**
Line 24... Line 28...
24
	/**
28
	/**
25
	 * l'image à afficher
29
	 * l'image à afficher
26
	 */
30
	 */
27
	private Image image = new Image();
31
	private Image image = new Image();
Line -... Line 32...
-
 
32
	
-
 
33
	private String urlImage = "" ;
-
 
34
	
-
 
35
	private com.gwtext.client.widgets.Window imgZoom = new com.gwtext.client.widgets.Window("Agrandissement") ;
Line 28... Line 36...
28
	
36
	
29
	
37
	
30
	/**
38
	/**
Line 44... Line 52...
44
	
52
	
Line 45... Line 53...
45
	public ImageGeneriqueVue(ObservationMediateur obs) {
53
	public ImageGeneriqueVue(ObservationMediateur obs) {
-
 
54
		
-
 
55
			
46
		
56
		this.observationMediateur = obs;
-
 
57
		imgZoom.setCloseAction(com.gwtext.client.widgets.Window.HIDE) ;
-
 
58
		image = new Image() {
-
 
59
 
-
 
60
			public void onBrowserEvent(Event event) {
-
 
61
 
-
 
62
				// lors du double clic
-
 
63
				if (Event.ONDBLCLICK == DOM.eventGetType(event)) {
-
 
64
 
-
 
65
					// on notifie le médiateur
-
 
66
					agrandirImage() ;
-
 
67
				}
-
 
68
			}
-
 
69
			
-
 
70
		};
47
			
71
		
48
		this.observationMediateur = obs;
72
		
Line -... Line 73...
-
 
73
		this.setCls("x-image-gen") ;
-
 
74
		image.setPixelSize(150, 150);
49
	
75
		add(image);
50
		image.setPixelSize(150, 150);
76
		
Line 51... Line 77...
51
		add(image);
77
		image.sinkEvents(Event.ONDBLCLICK);
Line 64... Line 90...
64
	public void rafraichir(Object nouvelleDonnees,boolean repandreRaffraichissement) {
90
	public void rafraichir(Object nouvelleDonnees,boolean repandreRaffraichissement) {
Line 65... Line 91...
65
 
91
 
66
		// si on recoit une String contenant une URL
92
		// si on recoit une String contenant une URL
Line 67... Line 93...
67
		if (nouvelleDonnees instanceof String) {
93
		if (nouvelleDonnees instanceof String) {
Line 68... Line 94...
68
			
94
			
69
			String urlImage=(String) nouvelleDonnees;
95
			urlImage=(String) nouvelleDonnees;
70
			
96
			
71
			if (urlImage.length()==0) {
97
			if (urlImage.length()==0) {
Line 77... Line 103...
77
		}
103
		}
Line 78... Line 104...
78
		
104
		
Line 79... Line 105...
79
		observationMediateur.deMasquerChargementInfosObservations() ;
105
		observationMediateur.deMasquerChargementInfosObservations() ;
-
 
106
				
-
 
107
	}
-
 
108
	
-
 
109
	public void agrandirImage() {
-
 
110
		
-
 
111
		if(!imgZoom.isVisible())
-
 
112
		{
-
 
113
			String urlAgrandie = urlImage.replace("min", "max") ;
-
 
114
			imgZoom.setHtml("<img src=\""+urlAgrandie+"\" />") ;
-
 
115
			imgZoom.setPagePosition( Window.getClientWidth()/2, Window.getClientHeight()/5) ;
-
 
116
			imgZoom.setAutoHeight(true) ;
-
 
117
			imgZoom.setAutoWidth(true) ;
-
 
118
			imgZoom.show(this.getElement()) ;
-
 
119
		}
-
 
120
 
Line 80... Line 121...
80
				
121
		
81
	}
122
	}
82
 
123