Subversion Repositories eFlore/Applications.del

Rev

Rev 172 | Rev 206 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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