Subversion Repositories eFlore/Applications.del

Rev

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

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