Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1004 Rev 1005
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;
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
		boutonNon.setEnabled(true);
67
		boutonNon.setEnabled(true);
-
 
68
		boutonNon.removeStyleName("boutonVoteDesactive");
67
	}
69
	}
68
 
70
 
69
	@Override
71
	@Override
70
	public void setVoteNonEffectue() {
72
	public void setVoteNonEffectue() {
71
		boutonOui.setEnabled(true);
73
		boutonOui.setEnabled(true);
-
 
74
		boutonOui.removeStyleName("boutonVoteDesactive");
72
		boutonNon.setEnabled(false);
75
		boutonNon.setEnabled(false);
-
 
76
		boutonNon.addStyleName("boutonVoteDesactive");
73
	}
77
	}
74
 
78
 
75
	@Override
79
	@Override
76
	public void afficherVotePrisEnCompte(boolean voteOui) {
80
	public void afficherVotePrisEnCompte(boolean voteOui) {
77
		if (voteOui) {
81
		if (voteOui) {
78
			votePrisEnCompte.removeStyleName("votePrisEnCompteNon");
82
			votePrisEnCompte.removeStyleName("votePrisEnCompteNon");
79
			votePrisEnCompte.setStyleName("votePrisEnCompteOui");
83
			votePrisEnCompte.setStyleName("votePrisEnCompteOui");
80
		} else {
84
		} else {
81
			votePrisEnCompte.removeStyleName("votePrisEnCompteOui");
85
			votePrisEnCompte.removeStyleName("votePrisEnCompteOui");
82
			votePrisEnCompte.setStyleName("votePrisEnCompteNon");
86
			votePrisEnCompte.setStyleName("votePrisEnCompteNon");
83
		}
87
		}
84
		animerVotePrisEnCompte.run(2000);
88
		animerVotePrisEnCompte.run(2000);
85
	}
89
	}
86
 
90
 
87
	public void afficherVoteModifie(boolean voteOui) {
91
	public void afficherVoteModifie(boolean voteOui) {
88
		if (voteOui) {
92
		if (voteOui) {
89
			voteModifie.removeStyleName("votePrisEnCompteNon");
93
			voteModifie.removeStyleName("votePrisEnCompteNon");
90
			voteModifie.setStyleName("votePrisEnCompteOui");
94
			voteModifie.setStyleName("votePrisEnCompteOui");
91
		} else {
95
		} else {
92
			voteModifie.removeStyleName("votePrisEnCompteOui");
96
			voteModifie.removeStyleName("votePrisEnCompteOui");
93
			voteModifie.setStyleName("votePrisEnCompteNon");
97
			voteModifie.setStyleName("votePrisEnCompteNon");
94
		}
98
		}
95
		animerVoteModifie.run(2000);
99
		animerVoteModifie.run(2000);
96
	}
100
	}
97
 
101
 
98
	@Override
102
	@Override
99
	public void desactiverBoutons() {
103
	public void desactiverBoutons() {
100
		boutonNon.setEnabled(false);
104
		boutonNon.setEnabled(false);
101
		boutonOui.setEnabled(false);
105
		boutonOui.setEnabled(false);
102
	}
106
	}
103
 
107
 
104
	@Override
108
	@Override
105
	public void activerBoutons() {
109
	public void activerBoutons() {
106
		boutonNon.setEnabled(true);
110
		boutonNon.setEnabled(true);
107
		boutonOui.setEnabled(true);
111
		boutonOui.setEnabled(true);
108
	}
112
	}
109
 
113
 
110
	@Override
114
	@Override
111
	public void toggleNomEspece() {
115
	public void toggleNomEspece() {
112
		nomTaxon.setVisible(!nomTaxon.isVisible());
116
		nomTaxon.setVisible(!nomTaxon.isVisible());
113
	}
117
	}
114
}
118
}