Subversion Repositories eFlore/Applications.del

Rev

Rev 336 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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