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