Subversion Repositories eFlore/Applications.del

Rev

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