Subversion Repositories eFlore/Applications.del

Rev

Rev 967 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 967 Rev 1006
Line 13... Line 13...
13
import org.tela_botanica.del.client.composants.metadonnees.MetadonneesEnLigneVue;
13
import org.tela_botanica.del.client.composants.metadonnees.MetadonneesEnLigneVue;
14
import org.tela_botanica.del.client.composants.metadonnees.MetadonneesPresenteur;
14
import org.tela_botanica.del.client.composants.metadonnees.MetadonneesPresenteur;
15
import org.tela_botanica.del.client.composants.observations.ObservationImagesPresenteur;
15
import org.tela_botanica.del.client.composants.observations.ObservationImagesPresenteur;
16
import org.tela_botanica.del.client.composants.observations.ObservationImagesVue;
16
import org.tela_botanica.del.client.composants.observations.ObservationImagesVue;
17
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
17
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
-
 
18
import org.tela_botanica.del.client.modeles.Image;
18
import org.tela_botanica.del.client.modeles.ModeRecherche;
19
import org.tela_botanica.del.client.modeles.ModeRecherche;
19
import org.tela_botanica.del.client.modeles.MoyenneVote;
20
import org.tela_botanica.del.client.modeles.MoyenneVote;
20
import org.tela_botanica.del.client.modeles.Observation;
21
import org.tela_botanica.del.client.modeles.Observation;
21
import org.tela_botanica.del.client.modeles.ObservationServiceResultat;
22
import org.tela_botanica.del.client.modeles.ObservationServiceResultat;
22
import org.tela_botanica.del.client.modeles.Protocole;
23
import org.tela_botanica.del.client.modeles.Protocole;
Line 25... Line 26...
25
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
26
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
26
import org.tela_botanica.del.client.navigation.evenement.ajoutcommentaire.EvenementAjoutCommentaire;
27
import org.tela_botanica.del.client.navigation.evenement.ajoutcommentaire.EvenementAjoutCommentaire;
27
import org.tela_botanica.del.client.navigation.evenement.ajoutcommentaire.GestionnaireEvenementAjoutCommentaire;
28
import org.tela_botanica.del.client.navigation.evenement.ajoutcommentaire.GestionnaireEvenementAjoutCommentaire;
28
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.EvenementAjoutDetermination;
29
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.EvenementAjoutDetermination;
29
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.GestionnaireEvenementAjoutDetermination;
30
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.GestionnaireEvenementAjoutDetermination;
-
 
31
import org.tela_botanica.del.client.navigation.evenement.changementimagevalidation.EvenementChangementImageValidation;
-
 
32
import org.tela_botanica.del.client.navigation.evenement.changementimagevalidation.GestionnaireEvenementChangementImageValidation;
30
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.EvenementVoteDetermination;
33
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.EvenementVoteDetermination;
31
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.GestionnaireEvenementVoteDetermination;
34
import org.tela_botanica.del.client.navigation.evenement.voteDetermination.GestionnaireEvenementVoteDetermination;
32
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
35
import org.tela_botanica.del.client.services.CalculVoteDeterminationService;
33
import org.tela_botanica.del.client.services.rest.CommentaireServiceConcret;
36
import org.tela_botanica.del.client.services.rest.CommentaireServiceConcret;
34
import org.tela_botanica.del.client.services.rest.ObservationService;
37
import org.tela_botanica.del.client.services.rest.ObservationService;
Line 55... Line 58...
55
	/**
58
	/**
56
	 * Vue de l'interface de détermination
59
	 * Vue de l'interface de détermination
57
	 * */
60
	 * */
