Subversion Repositories eFlore/Applications.del

Rev

Rev 172 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 172 Rev 186
1
package org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition;
1
package org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition;
2
 
2
 
3
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesVue;
3
import org.tela_botanica.del.client.vues.plateformedetermination.vote.EnsembleVotesVue;
4
 
4
 
5
import com.google.gwt.core.client.GWT;
5
import com.google.gwt.core.client.GWT;
6
import com.google.gwt.uibinder.client.UiBinder;
6
import com.google.gwt.uibinder.client.UiBinder;
7
import com.google.gwt.uibinder.client.UiField;
7
import com.google.gwt.uibinder.client.UiField;
8
import com.google.gwt.user.client.Window;
8
import com.google.gwt.user.client.Window;
9
import com.google.gwt.user.client.ui.Composite;
9
import com.google.gwt.user.client.ui.Composite;
10
import com.google.gwt.user.client.ui.HTML;
10
import com.google.gwt.user.client.ui.HTML;
-
 
11
import com.google.gwt.user.client.ui.IsWidget;
-
 
12
import com.google.gwt.user.client.ui.PushButton;
11
import com.google.gwt.user.client.ui.Widget;
13
import com.google.gwt.user.client.ui.Widget;
12
 
14
 
13
public class BarreRepartitionVoteVue extends Composite {
15
public class BarreRepartitionVoteVue extends Composite implements IsWidget {
14
	
16
	
15
	interface MyUiBinder extends UiBinder<Widget, BarreRepartitionVoteVue> {}
17
	interface MyUiBinder extends UiBinder<Widget, BarreRepartitionVoteVue> {}
16
 
18
 
17
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
19
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
18
	
20
	
19
	private int pourcentage = -1;
21
	private int pourcentage = -1;
20
	
22
	
21
	private int tailleBarre = 0;
23
	private int tailleBarre = 0;
22
	
24
	
-
 
25
	private String nomTaxon = "";
-
 
26
	
-
 
27
	@UiField(provided = true)
-
 
28
	public PushButton boutonOui = new PushButton("+");
-
 
29
	
-
 
30
	@UiField(provided = true)
23
	private String NomTaxon = "";
31
	public PushButton boutonNon = new PushButton("-");
24
	
32
	
25
	@UiField(provided = true)
33
	@UiField(provided = true)
26
	public HTML barreRepartitionHtmlBrut = new HTML("<div class=\"barreRepartition\"></div>");
34
	public HTML barreRepartitionHtmlBrut = new HTML("<div class=\"barreRepartition\"></div>");
27
	
35
	
28
	public BarreRepartitionVoteVue() {
36
	public BarreRepartitionVoteVue() {
29
		initWidget(uiBinder.createAndBindUi(this));
37
		initWidget(uiBinder.createAndBindUi(this));
-
 
38
		boutonNon.setWidth("20px");
-
 
39
		boutonOui.setWidth("20px");
30
	}
40
	}
31
	
41
	
32
	public void afficherVotes(int pourcentage, String NomTaxon) {
42
	public void afficherVotes(int pourcentage, String NomTaxon) {
33
		
43
		
34
		this.pourcentage = pourcentage;
44
		this.pourcentage = pourcentage;
35
		this.NomTaxon = NomTaxon;
45
		this.nomTaxon = NomTaxon;
36
		
46
		
37
		tailleBarre = (pourcentage > -1) ? pourcentage : 0;
47
		tailleBarre = (pourcentage > -1) ? pourcentage : 0;
38
		
48
		
39
		String classe = "barreRepartition";
49
		String classe = "barreRepartition";
40
		if(pourcentage == -1) {
50
		if(pourcentage == -1) {
41
			classe = "barreRepartitionAucunVote";
51
			classe = "barreRepartitionAucunVote";
42
		}
52
		}
43
		
53
		
44
		String chaineHtml = "<div class=\"conteneurBarreRepartition\">" +
54
		String chaineHtml = "<div class=\"conteneurBarreRepartition\">" +
45
							"<div class=\""+classe+"\">"+
55
							"<div class=\""+classe+"\">"+
46
							"<div style=\"width:"+tailleBarre+"%\" class=\"elementBarreRepartition voteOui\"></div>"+
56
							"<div style=\"width:"+tailleBarre+"%\" class=\"elementBarreRepartition voteOui\"></div>"+
47
							"</div>"+
57
							"</div>"+
48
							"<span class=\"nomTaxonBarreRepartition\">"+NomTaxon+"</span>"+
58
							"<span class=\"nomTaxonBarreRepartition\">"+nomTaxon+"</span>"+
49
							"</div>";
59
							"</div>";
50
		barreRepartitionHtmlBrut.setHTML(chaineHtml);	
60
		barreRepartitionHtmlBrut.setHTML(chaineHtml);
51
	}
61
	}
52
	
62
	
53
	public HTML getBarreRepartitionHtmlBrut() {
63
	public HTML getBarreRepartitionHtmlBrut() {
54
		return barreRepartitionHtmlBrut;
64
		return barreRepartitionHtmlBrut;
55
	}
65
	}
-
 
66
	
-
 
67
	public PushButton getBoutonOui() {
-
 
68
		return boutonOui;
-
 
69
	}
-
 
70
	
-
 
71
	public PushButton getBoutonNon() {
-
 
72
		return boutonNon;
-
 
73
	}
56
 
74
 
57
}
75
}