Subversion Repositories eFlore/Applications.del

Rev

Rev 186 | Rev 210 | 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.IsWidget;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.Widget;

public class BarreRepartitionVoteVue extends Composite implements IsWidget {
        
        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");
        }
        
        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=\"conteneurBarreRepartition\">" +
                                                        "<div class=\""+classe+"\">"+
                                                        "<div style=\"width:"+tailleBarre+"%\" class=\"elementBarreRepartition voteOui\"></div>"+
                                                        "</div>"+
                                                        "<span class=\"nomTaxonBarreRepartition\">"+nomTaxon+"</span>"+
                                                        "</div>";
                barreRepartitionHtmlBrut.setHTML(chaineHtml);
        }
        
        public HTML getBarreRepartitionHtmlBrut() {
                return barreRepartitionHtmlBrut;
        }
        
        public PushButton getBoutonOui() {
                return boutonOui;
        }
        
        public PushButton getBoutonNon() {
                return boutonNon;
        }

}