Subversion Repositories eFlore/Applications.del

Rev

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

package org.tela_botanica.del.client.navigation.event;

import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.history.ConstantesNavigation;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.navigation.event.validationobservation.EvenementValidation;
import org.tela_botanica.del.client.navigation.event.validationobservation.GestionnaireEvenementValidation;

import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.History;

public class BusEvenementiel extends HandlerManager {

        private static BusEvenementiel instance;

        private BusEvenementiel() {
                super(null);
                instance = this;
                createHandlers();
        }

        public static BusEvenementiel getInstance() {
                if (instance == null) {
                        instance = new BusEvenementiel();
                }
                return instance;
        }

        private void createHandlers() {
                addHandler(EvenementValidation.TYPE, new GestionnaireEvenementValidation() {

                        @Override
                        public void onValidateImage(EvenementValidation event) {
                                doValidateImage(event.getImageCel());

                        }
                });
        }

        private void doValidateImage(Observation observation) {
                CacheClient.getInstance().setCurrentObservation(observation);
                History.newItem(ConstantesNavigation.VALIDATION_PAGE, true);
                History.fireCurrentHistoryState();
        }

}