New file |
0,0 → 1,64 |
package org.tela_botanica.del.client.composants.votes.barrerepartition; |
|
import com.google.gwt.core.client.GWT; |
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.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; |
import com.google.gwt.user.client.ui.PushButton; |
import com.google.gwt.user.client.ui.Widget; |
|
public class BarreRepartitionVoteVue extends Composite implements BarreRepartitionVotePresenteur.Vue { |
|
interface MyUiBinder extends UiBinder<Widget, BarreRepartitionVoteVue> {} |
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class); |
|
|
@UiField Label nomTaxon; |
@UiField Panel barreOui, barreNon; |
@UiField PushButton boutonOui, boutonNon; |
|
public BarreRepartitionVoteVue() { |
initWidget(uiBinder.createAndBindUi(this)); |
} |
|
@Override |
public void afficherVotes(int pourcentage, String nomTaxon) { |
this.nomTaxon.setText(nomTaxon); |
|
if (pourcentage > -1) { |
|
int pourcentageNon = 100-pourcentage; |
barreOui.setWidth(pourcentage + "%"); |
barreNon.setWidth(pourcentageNon + "%"); |
} else { |
barreNon.setWidth("0px"); |
barreOui.setWidth("0px"); |
} |
} |
|
@Override |
public HasClickHandlers getBoutonOui() { |
return boutonOui; |
} |
|
@Override |
public HasClickHandlers getBoutonNon() { |
return boutonNon; |
} |
|
@Override |
public void setVoteOuiEffectue() { |
boutonOui.setEnabled(false); |
boutonNon.setEnabled(true); |
} |
|
@Override |
public void setVoteNonEffectue() { |
boutonOui.setEnabled(true); |
boutonNon.setEnabled(false); |
} |
} |