Subversion Repositories eFlore/Applications.del

Rev

Rev 1194 | Rev 1206 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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