Subversion Repositories eFlore/Applications.del

Rev

Rev 1539 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.del.client.composants.motsclesimages.propositions;

import org.tela_botanica.del.client.config.Config;

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.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;

public class MotClePropositionVue extends Composite implements MotClePropositionPresenteur.Vue {
        
        @UiField
        CheckBox ajouterMotCle;
        
        @UiField
        Image iconeTag;
        
        @UiField
        FocusPanel lienMotCle;
        
        interface MyUiBinder extends UiBinder<Widget, MotClePropositionVue> {}
        private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

        public MotClePropositionVue() {
                // sets listBox
                initWidget(uiBinder.createAndBindUi(this));
        }

        @Override
        public void setMotCle(String motcle) {
                ajouterMotCle.setText(motcle);
                iconeTag.setUrl((new Config()).getUrl("iconeBaseUrl") + motcle + ".png");
        }
        
        public HasClickHandlers getLienMotCle() {
                return lienMotCle;
        }
        
        public void toggleCb() {
                boolean val = ajouterMotCle.getValue();
                ajouterMotCle.setValue(!ajouterMotCle.getValue());
                if(ajouterMotCle.getValue()) {
                        addStyleName("motClePictoCoche");
                } else {
                        removeStyleName("motClePictoCoche");
                }
        }
        
        public boolean estAAjouter() {
                return ajouterMotCle.getValue();
        }
        
        public void setEstAAjouter() {
                ajouterMotCle.setValue(true);
                addStyleName("motClePictoCoche");
        }
        
        public HasClickHandlers getAjouterMotCle() {
                return ajouterMotCle;
        }
}