Subversion Repositories eFlore/Applications.del

Rev

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

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

import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.dom.client.HasBlurHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.dom.client.HasFocusHandlers;
import com.google.gwt.event.dom.client.HasMouseOutHandlers;
import com.google.gwt.event.dom.client.HasMouseOverHandlers;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;

public abstract class MotClePresenteur {
        
        String motCle;
        String idMotCle;
        
        public interface Vue extends IsWidget {
                HasClickHandlers getZoneSuppressionMotCle();
                void afficherZoneSuppression();
                void cacherZoneSuppression();
                HasMouseOverHandlers getZoneMotCleMouseHover();
                HasMouseOutHandlers getZoneMotCleMouseOut();
        }

        private Vue vue;
        
        public MotClePresenteur(Vue vue, String motCleText, String motCleId) {
                this.vue = vue;
                this.idMotCle = motCleId;
        }
        
        public void go(HasWidgets composite) {
                composite.add(vue.asWidget());
                gererEvenements();
        }
        
        public void gererEvenements() {
                vue.getZoneSuppressionMotCle().addClickHandler(new ClickHandler() {             
                        @Override
                        public void onClick(ClickEvent event) {
                                surSuppression(idMotCle);
                        }
                });
                
                vue.getZoneMotCleMouseHover().addMouseOverHandler(new MouseOverHandler() {      
                        @Override
                        public void onMouseOver(MouseOverEvent event) {
                                vue.afficherZoneSuppression();
                        }
                });
                
                vue.getZoneMotCleMouseOut().addMouseOutHandler(new MouseOutHandler() {
                        @Override
                        public void onMouseOut(MouseOutEvent event) {
                                vue.cacherZoneSuppression();
                        }
                });
        }

        public abstract void surSuppression(String idMotCle);
}