Subversion Repositories eFlore/Applications.del

Rev

Rev 1188 | Rev 1194 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21 aurelien 1
package org.tela_botanica.del.client.gestionhistorique;
2
 
1092 gduche 3
import org.tela_botanica.del.client.cache.CacheClient;
1183 gduche 4
import org.tela_botanica.del.client.composants.formulaires.identification.FormulaireIdentificationPresenteur;
5
import org.tela_botanica.del.client.composants.formulaires.identification.FormulaireIdentificationVue;
347 aurelien 6
import org.tela_botanica.del.client.services.rest.ImageServiceConcret;
392 aurelien 7
import org.tela_botanica.del.client.services.rest.ObservationServiceConcret;
959 benjamin 8
import org.tela_botanica.del.client.services.rest.ProtocoleServiceConcret;
1183 gduche 9
import org.tela_botanica.del.client.services.rest.UtilisateurServiceConcret;
73 benjamin 10
import org.tela_botanica.del.client.vues.comparaisoneflore.ComparaisonEflorePresenteur;
285 benjamin 11
import org.tela_botanica.del.client.vues.comparaisoneflore.ComparaisonEfloreVue;
54 aurelien 12
import org.tela_botanica.del.client.vues.plateformedetermination.DeterminationPresenteur;
304 aurelien 13
import org.tela_botanica.del.client.vues.plateformedetermination.DeterminationVue;
477 benjamin 14
import org.tela_botanica.del.client.vues.rechercheimages.moteur.MoteurRechercheImagePresenteur;
15
import org.tela_botanica.del.client.vues.rechercheimages.moteur.MoteurRechercheImageVue;
16
import org.tela_botanica.del.client.vues.rechercheobservations.moteur.MoteurRechercheObservationsPresenteur;
17
import org.tela_botanica.del.client.vues.rechercheobservations.moteur.MoteurRechercheObservationsVue;
21 aurelien 18
 
1188 gduche 19
import com.google.gwt.core.shared.GWT;
21 aurelien 20
import com.google.gwt.event.logical.shared.ValueChangeEvent;
21
import com.google.gwt.event.logical.shared.ValueChangeHandler;
1188 gduche 22
import com.google.gwt.user.client.ui.HTML;
23
import com.google.gwt.user.client.ui.Label;
1183 gduche 24
import com.google.gwt.user.client.ui.Panel;
21 aurelien 25
import com.google.gwt.user.client.ui.RootPanel;
26
 
27
/**
28
 * @author Benjamin
25 gduche 29
 *
21 aurelien 30
 */
25 gduche 31
public class GestionnaireHistorique implements ValueChangeHandler<String> {
21 aurelien 32
 
25 gduche 33
	/**
34
	 * Évènement lorsque l'historique change. L'action par défaut affiche la
35
	 * page d'accueil.
36
	 * */
37
	public void onValueChange(ValueChangeEvent<String> event) {
21 aurelien 38
 
1183 gduche 39
		//1. définition des variables
40
		String eventValue = event.getValue();
41
		Panel contenu = RootPanel.get("contenu");
42
		Panel zoneIdentification = RootPanel.get("zoneIdentification");
43
		CacheClient cache = CacheClient.getInstance();
44
 
45
		//2. nettoyer le contenu
46
		contenu.clear();
47
		zoneIdentification.clear();
48
 
49
		FormulaireIdentificationPresenteur presenteurIdentification = new FormulaireIdentificationPresenteur(new FormulaireIdentificationVue(), new UtilisateurServiceConcret());
50
		presenteurIdentification.go(zoneIdentification);
51
 
1188 gduche 52
		//3. Gérer le titre
53
		Panel titre = RootPanel.get("zoneTitre");
54
		if (eventValue.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
1189 gduche 55
			afficherTitrePictoFlora(titre);
1188 gduche 56
		}
57
 
58
		if (eventValue.equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || eventValue.equals("")) {
1189 gduche 59
			afficherTitreIdp(titre);
1188 gduche 60
		}
61
 
1189 gduche 62
		if (eventValue.equals(ConstantesNavigation.HOME)) {
63
			String home = cache.getHome();
64
			if (home.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
65
				afficherTitrePictoFlora(titre);
66
			} else {
67
				afficherTitreIdp(titre);
68
			}
69
		}
70
 
1183 gduche 71
		//Actions en fonction de la valeur de l'évènement
72
		if (eventValue.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
73
			cache.setHome(ConstantesNavigation.PAGE_RECHERCHE_IMAGES);
74
			lancerMoteurRechercheImages(contenu);
75
		} else if (eventValue.contains(ConstantesNavigation.PAGE_VALIDATION)) {
76
			DeterminationPresenteur presenteur = new DeterminationPresenteur(new DeterminationVue(), new ObservationServiceConcret(), new ProtocoleServiceConcret());
77
			presenteur.go(contenu);
78
		} else if (eventValue.equals(ConstantesNavigation.PAGE_COMPARAISON_EFLORE)) {
79
			ComparaisonEflorePresenteur presenteur = new ComparaisonEflorePresenteur(new ComparaisonEfloreVue(), new ImageServiceConcret());
80
			presenteur.go(contenu);
81
		} else if (eventValue.equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS)) {
82
			cache.setHome(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS);
83
			lancerMoteurRechercheObservation(contenu);
84
		} else if (eventValue.equals(ConstantesNavigation.HOME)) {
85
			String home = cache.getHome();
1092 gduche 86
			if (home.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
1183 gduche 87
				lancerMoteurRechercheImages(contenu);
1092 gduche 88
			} else {
1183 gduche 89
				lancerMoteurRechercheObservation(contenu);
1092 gduche 90
			}
25 gduche 91
		}
1035 benjamin 92
		else{
1183 gduche 93
			lancerMoteurRechercheObservation(contenu);
1035 benjamin 94
		}
25 gduche 95
	}
1183 gduche 96
 
1189 gduche 97
 
1183 gduche 98
	/**
1189 gduche 99
	 * Afficher ler titre Identiplance
100
	 * */
101
	public void afficherTitreIdp(Panel titre) {
102
		titre.clear();
103
		HTML html = new HTML("<h1>IdentiPlante</h1>");
104
		titre.add(html);
105
	}
106
 
107
	/**
108
	 * Afficher ler titre Identiplance
109
	 * */
110
	public void afficherTitrePictoFlora(Panel titre) {
111
		titre.clear();
112
		HTML html = new HTML("<h1>Pictoflora</h1>");
113
		titre.add(html);
114
	}
115
 
116
	/**
1183 gduche 117
	 * Générer la page de recherche observation et l'afficher dans panneau
118
	 * @param Panel panneau le panneau pour afficher le résultat
119
	 * */
120
	public void lancerMoteurRechercheObservation(Panel panneau) {
121
		MoteurRechercheObservationsPresenteur presenteur = new MoteurRechercheObservationsPresenteur(new ObservationServiceConcret(), new MoteurRechercheObservationsVue());
122
		presenteur.go(panneau);
123
	}
124
 
125
	/**
126
	 * Générer la page de recherche images et l'afficher dans panneau
127
	 * @param Panel panneau le panneau pour afficher le résultat
128
	 * */
129
	public void lancerMoteurRechercheImages(Panel panneau) {
130
		MoteurRechercheImagePresenteur presenteur = new MoteurRechercheImagePresenteur(new MoteurRechercheImageVue(), new ProtocoleServiceConcret());
131
		presenteur.go(panneau);
132
	}
21 aurelien 133
}