Subversion Repositories eFlore/Applications.del

Rev

Rev 1162 | 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.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.HasWidgets;
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
        public Panel motsCles;
        
        @UiField
        public Panel motsClesCel;
        
        @UiField
        public Panel saisieMotsCles;

        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 afficherMotsClesCel(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);
                        }
                }
        }
}