58
	public interface Vue extends IsWidget {
61
	public interface Vue extends IsWidget {
59
		public Panel getForum();
62
		public Panel getForum();
-
 
63
 
60
		public Panel getDetailImageObservation();
64
		public Panel getDetailImageObservation();
-
 
65
 
61
		public Panel getFormulaireRechercheEflore();
66
		public Panel getFormulaireRechercheEflore();
-
 
67
 
62
		public Panel getVoteProtocole();
68
		public Panel getVoteProtocole();
-
 
69
 
63
		public Button getBoutonAjoutProposition();
70
		public Button getBoutonAjoutProposition();
-
 
71
 
64
		public Button getBoutonAjoutCommentaire();
72
		public Button getBoutonAjoutCommentaire();
-
 
73
 
65
		public Button getBoutonAjoutPropositionBas();
74
		public Button getBoutonAjoutPropositionBas();
-
 
75
 
66
		public Button getBoutonAjoutCommentaireBas();
76
		public Button getBoutonAjoutCommentaireBas();
-
 
77
 
67
		public HasWidgets getMetadonnees();
78
		public HasWidgets getMetadonnees();
-
 
79
 
68
		public HasWidgets getNouvelleLigneProtocole();
80
		public HasWidgets getNouvelleLigneProtocole();
-
 
81
 
69
		public void afficherNomTaxonProbable(String nomTaxon);
82
		public void afficherNomTaxonProbable(String nomTaxon);
70
	}
83
	}
Line 71... Line 84...
71
 
84
 
72
	private Vue vue;
85
	private Vue vue;
Line 75... Line 88...
75
	// Déclaration des services à utiliser
88
	// Déclaration des services à utiliser
76
	private ProtocoleService protocoleService;
89
	private ProtocoleService protocoleService;
77
	private ObservationService observationService;
90
	private ObservationService observationService;
Line 78... Line 91...
78
 
91
 
79
	private CacheClient cache = CacheClient.getInstance();
-
 
80
	
92
	private CacheClient cache = CacheClient.getInstance();
81
	
93
 
82
	public DeterminationPresenteur(Vue vue, ObservationService observationService, ProtocoleService protocoleService) {
94
	public DeterminationPresenteur(Vue vue, ObservationService observationService, ProtocoleService protocoleService) {
83
		this.vue = vue;
95
		this.vue = vue;
84
		this.protocoleService = protocoleService;
96
		this.protocoleService = protocoleService;
85
		this.observationService = observationService;
97
		this.observationService = observationService;
Line 86... Line 98...
86
	}
98
	}
Line 87... Line 99...
87
 
99
 
-
 
100
	public void go(final HasWidgets composite) {
88
	public void go(final HasWidgets composite) {
101
 
89
 
102
		// TODO afficher une icone de chargement si le chargement devient trop
90
		// TODO afficher une icone de chargement si le chargement devient trop long
103
		// long
Line 91... Line 104...
91
		// car tout l'écran est asynchrone ici
104
		// car tout l'écran est asynchrone ici
92
		Observation observationCourante = cache.getObservationCourante();
105
		final Observation observationCourante = cache.getObservationCourante();
93
		observationService.getObservation(observationCourante.getId(), new ObservationsCallback() {
-
 
Line -... Line 106...
-
 
106
		observationService.getObservation(observationCourante.getId(), new ObservationsCallback() {
94
 
107
 
-
 
108
			@Override
95
			@Override
109
			public void surRetour(ObservationServiceResultat objetRetour) {
-
 
110
 
-
 
111
				// trouve l'image courante si elle n'est pas deja en cache
-
 
112
				List<Image> listeImages = cache.getObservationCourante().getImages();
Line -... Line 113...
-
 
113
				if (listeImages.size() > 0) {
-
 
114
					CacheClient.getInstance().setImageCourante(listeImages.get(0));
96
			public void surRetour(ObservationServiceResultat objetRetour) {
115
				} else {
97
				cache.setImageCourante(cache.getObservationCourante().getImages().get(0));
116
					CacheClient.getInstance().setImageCourante(null);
98
 
117
				}
Line 99... Line 118...
99
				new MetadonneesPresenteur(new MetadonneesEnLigneVue(), cache.getObservationCourante(), ModeRecherche.MODE_OBSERVATION).go(vue.getMetadonnees());
118
 
Line 139... Line 158...
139
			presenteurLigneProtocole.go(vue.getNouvelleLigneProtocole());
158
			presenteurLigneProtocole.go(vue.getNouvelleLigneProtocole());
140
		}
159
		}
141
	}
160
	}
Line 142... Line 161...
142
 
161
 
143
	private void calculerEtAfficherVoteDeterminationPlusPopulaire() {
162
	private void calculerEtAfficherVoteDeterminationPlusPopulaire() {
144
		
163
 
145
		Observation observation = cache.getObservationCourante();
164
		Observation observation = cache.getObservationCourante();
146
		String nomTaxon = observation.getNomRetenu();
165
		String nomTaxon = observation.getNomRetenu();
147
		
166
 
148
		List<MoyenneVote> votesOrdonnes = CalculVoteDeterminationService.calculerVoteDeterminationPlusPopulaire(cache.getObservationCourante().getPropositionDeterminations());
167
		List<MoyenneVote> votesOrdonnes = CalculVoteDeterminationService.calculerVoteDeterminationPlusPopulaire(cache.getObservationCourante().getPropositionDeterminations());
149
		if (votesOrdonnes.size() > 0) {
168
		if (votesOrdonnes.size() > 0) {
150
			nomTaxon = votesOrdonnes.get(0).getIntituleAssocie();
169
			nomTaxon = votesOrdonnes.get(0).getIntituleAssocie();
151
		}
170
		}
152
		
171
 
153
		vue.afficherNomTaxonProbable(nomTaxon);
172
		vue.afficherNomTaxonProbable(nomTaxon);
Line 154... Line 173...
154
	}
173
	}
155
 
174
 
Line 168... Line 187...
168
				fenetreOverlaySimplePresenteur.ouvrirFenetreModale(new FormulairePropositionPresenteur(new FormulairePropositionVue(), new PropositionDeterminationServiceConcret()));
187
				fenetreOverlaySimplePresenteur.ouvrirFenetreModale(new FormulairePropositionPresenteur(new FormulairePropositionVue(), new PropositionDeterminationServiceConcret()));
169
			}
188
			}
170
		};
189
		};
