4,8 → 4,6 |
import com.google.gwt.event.dom.client.HasClickHandlers; |
import com.google.gwt.uibinder.client.UiBinder; |
import com.google.gwt.uibinder.client.UiField; |
import com.google.gwt.user.client.Element; |
import com.google.gwt.user.client.Window; |
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.Label; |
import com.google.gwt.user.client.ui.Panel; |
13,29 → 11,37 |
import com.google.gwt.user.client.ui.Widget; |
|
public class BarreRepartitionVoteVue extends Composite implements BarreRepartitionVotePresenteur.Vue { |
|
interface MyUiBinder extends UiBinder<Widget, BarreRepartitionVoteVue> {} |
|
interface MyUiBinder extends UiBinder<Widget, BarreRepartitionVoteVue> { |
} |
|
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class); |
private InfoBulleAnim animer; |
|
@UiField Label nomTaxon; |
@UiField Panel barreOui, barreNon, votePrisEnCompte; |
@UiField PushButton boutonOui, boutonNon; |
|
private InfoBulleAnim animerVotePrisEnCompte; |
private InfoBulleAnim animerVoteModifie; |
|
@UiField |
Label nomTaxon; |
@UiField |
Panel barreOui, barreNon, votePrisEnCompte, voteModifie; |
@UiField |
PushButton boutonOui, boutonNon; |
|
public BarreRepartitionVoteVue() { |
initWidget(uiBinder.createAndBindUi(this)); |
votePrisEnCompte.setVisible(false); |
animer = new InfoBulleAnim(votePrisEnCompte); |
voteModifie.setVisible(false); |
animerVotePrisEnCompte = new InfoBulleAnim(votePrisEnCompte); |
animerVoteModifie = new InfoBulleAnim(voteModifie); |
} |
|
|
@Override |
public void afficherVotes(int pourcentage, String nomTaxon) { |
this.nomTaxon.setText(nomTaxon); |
this.nomTaxon.setTitle(nomTaxon); |
|
|
if (pourcentage > -1) { |
|
int pourcentageNon = 100-pourcentage; |
|
int pourcentageNon = 100 - pourcentage; |
barreOui.setWidth(pourcentage + "%"); |
barreNon.setWidth(pourcentageNon + "%"); |
} else { |
43,12 → 49,12 |
barreOui.setWidth("0px"); |
} |
} |
|
|
@Override |
public HasClickHandlers getBoutonOui() { |
return boutonOui; |
} |
|
|
@Override |
public HasClickHandlers getBoutonNon() { |
return boutonNon; |
68,7 → 74,7 |
|
@Override |
public void afficherVotePrisEnCompte(boolean voteOui) { |
if (voteOui) { |
if (voteOui) { |
votePrisEnCompte.removeStyleName("votePrisEnCompteNon"); |
votePrisEnCompte.setStyleName("votePrisEnCompteOui"); |
} else { |
75,9 → 81,20 |
votePrisEnCompte.removeStyleName("votePrisEnCompteOui"); |
votePrisEnCompte.setStyleName("votePrisEnCompteNon"); |
} |
animer.run(2000); |
animerVotePrisEnCompte.run(2000); |
} |
|
public void afficherVoteModifie(boolean voteOui) { |
if (voteOui) { |
voteModifie.removeStyleName("votePrisEnCompteNon"); |
voteModifie.setStyleName("votePrisEnCompteOui"); |
} else { |
voteModifie.removeStyleName("votePrisEnCompteOui"); |
voteModifie.setStyleName("votePrisEnCompteNon"); |
} |
animerVoteModifie.run(2000); |
} |
|
@Override |
public void desactiverBoutons() { |
boutonNon.setEnabled(false); |