Subversion Repositories eFlore/Applications.del

Rev

Rev 1239 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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

import java.util.Iterator;
import java.util.List;

import org.tela_botanica.del.client.utils.StringUtils;

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.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.InlineHTML;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;

public class MotsClesImageVue extends Composite  implements MotsClesImagePresenteur.Vue {
        
        @UiField
        Panel motsCles, motsClesCel, saisieMotsCles, zoneIconesMotsCles;

        @UiField
        Image image;
        
        @UiField
        Button validerMotsCles;
        
        interface MyUiBinder extends UiBinder<Widget, MotsClesImageVue> {
                
        }

        private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

        public MotsClesImageVue() {
                // sets listBox
                initWidget(uiBinder.createAndBindUi(this));
        }
        
        @Override
        public void viderZoneMotsCles() {
                motsCles.clear();
        }

        @Override
        public HasWidgets getZoneMotsCles() {
                return motsCles;
        }
        
        @Override
        public HasWidgets getZoneMotsClesCel() {
                return motsClesCel;
        }
        
        @Override
        public HasWidgets getZoneSaisieMotsCles() {
                return saisieMotsCles;
        }

        @Override
        public void afficherMotsClesProtocole(List<String> motsClesCelImages, List<String> motsClesCelAFiltrer) {
                for (Iterator<String> iterator = motsClesCelImages.iterator(); iterator
                                .hasNext();) {
                        String mot = (String) iterator.next();
                        String motNormalise = StringUtils.normaliser(mot);
                        if(!mot.trim().isEmpty() && motsClesCelAFiltrer.contains(StringUtils.normaliser(motNormalise))) {
                                HTML motCle = new InlineHTML(mot);
                                motCle.setStyleName("motCleCel");
                                motsClesCel.add(motCle);
                                
                        }
                }
        }

        @Override
        public void setImage(String url) {
                image.setUrl(url);
        }
        
        @Override
        public HasWidgets getZoneIconesMotsCles() {
                return zoneIconesMotsCles;
        }
        
        public HasClickHandlers getValiderMotCles() {
                return validerMotsCles;
        }
}