171
		vue.getBoutonAjoutProposition().addClickHandler(clicAjoutProposition);
190
		vue.getBoutonAjoutProposition().addClickHandler(clicAjoutProposition);
172
		vue.getBoutonAjoutPropositionBas().addClickHandler(clicAjoutProposition);
191
		vue.getBoutonAjoutPropositionBas().addClickHandler(clicAjoutProposition);
173
		
192
 
174
		ClickHandler clicAjoutCommentaire = new ClickHandler() {
193
		ClickHandler clicAjoutCommentaire = new ClickHandler() {
175
			@Override
194
			@Override
176
			public void onClick(ClickEvent event) {
195
			public void onClick(ClickEvent event) {
177
				FormulaireCommentairePresenteur commentairePresenteur = new FormulaireCommentairePresenteur(cache.getObservationCourante(), new CommentaireServiceConcret(), new FormulaireCommentaireVue());
196
				FormulaireCommentairePresenteur commentairePresenteur = new FormulaireCommentairePresenteur(cache.getObservationCourante(), new CommentaireServiceConcret(), new FormulaireCommentaireVue());
178
				fenetreOverlaySimplePresenteur = new FenetreOverlaySimplePresenteur(new FenetreOverlayDefilanteVue());
197
				fenetreOverlaySimplePresenteur = new FenetreOverlaySimplePresenteur(new FenetreOverlayDefilanteVue());
Line 198... Line 217...
198
				if (fenetreOverlaySimplePresenteur != null && fenetreOverlaySimplePresenteur.fenetreModaleEstOuverte()) {
217
				if (fenetreOverlaySimplePresenteur != null && fenetreOverlaySimplePresenteur.fenetreModaleEstOuverte()) {
199
					fenetreOverlaySimplePresenteur.fermerFenetreModale();
218
					fenetreOverlaySimplePresenteur.fermerFenetreModale();
200
				}
219
				}
201
			}
220
			}
202
		});
221
		});
-
 
222
 
-
 
223
		BusEvenementiel.getInstance().addHandler(EvenementChangementImageValidation.TYPE, new GestionnaireEvenementChangementImageValidation() {
-
 
224
 
-
 
225
			@Override
-
 
226
			public void onChangementImage(EvenementChangementImageValidation event) {
-
 
227
				vue.getDetailImageObservation().clear();
-
 
228
				vue.getVoteProtocole().clear();
-
 
229
				new ObservationImagesPresenteur(new ObservationImagesVue(), cache.getObservationCourante(), CacheClient.getInstance().getImageCourante()).go(vue.getDetailImageObservation());
-
 
230
				chargerEtAjouterLignesVotesProtocole();
-
 
231
			}
-
 
232
		});
203
	}
233
	}
204
}
234
}