Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1005 Rev 1026
1
package org.tela_botanica.del.client.composants.votes.barrerepartition;
1
package org.tela_botanica.del.client.composants.votes.barrerepartition;
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.event.dom.client.HasClickHandlers;
5
import com.google.gwt.uibinder.client.UiBinder;
5
import com.google.gwt.uibinder.client.UiBinder;
6
import com.google.gwt.uibinder.client.UiField;
6
import com.google.gwt.uibinder.client.UiField;
7
import com.google.gwt.user.client.ui.Composite;
7
import com.google.gwt.user.client.ui.Composite;
8
import com.google.gwt.user.client.ui.Label;
8
import com.google.gwt.user.client.ui.Label;
9
import com.google.gwt.user.client.ui.Panel;
9
import com.google.gwt.user.client.ui.Panel;
10
import com.google.gwt.user.client.ui.PushButton;
10
import com.google.gwt.user.client.ui.PushButton;
11
import com.google.gwt.user.client.ui.Widget;
11
import com.google.gwt.user.client.ui.Widget;
12
 
12
 
13
public class BarreRepartitionVoteVue extends Composite implements BarreRepartitionVotePresenteur.Vue {
13
public class BarreRepartitionVoteVue extends Composite implements BarreRepartitionVotePresenteur.Vue {
14
 
14
 
15
	interface MyUiBinder extends UiBinder<Widget, BarreRepartitionVoteVue> {
15
	interface MyUiBinder extends UiBinder<Widget, BarreRepartitionVoteVue> {
16
	}
16
	}
17
 
17
 
18
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
18
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
19
	private InfoBulleAnim animerVotePrisEnCompte;
19
	private InfoBulleAnim animerVotePrisEnCompte;
20
	private InfoBulleAnim animerVoteModifie;
20
	private InfoBulleAnim animerVoteModifie;
21
 
21
 
22
	@UiField
22
	@UiField
23
	Label nomTaxon;
23
	Label nomTaxon, pourcentage;
24
	@UiField
24
	@UiField
25
	Panel barreOui, barreNon, votePrisEnCompte, voteModifie;
25
	Panel barreOui, barreNon, votePrisEnCompte, voteModifie;
26
	@UiField
26
	@UiField
27
	PushButton boutonOui, boutonNon;
27
	PushButton boutonOui, boutonNon;
28
 
28
 
29
	public BarreRepartitionVoteVue() {
29
	public BarreRepartitionVoteVue() {
30
		initWidget(uiBinder.createAndBindUi(this));
30
		initWidget(uiBinder.createAndBindUi(this));
31
		votePrisEnCompte.setVisible(false);
31
		votePrisEnCompte.setVisible(false);
32
		voteModifie.setVisible(false);
32
		voteModifie.setVisible(false);
33
		animerVotePrisEnCompte = new InfoBulleAnim(votePrisEnCompte);
33
		animerVotePrisEnCompte = new InfoBulleAnim(votePrisEnCompte);
34
		animerVoteModifie = new InfoBulleAnim(voteModifie);
34
		animerVoteModifie = new InfoBulleAnim(voteModifie);
35
	}
35
	}
36
 
36
 
37
	@Override
37
	@Override
38
	public void afficherVotes(int pourcentage, String nomTaxon) {
38
	public void afficherVotes(int pourcentage, String nomTaxon) {
39
		this.nomTaxon.setText(nomTaxon);
39
		this.nomTaxon.setText(nomTaxon);
40
		this.nomTaxon.setTitle(nomTaxon);
40
		this.nomTaxon.setTitle(nomTaxon);
41
 
41
 
42
		if (pourcentage > -1) {
42
		if (pourcentage > -1) {
43
 
43
 
44
			int pourcentageNon = 100 - pourcentage;
44
			int pourcentageNon = 100 - pourcentage;
45
			barreOui.setWidth(pourcentage + "%");
45
			barreOui.setWidth(pourcentage + "%");
46
			barreNon.setWidth(pourcentageNon + "%");
46
			barreNon.setWidth(pourcentageNon + "%");
47
		} else {
47
		} else {
48
			barreNon.setWidth("0px");
48
			barreNon.setWidth("0px");
49
			barreOui.setWidth("0px");
49
			barreOui.setWidth("0px");
50
		}
50
		}
51
	}
51
	}
52
 
52
 
53
	@Override
53
	@Override
54
	public HasClickHandlers getBoutonOui() {
54
	public HasClickHandlers getBoutonOui() {
55
		return boutonOui;
55
		return boutonOui;
56
	}
56
	}
57
 
57
 
58
	@Override
58
	@Override
59
	public HasClickHandlers getBoutonNon() {
59
	public HasClickHandlers getBoutonNon() {
60
		return boutonNon;
60
		return boutonNon;
61
	}
61
	}
62
 
62
 
63
	@Override
63
	@Override
64
	public void setVoteOuiEffectue() {
64
	public void setVoteOuiEffectue() {
65
		boutonOui.setEnabled(false);
65
		boutonOui.setEnabled(false);
66
		boutonOui.addStyleName("boutonVoteDesactive");
66
		boutonOui.addStyleName("boutonVoteDesactive");
67
		boutonNon.setEnabled(true);
67
		boutonNon.setEnabled(true);
68
		boutonNon.removeStyleName("boutonVoteDesactive");
68
		boutonNon.removeStyleName("boutonVoteDesactive");
69
	}
69
	}
70
 
70
 
71
	@Override
71
	@Override
72
	public void setVoteNonEffectue() {
72
	public void setVoteNonEffectue() {
73
		boutonOui.setEnabled(true);
73
		boutonOui.setEnabled(true);
74
		boutonOui.removeStyleName("boutonVoteDesactive");
74
		boutonOui.removeStyleName("boutonVoteDesactive");
75
		boutonNon.setEnabled(false);
75
		boutonNon.setEnabled(false);
76
		boutonNon.addStyleName("boutonVoteDesactive");
76
		boutonNon.addStyleName("boutonVoteDesactive");
77
	}
77
	}
78
 
78
 
79
	@Override
79
	@Override
80
	public void afficherVotePrisEnCompte(boolean voteOui) {
80
	public void afficherVotePrisEnCompte(boolean voteOui) {
81
		if (voteOui) {
81
		if (voteOui) {
82
			votePrisEnCompte.removeStyleName("votePrisEnCompteNon");
82
			votePrisEnCompte.removeStyleName("votePrisEnCompteNon");
83
			votePrisEnCompte.setStyleName("votePrisEnCompteOui");
83
			votePrisEnCompte.setStyleName("votePrisEnCompteOui");
84
		} else {
84
		} else {
85
			votePrisEnCompte.removeStyleName("votePrisEnCompteOui");
85
			votePrisEnCompte.removeStyleName("votePrisEnCompteOui");
86
			votePrisEnCompte.setStyleName("votePrisEnCompteNon");
86
			votePrisEnCompte.setStyleName("votePrisEnCompteNon");
87
		}
87
		}
88
		animerVotePrisEnCompte.run(2000);
88
		animerVotePrisEnCompte.run(2000);
89
	}
89
	}
90
 
90
 
91
	public void afficherVoteModifie(boolean voteOui) {
91
	public void afficherVoteModifie(boolean voteOui) {
92
		if (voteOui) {
92
		if (voteOui) {
93
			voteModifie.removeStyleName("votePrisEnCompteNon");
93
			voteModifie.removeStyleName("votePrisEnCompteNon");
94
			voteModifie.setStyleName("votePrisEnCompteOui");
94
			voteModifie.setStyleName("votePrisEnCompteOui");
95
		} else {
95
		} else {
96
			voteModifie.removeStyleName("votePrisEnCompteOui");
96
			voteModifie.removeStyleName("votePrisEnCompteOui");
97
			voteModifie.setStyleName("votePrisEnCompteNon");
97
			voteModifie.setStyleName("votePrisEnCompteNon");
98
		}
98
		}
99
		animerVoteModifie.run(2000);
99
		animerVoteModifie.run(2000);
100
	}
100
	}
101
 
101
 
102
	@Override
102
	@Override
103
	public void desactiverBoutons() {
103
	public void desactiverBoutons() {
104
		boutonNon.setEnabled(false);
104
		boutonNon.setEnabled(false);
105
		boutonOui.setEnabled(false);
105
		boutonOui.setEnabled(false);
106
	}
106
	}
107
 
107
 
108
	@Override
108
	@Override
109
	public void activerBoutons() {
109
	public void activerBoutons() {
110
		boutonNon.setEnabled(true);
110
		boutonNon.setEnabled(true);
111
		boutonOui.setEnabled(true);
111
		boutonOui.setEnabled(true);
112
	}
112
	}
113
 
113
 
114
	@Override
114
	@Override
115
	public void toggleNomEspece() {
115
	public void toggleNomEspece() {
116
		nomTaxon.setVisible(!nomTaxon.isVisible());
116
		nomTaxon.setVisible(!nomTaxon.isVisible());
117
	}
117
	}
-
 
118
	
-
 
119
	@Override
-
 
120
	public void setPourcentage(int pourcentage) {
-
 
121
		this.pourcentage.setText(String.valueOf(pourcentage) + "%");
-
 
122
	}
118
}
123
}