Subversion Repositories eFlore/Applications.cel

Rev

Rev 84 | Rev 99 | 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;
-
 
8
import com.google.gwt.user.client.Window;
5
 
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.core.Ext;
7
import com.gwtext.client.widgets.Panel;
11
import com.gwtext.client.widgets.Panel;
8
 
12
 
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
	
Line 28... Line 35...
28
	
35
	com.gwtext.client.widgets.Window imgZoom = new com.gwtext.client.widgets.Window("Agrandissement") ;
29
	
36
	
30
	/**
37
	/**
Line 45... Line 52...
45
	public InformationRepartitionVue(ObservationMediateur obs) {
52
	public InformationRepartitionVue(ObservationMediateur obs) {
Line 46... Line 53...
46
		
53
		
Line -... Line 54...
-
 
54
			
-
 
55
		this.observationMediateur = obs;
-
 
56
		
-
 
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
		};
-
 
71
		
47
			
72
		image.sinkEvents(Event.ONDBLCLICK);
48
		this.observationMediateur = obs;
73
		
Line 49... Line 74...
49
		
74
		this.setCls("x-image-info-rep") ;
50
		image.setPixelSize(150, 150);
75
		image.setPixelSize(150, 150);
Line 64... Line 89...
64
	public void rafraichir(Object nouvelleDonnees,boolean repandreRaffraichissement) {
89
	public void rafraichir(Object nouvelleDonnees,boolean repandreRaffraichissement) {
Line 65... Line 90...
65
 
90
 
66
		// si on recoit une String contenant une URL
91
		// si on recoit une String contenant une URL
Line 67... Line 92...
67
		if (nouvelleDonnees instanceof String) {
92
		if (nouvelleDonnees instanceof String) {
Line 68... Line 93...
68
			
93
			
69
			String urlImage=(String) nouvelleDonnees;
94
			urlImage=(String) nouvelleDonnees;
70
			
95
			
71
			if (urlImage.length()==0) {
96
			if (urlImage.length()==0) {
72
				raz() ;
97
				raz() ;
73
			}
98
			}
74
			else {
99
			else {
Line 75... Line 100...
75
				image.setUrl(urlImage);
100
				image.setUrl(urlImage);
-
 
101
			}
-
 
102
		}
-
 
103
				
-
 
104
	}
-
 
105
	
-
 
106
	public void agrandirImage() {
-
 
107
		
-
 
108
		if(!imgZoom.isVisible())
-
 
109
		{
-
 
110
			String urlAgrandie = urlImage.replace("min", "max") ;
-
 
111
	
-
 
112
			imgZoom.setHtml("<img src=\""+urlAgrandie+"\" />") ;
-
 
113
			imgZoom.setPagePosition( Window.getClientWidth()/2, Window.getClientHeight()/5) ;
-
 
114
			imgZoom.setAutoHeight(true) ;
-
 
115
			imgZoom.setAutoWidth(true) ;
Line 76... Line 116...
76
			}
116
			imgZoom.show(this.getElement()) ;
77
		}
117
		}
78
				
118