Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2627 Rev 2656
Line 5... Line 5...
5
import org.tela_botanica.client.observation.ObservationMediateur;
5
import org.tela_botanica.client.observation.ObservationMediateur;
Line 6... Line 6...
6
 
6
 
7
import com.google.gwt.user.client.DOM;
7
import com.google.gwt.user.client.DOM;
8
import com.google.gwt.user.client.Event;
8
import com.google.gwt.user.client.Event;
-
 
9
import com.google.gwt.user.client.Window;
9
import com.google.gwt.user.client.Window;
10
import com.google.gwt.user.client.ui.HTML;
10
import com.google.gwt.user.client.ui.Image;
11
import com.google.gwt.user.client.ui.Image;
11
import com.gwtext.client.widgets.Panel;
12
import com.gwtext.client.widgets.Panel;
Line 12... Line 13...
12
import com.gwtext.client.widgets.ToolTip;
13
import com.gwtext.client.widgets.ToolTip;
Line 24... Line 25...
24
	 */
25
	 */
25
	private Image image = new Image();
26
	private Image image = new Image();
Line 26... Line 27...
26
	
27
	
Line -... Line 28...
-
 
28
	private String urlImage = "" ;
-
 
29
	
27
	private String urlImage = "" ;
30
	private HTML htmlVide = new HTML();
Line 28... Line 31...
28
	
31
	
Line 29... Line 32...
29
	private ToolTip tp = new ToolTip("<div class=\"x-tooltip-help\"> " + Msg.get("double-clic-agrandir") + " </div>") ;
32
	private ToolTip tp = new ToolTip("<div class=\"x-tooltip-help\"> " + Msg.get("double-clic-agrandir") + " </div>") ;
Line 41... Line 44...
41
 
44
 
42
	/**
45
	/**
43
	 * Constructeur avec argument
46
	 * Constructeur avec argument
44
	 * @param obs le médiateur à associer
47
	 * @param obs le médiateur à associer
45
	 */
-
 
46
	
-
 
47
	
48
	 */
Line 48... Line 49...
48
	public InformationRepartitionVue(ObservationMediateur obs) {
49
	public InformationRepartitionVue(ObservationMediateur obs) {
49
		
50
		
Line 50... Line 51...
50
		imgZoom.setCloseAction(com.gwtext.client.widgets.Window.HIDE) ;
51
		imgZoom.setCloseAction(com.gwtext.client.widgets.Window.HIDE) ;
51
		image = new Image() {
52
		image = new Image() {
Line 52... Line 53...
52
 
53
 
53
			@Override
54
			@Override
54
			public void onBrowserEvent(Event event) {
-
 
55
 
55
			public void onBrowserEvent(Event event) {
56
				// lors du double clic
56
 
57
				if (Event.ONDBLCLICK == DOM.eventGetType(event)) {
57
				// lors du double clic
Line 58... Line 58...
58
 
58
				if (Event.ONDBLCLICK == DOM.eventGetType(event)) {
Line 72... Line 72...
72
		imgZoom.setAutoHeight(true) ;
72
		imgZoom.setAutoHeight(true) ;
73
		imgZoom.setAutoWidth(true) ;
73
		imgZoom.setAutoWidth(true) ;
Line 74... Line 74...
74
		
74
		
75
		this.setCls("x-image-info-rep") ;
75
		this.setCls("x-image-info-rep") ;
-
 
76
		add(image);
76
		add(image);
77
		add(htmlVide);
Line -... Line 78...
-
 
78
		image.setPixelSize(150, 150);
-
 
79
		
77
		image.setPixelSize(150, 150);
80
		afficherImageSinonAfficherMessage(false);
78
		
81
		
Line 79... Line 82...
79
		// on ajoute les listeners
82
		// on ajoute les listeners
80
		ajouterListeners();
83
		ajouterListeners();
-
 
84
 
-
 
85
	}
-
 
86
	
-
 
87
	private void afficherImageSinonAfficherMessage(boolean afficherImage) {
-
 
88
		if(afficherImage) {
-
 
89
			htmlVide.setVisible(false);
-
 
90
		} else {
-
 
91
			afficherHtmlVide();
-
 
92
		}
-
 
93
		image.setVisible(afficherImage);
-
 
94
	}
-
 
95
	
-
 
96
	private void afficherHtmlVide() {  
-
 
97
		String htmlDivVide = "<div class=\"aucune_image_pour\"> "+Msg.get("aucune-carte-taxon")+"</div>";
-
 
98
		htmlVide.setHeight("150px");
Line 81... Line 99...
81
 
99
		htmlVide.setHTML(htmlDivVide);
82
	}
100
		htmlVide.setVisible(true);
83
 
101
	}
84
 
102
 
Line 94... Line 112...
94
		if (nouvelleDonnees instanceof String) {
112
		if (nouvelleDonnees instanceof String) {
Line 95... Line 113...
95
			
113
			
Line 96... Line 114...
96
			urlImage=(String) nouvelleDonnees;
114
			urlImage=(String) nouvelleDonnees;
97
			
-
 
98
			if (urlImage == null || urlImage.equals("null") || urlImage.length()==0) {
115
			
99
				image.setUrl("ill_choro.png") ;
116
			if (urlImage == null || urlImage.equals("null") || urlImage.length()==0) {
100
				image.setPixelSize(150, 150);
117
				afficherImageSinonAfficherMessage(false);
-
 
118
			}
101
			}
119
			else {
102
			else {
120
				afficherImageSinonAfficherMessage(true);
103
				image.setUrl(urlImage);
121
				image.setUrl(urlImage);
104
				verifierEtRetaillerImage();
122
				verifierEtRetaillerImage();
Line 109... Line 127...
109
	
127
	
Line 110... Line 128...
110
	public void agrandirImage() {
128
	public void agrandirImage() {
111
		
129
		
112
		if(!imgZoom.isVisible())
130
		if(!imgZoom.isVisible())
113
		{
-
 
114
			String urlAgrandie = urlImage.replace("min", "max") ;
131
		{
115
	
132
			String urlAgrandie = urlImage.replace("min", "max");
116
			imgZoom.setHtml("<img height="+Window.getClientHeight()*0.75+"px src=\""+urlAgrandie+"\" />") ;
133
			imgZoom.setHtml("<img height="+Window.getClientHeight()*0.75+"px src=\""+urlAgrandie+"\" />") ;
117
			imgZoom.setPagePosition( Window.getClientWidth()/2, Window.getClientHeight()/5) ;
134
			imgZoom.setPagePosition( Window.getClientWidth()/2, Window.getClientHeight()/5) ;
118
			imgZoom.show(this.getElement()) ;
135
			imgZoom.show(this.getElement()) ;