Rev 276 | Rev 611 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
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);
private int pourcentage = -1;
private int tailleBarre = 0;
private String nomTaxon = "";
@UiField(provided = true)
public PushButton boutonOui = new PushButton("+");
@UiField(provided = true)
public PushButton boutonNon = new PushButton("-");
@UiField(provided = true)
public HTML barreRepartitionHtmlBrut = new HTML("<div class=\"barreRepartition\"></div>");
public BarreRepartitionVoteVue() {
initWidget(uiBinder.createAndBindUi(this));
boutonNon.setWidth("20px");
boutonOui.setWidth("20px");
}
/* (non-Javadoc)
* @see org.tela_botanica.del.client.vues.plateformedetermination.vote.barrerepartition.BarreRepartitionVoteVueInterface#afficherVotes(int, java.lang.String)
*/
@Override
public void afficherVotes(int pourcentage, String NomTaxon) {
this.pourcentage = pourcentage;
this.nomTaxon = NomTaxon;
tailleBarre = (pourcentage > -1) ? pourcentage : 0;
String classe = "barreRepartition";
if(pourcentage == -1) {
classe = "barreRepartitionAucunVote";
}
String chaineHtml = "<div class=\""+classe+"\">"+
"<div style=\"width:"+tailleBarre+"%\" class=\"elementBarreRepartition voteOui\"></div>"+
"</div>"+
"<span class=\"nomTaxonBarreRepartition\">"+nomTaxon+"</span>";
barreRepartitionHtmlBrut.setHTML(chaineHtml);
}
@Override
public HTML getBarreRepartitionHtmlBrut() {
return barreRepartitionHtmlBrut;
}
@Override
public PushButton getBoutonOui() {
return boutonOui;
}
@Override
public PushButton getBoutonNon() {
return boutonNon;
}
@Override
public void setVoteOuiEffectue() {
getBoutonOui().setEnabled(false);
getBoutonNon().setEnabled(true);
}
@Override
public void setVoteNonEffectue() {
getBoutonOui().setEnabled(true);
getBoutonNon().setEnabled(false);
}
}