Subversion Repositories eFlore/Applications.del

Rev

Rev 186 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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