Rev 1188 | Rev 1196 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.del.client.gestionhistorique;import org.tela_botanica.del.client.cache.CacheClient;import org.tela_botanica.del.client.composants.formulaires.identification.FormulaireIdentificationPresenteur;import org.tela_botanica.del.client.composants.formulaires.identification.FormulaireIdentificationVue;import org.tela_botanica.del.client.services.rest.ImageServiceConcret;import org.tela_botanica.del.client.services.rest.ObservationServiceConcret;import org.tela_botanica.del.client.services.rest.ProtocoleServiceConcret;import org.tela_botanica.del.client.services.rest.UtilisateurServiceConcret;import org.tela_botanica.del.client.vues.comparaisoneflore.ComparaisonEflorePresenteur;import org.tela_botanica.del.client.vues.comparaisoneflore.ComparaisonEfloreVue;import org.tela_botanica.del.client.vues.plateformedetermination.DeterminationPresenteur;import org.tela_botanica.del.client.vues.plateformedetermination.DeterminationVue;import org.tela_botanica.del.client.vues.rechercheimages.moteur.MoteurRechercheImagePresenteur;import org.tela_botanica.del.client.vues.rechercheimages.moteur.MoteurRechercheImageVue;import org.tela_botanica.del.client.vues.rechercheobservations.moteur.MoteurRechercheObservationsPresenteur;import org.tela_botanica.del.client.vues.rechercheobservations.moteur.MoteurRechercheObservationsVue;import com.google.gwt.core.shared.GWT;import com.google.gwt.event.logical.shared.ValueChangeEvent;import com.google.gwt.event.logical.shared.ValueChangeHandler;import com.google.gwt.user.client.ui.HTML;import com.google.gwt.user.client.ui.Label;import com.google.gwt.user.client.ui.Panel;import com.google.gwt.user.client.ui.RootPanel;/*** @author Benjamin**/public class GestionnaireHistorique implements ValueChangeHandler<String> {/*** Évènement lorsque l'historique change. L'action par défaut affiche la* page d'accueil.* */public void onValueChange(ValueChangeEvent<String> event) {//1. définition des variablesString eventValue = event.getValue();Panel contenu = RootPanel.get("contenu");Panel zoneIdentification = RootPanel.get("zoneIdentification");CacheClient cache = CacheClient.getInstance();//2. nettoyer le contenucontenu.clear();zoneIdentification.clear();FormulaireIdentificationPresenteur presenteurIdentification = new FormulaireIdentificationPresenteur(new FormulaireIdentificationVue(), new UtilisateurServiceConcret());presenteurIdentification.go(zoneIdentification);//3. Gérer le titrePanel titre = RootPanel.get("zoneTitre");if (eventValue.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {afficherTitrePictoFlora(titre);}if (eventValue.equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || eventValue.equals("")) {afficherTitreIdp(titre);}if (eventValue.equals(ConstantesNavigation.HOME)) {String home = cache.getHome();if (home.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {afficherTitrePictoFlora(titre);} else {afficherTitreIdp(titre);}}//Actions en fonction de la valeur de l'évènementif (eventValue.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {cache.setHome(ConstantesNavigation.PAGE_RECHERCHE_IMAGES);lancerMoteurRechercheImages(contenu);} else if (eventValue.contains(ConstantesNavigation.PAGE_VALIDATION)) {DeterminationPresenteur presenteur = new DeterminationPresenteur(new DeterminationVue(), new ObservationServiceConcret(), new ProtocoleServiceConcret());presenteur.go(contenu);} else if (eventValue.equals(ConstantesNavigation.PAGE_COMPARAISON_EFLORE)) {ComparaisonEflorePresenteur presenteur = new ComparaisonEflorePresenteur(new ComparaisonEfloreVue(), new ImageServiceConcret());presenteur.go(contenu);} else if (eventValue.equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS)) {cache.setHome(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS);lancerMoteurRechercheObservation(contenu);} else if (eventValue.equals(ConstantesNavigation.HOME)) {String home = cache.getHome();if (home.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {lancerMoteurRechercheImages(contenu);} else {lancerMoteurRechercheObservation(contenu);}}else{lancerMoteurRechercheObservation(contenu);}}/*** Afficher ler titre Identiplance* */public void afficherTitreIdp(Panel titre) {titre.clear();HTML html = new HTML("<h1>IdentiPlante</h1>");titre.add(html);}/*** Afficher ler titre Identiplance* */public void afficherTitrePictoFlora(Panel titre) {titre.clear();HTML html = new HTML("<h1>Pictoflora</h1>");titre.add(html);}/*** Générer la page de recherche observation et l'afficher dans panneau* @param Panel panneau le panneau pour afficher le résultat* */public void lancerMoteurRechercheObservation(Panel panneau) {MoteurRechercheObservationsPresenteur presenteur = new MoteurRechercheObservationsPresenteur(new ObservationServiceConcret(), new MoteurRechercheObservationsVue());presenteur.go(panneau);}/*** Générer la page de recherche images et l'afficher dans panneau* @param Panel panneau le panneau pour afficher le résultat* */public void lancerMoteurRechercheImages(Panel panneau) {MoteurRechercheImagePresenteur presenteur = new MoteurRechercheImagePresenteur(new MoteurRechercheImageVue(), new ProtocoleServiceConcret());presenteur.go(panneau);}}