Subversion Repositories eFlore/Applications.del

Rev

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

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

import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.navigation.evenement.validationobservation.EvenementValidation;
import org.tela_botanica.del.client.navigation.evenement.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();
        }

}