Subversion Repositories eFlore/Applications.del

Rev

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

Rev 814 Rev 939
1
package org.tela_botanica.del.client.vues.rechercheimages.resultats;
1
package org.tela_botanica.del.client.vues.rechercheimages.resultats;
2
 
2
 
3
import java.util.List;
3
import java.util.List;
-
 
4
 
4
import org.tela_botanica.del.client.cache.CacheClient;
5
import org.tela_botanica.del.client.cache.CacheClient;
5
import org.tela_botanica.del.client.composants.pagination.PaginationPresenteur;
6
import org.tela_botanica.del.client.composants.pagination.PaginationPresenteur;
6
import org.tela_botanica.del.client.composants.pagination.PaginationVue;
7
import org.tela_botanica.del.client.composants.pagination.PaginationVue;
7
import org.tela_botanica.del.client.modeles.Image;
8
import org.tela_botanica.del.client.modeles.Image;
8
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
9
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
9
import org.tela_botanica.del.client.modeles.InformationsRecherche;
10
import org.tela_botanica.del.client.modeles.InformationsRecherche;
10
import org.tela_botanica.del.client.modeles.ModeTri;
11
import org.tela_botanica.del.client.modeles.ModeTri;
11
import org.tela_botanica.del.client.modeles.Protocole;
12
import org.tela_botanica.del.client.modeles.Protocole;
12
import org.tela_botanica.del.client.modeles.ProtocoleServiceResultat;
13
import org.tela_botanica.del.client.modeles.ProtocoleServiceResultat;
13
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
14
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
14
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
15
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
15
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.GestionnaireEvenementChangementProtocole;
16
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.GestionnaireEvenementChangementProtocole;
16
import org.tela_botanica.del.client.services.rest.ImageService;
17
import org.tela_botanica.del.client.services.rest.ImageService;
17
import org.tela_botanica.del.client.services.rest.ProtocoleService;
18
import org.tela_botanica.del.client.services.rest.ProtocoleService;
18
import org.tela_botanica.del.client.services.rest.ProtocoleServiceConcret;
19
import org.tela_botanica.del.client.services.rest.ProtocoleServiceConcret;
19
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
20
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
20
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
21
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
21
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImagePresenteur;
22
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImagePresenteur;
22
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImageVue;
23
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImageVue;
-
 
24
 
23
import com.google.gwt.event.dom.client.ChangeEvent;
25
import com.google.gwt.event.dom.client.ChangeEvent;
24
import com.google.gwt.event.dom.client.ChangeHandler;
26
import com.google.gwt.event.dom.client.ChangeHandler;
25
import com.google.gwt.event.dom.client.ClickEvent;
27
import com.google.gwt.event.dom.client.ClickEvent;
26
import com.google.gwt.event.dom.client.ClickHandler;
28
import com.google.gwt.event.dom.client.ClickHandler;
27
import com.google.gwt.event.dom.client.HasChangeHandlers;
29
import com.google.gwt.event.dom.client.HasChangeHandlers;
28
import com.google.gwt.event.dom.client.HasClickHandlers;
30
import com.google.gwt.event.dom.client.HasClickHandlers;
-
 
31
import com.google.gwt.user.client.Window;
29
import com.google.gwt.user.client.ui.HTMLPanel;
32
import com.google.gwt.user.client.ui.HTMLPanel;
30
import com.google.gwt.user.client.ui.HasWidgets;
33
import com.google.gwt.user.client.ui.HasWidgets;
31
import com.google.gwt.user.client.ui.IsWidget;
34
import com.google.gwt.user.client.ui.IsWidget;
32
import com.google.gwt.user.client.ui.ListBox;
35
import com.google.gwt.user.client.ui.ListBox;
33
 
36
 
34
public class ResultatRechercheImagePresenteur {
37
public class ResultatRechercheImagePresenteur {
35
	public interface Vue extends IsWidget {
38
	public interface Vue extends IsWidget {
36
		public void startChargement();
39
		public void startChargement();
37
 
40
 
38
		public void nettoyer();
41
		public void nettoyer();
39
 
42
 
40
		public void creerPanneauxObservations(int size);
43
		public void creerPanneauxObservations(int size);
41
 
44
 
42
		public void stopChargement();
45
		public void stopChargement();
43
 
46
 
44
		public List<HasWidgets> getPanneauxImages();
47
		public List<HasWidgets> getPanneauxImages();
45
 
48
 
46
		public HasWidgets getPanneauPagination();
49
		public HasWidgets getPanneauPagination();
47
 
50
 
48
		public HasWidgets getPanneauPaginationHaut();
51
		public HasWidgets getPanneauPaginationHaut();
49
 
52
 
50
		public HasClickHandlers getTriParNbVotesAscendant();
53
		public HasClickHandlers getTriParNbVotesAscendant();
51
 
54
 
52
		public HasClickHandlers getTriParNbVotesDescendant();
55
		public HasClickHandlers getTriParNbVotesDescendant();
53
 
56
 
54
		public HasClickHandlers getTriParDateAscendant();
57
		public HasClickHandlers getTriParDateAscendant();
55
 
58
 
56
		public HasClickHandlers getTriParDateDescendant();
59
		public HasClickHandlers getTriParDateDescendant();
57
 
60
 
58
		public void afficherElementsAucunResultatTrouve();
61
		public void afficherElementsAucunResultatTrouve();
59
 
62
 
60
		public void afficherElementsResultatsTrouve();
63
		public void afficherElementsResultatsTrouve();
61
 
64
 
62
		public HTMLPanel getImageTable();
65
		public HTMLPanel getImageTable();
63
 
66
 
64
		public String getNomProtocoleSelectionne();
67
		public String getNomProtocoleSelectionne();
65
 
68
 
66
		public int getIdProtocoleSelectionne();
69
		public int getIdProtocoleSelectionne();
67
 
70
 
68
		public void setListeProtocoles(ListBox listeProtocoles);
71
		public void setListeProtocoles(ListBox listeProtocoles);
69
 
72
 
70
		public HasChangeHandlers getListeProtocoles();
73
		public HasChangeHandlers getListeProtocoles();
71
 
74
 
72
		public void ajouterProtocole(String nomProtocole, String idProtocole);
75
		public void ajouterProtocole(String nomProtocole, String idProtocole);
73
 
76
 
74
		public void selectionnerProtocole(int index);
77
		public void selectionnerProtocole(int index);
75
 
78
 
76
		public HasClickHandlers getLabelVote();
79
		public HasClickHandlers getLabelVote();
77
 
80
 
78
		public void masquerVoteAscendant();
81
		public void masquerVoteAscendant();
79
 
82
 
80
		public void masquerVoteDescendant();
83
		public void masquerVoteDescendant();
81
 
84
 
82
		public void afficherVoteAscendant();
85
		public void afficherVoteAscendant();
83
 
86
 
84
		public void afficherVoteDescendant();
87
		public void afficherVoteDescendant();
85
 
88
 
86
		public HasClickHandlers getLabelDate();
89
		public HasClickHandlers getLabelDate();
87
 
90
 
88
		public void masquerDateAscendant();
91
		public void masquerDateAscendant();
89
 
92
 
90
		public void masquerDateDescendant();
93
		public void masquerDateDescendant();
91
 
94
 
92
		public void afficherDateAscendant();
95
		public void afficherDateAscendant();
93
 
96
 
94
		public void afficherDateDescendant();
97
		public void afficherDateDescendant();
95
	}
98
	}
-
 
99
 
96
	private Vue vue;
100
	private Vue vue;
97
	private ImageService imageService;
101
	private ImageService imageService;
98
	private final ProtocoleService protocoleService = new ProtocoleServiceConcret();
102
	private final ProtocoleService protocoleService = new ProtocoleServiceConcret();
99
	private List<Protocole> protocoles;
103
	private List<Protocole> protocoles;
100
	private ModeTri triCourantVote = ModeTri.TRI_ASCENDANT;
104
	private ModeTri triCourantVote = ModeTri.TRI_ASCENDANT;
101
	private ModeTri triCourantDate = ModeTri.TRI_DESCENDANT;
105
	private ModeTri triCourantDate = ModeTri.TRI_DESCENDANT;
102
 
106
 
103
	public ResultatRechercheImagePresenteur(ImageService imageService, Vue vue) {
107
	public ResultatRechercheImagePresenteur(ImageService imageService, Vue vue) {
104
		this.vue = vue;
108
		this.vue = vue;
105
		this.imageService = imageService;
109
		this.imageService = imageService;
106
	}
110
	}
107
 
111
 
108
	public void go(HasWidgets composite) {
112
	public void go(HasWidgets composite) {
109
		composite.add(vue.asWidget());
113
		composite.add(vue.asWidget());
110
		vue.startChargement();
114
		vue.startChargement();
111
		rechercherImagesEtCreerWidgetPagination();
115
		rechercherImagesEtCreerWidgetPagination();
112
		gererEvenements();
116
		gererEvenements();
113
		chargerProtocoles();
117
		chargerProtocoles();
114
		vue.masquerVoteDescendant();
118
		vue.masquerVoteDescendant();
115
		vue.masquerVoteAscendant();
119
		vue.masquerVoteAscendant();
116
		//vue.masquerDateDescendant();
120
		// vue.masquerDateDescendant();
117
		vue.masquerDateAscendant();
121
		vue.masquerDateAscendant();
118
	}
122
	}
119
 
123
 
120
	public void gererEvenements() {
124
	public void gererEvenements() {
121
		vue.getListeProtocoles().addChangeHandler(new ChangeHandler() {
125
		vue.getListeProtocoles().addChangeHandler(new ChangeHandler() {
122
			@Override
126
			@Override
123
			public void onChange(ChangeEvent event) {
127
			public void onChange(ChangeEvent event) {
124
				surChangementProtocole();
128
				surChangementProtocole();
125
			}
129
			}
126
		});
130
		});
127
		
131
 
128
		ClickHandler surClicTriVote = new ClickHandler() {
132
		ClickHandler surClicTriVote = new ClickHandler() {
129
			@Override
133
			@Override
130
			public void onClick(ClickEvent event) {
134
			public void onClick(ClickEvent event) {
131
				surClicTriVote();
135
				surClicTriVote();
132
			}
136
			}
133
		};
137
		};
134
		
138
 
135
		vue.getLabelVote().addClickHandler(surClicTriVote);
139
		vue.getLabelVote().addClickHandler(surClicTriVote);
136
		vue.getTriParNbVotesAscendant().addClickHandler(surClicTriVote);
140
		vue.getTriParNbVotesAscendant().addClickHandler(surClicTriVote);
137
		vue.getTriParNbVotesDescendant().addClickHandler(surClicTriVote);
141
		vue.getTriParNbVotesDescendant().addClickHandler(surClicTriVote);
138
		
142
 
139
		ClickHandler surClicTriDate = new ClickHandler() {
143
		ClickHandler surClicTriDate = new ClickHandler() {
140
			@Override
144
			@Override
141
			public void onClick(ClickEvent event) {
145
			public void onClick(ClickEvent event) {
142
				surClicTriDate();
146
				surClicTriDate();
143
			}
147
			}
144
		};
148
		};
145
		
149
 
146
		vue.getLabelDate().addClickHandler(surClicTriDate);
150
		vue.getLabelDate().addClickHandler(surClicTriDate);
147
		vue.getTriParDateAscendant().addClickHandler(surClicTriDate);
151
		vue.getTriParDateAscendant().addClickHandler(surClicTriDate);
148
		vue.getTriParDateDescendant().addClickHandler(surClicTriDate);
152
		vue.getTriParDateDescendant().addClickHandler(surClicTriDate);
149
		
153
 
150
		BusEvenementiel.getInstance().addHandler(EvenementChangementProtocole.TYPE, new GestionnaireEvenementChangementProtocole() {
154
		BusEvenementiel.getInstance().addHandler(EvenementChangementProtocole.TYPE, new GestionnaireEvenementChangementProtocole() {
151
			@Override
155
			@Override
152
			public void onChangementProtocole(EvenementChangementProtocole event) {
156
			public void onChangementProtocole(EvenementChangementProtocole event) {
153
				InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
157
				InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
154
				if (informationsRechercheImages.getTriParNbVotes() != ModeTri.PAS_DE_TRI) {
158
				if (informationsRechercheImages.getTriParNbVotes() != ModeTri.PAS_DE_TRI) {
155
					informationsRechercheImages.setIdProtocoleSelectionne(event.getProtocole().getId() + "");
159
					informationsRechercheImages.setIdProtocoleSelectionne(event.getProtocole().getId() + "");
156
					chargerEtAfficherImagesPageEnCours();
160
					chargerEtAfficherImagesPageEnCours();
157
				}
161
				}
158
			}
162
			}
159
		});
163
		});
160
	}
164
	}
161
 
165
 
162
	public void surClicTriVote() {
166
	public void surClicTriVote() {
163
		vue.masquerDateDescendant();
167
		vue.masquerDateDescendant();
164
		vue.masquerDateAscendant();
168
		vue.masquerDateAscendant();
165
		if (triCourantVote == ModeTri.TRI_ASCENDANT) {
169
		if (triCourantVote == ModeTri.TRI_ASCENDANT) {
166
			triCourantVote = ModeTri.TRI_DESCENDANT;
170
			triCourantVote = ModeTri.TRI_DESCENDANT;
167
			vue.masquerVoteAscendant();
171
			vue.masquerVoteAscendant();
168
			vue.afficherVoteDescendant();
172
			vue.afficherVoteDescendant();
169
		} else {
173
		} else {
170
			triCourantVote = ModeTri.TRI_ASCENDANT;
174
			triCourantVote = ModeTri.TRI_ASCENDANT;
171
			vue.masquerVoteDescendant();
175
			vue.masquerVoteDescendant();
172
			vue.afficherVoteAscendant();
176
			vue.afficherVoteAscendant();
173
		}
177
		}
174
		InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
178
		InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
175
		int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
179
		int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
176
		informationsRechercheImages.setTriParNbVotes(triCourantVote);
180
		informationsRechercheImages.setTriParNbVotes(triCourantVote);
177
		informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
181
		informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
178
		informationsRechercheImages.setTriParDate(ModeTri.PAS_DE_TRI);
182
		informationsRechercheImages.setTriParDate(ModeTri.PAS_DE_TRI);
179
		chargerEtAfficherImagesPageEnCours();
183
		chargerEtAfficherImagesPageEnCours();
180
	}
184
	}
181
 
185
 
182
	public void surClicTriDate() {
186
	public void surClicTriDate() {
183
		vue.masquerVoteDescendant();
187
		vue.masquerVoteDescendant();
184
		vue.masquerVoteAscendant();
188
		vue.masquerVoteAscendant();
185
		if (triCourantDate == ModeTri.TRI_ASCENDANT) {
189
		if (triCourantDate == ModeTri.TRI_ASCENDANT) {
186
			triCourantDate = ModeTri.TRI_DESCENDANT;
190
			triCourantDate = ModeTri.TRI_DESCENDANT;
187
			vue.masquerDateAscendant();
191
			vue.masquerDateAscendant();
188
			vue.afficherDateDescendant();
192
			vue.afficherDateDescendant();
189
		} else {
193
		} else {
190
			triCourantDate = ModeTri.TRI_ASCENDANT;
194
			triCourantDate = ModeTri.TRI_ASCENDANT;
191
			vue.masquerDateDescendant();
195
			vue.masquerDateDescendant();
192
			vue.afficherDateAscendant();
196
			vue.afficherDateAscendant();
193
		}
197
		}
194
		InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
198
		InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
195
		informationsRechercheImages.setTriParDate(triCourantDate);
199
		informationsRechercheImages.setTriParDate(triCourantDate);
196
		informationsRechercheImages.setTriParNbVotes(ModeTri.PAS_DE_TRI);
200
		informationsRechercheImages.setTriParNbVotes(ModeTri.PAS_DE_TRI);
197
		chargerEtAfficherImagesPageEnCours();
201
		chargerEtAfficherImagesPageEnCours();
198
	}
202
	}
199
 
203
 
200
	public void surChangementProtocole() {
204
	public void surChangementProtocole() {
201
		Protocole protocoleCourant = null;
205
		Protocole protocoleCourant = null;
202
		for (Protocole protocole : protocoles) {
206
		for (Protocole protocole : protocoles) {
203
			if (protocole.getId() == vue.getIdProtocoleSelectionne()) {
207
			if (protocole.getId() == vue.getIdProtocoleSelectionne()) {
204
				protocoleCourant = protocole;
208
				protocoleCourant = protocole;
205
			}
209
			}
206
		}
210
		}
207
		CacheClient.getInstance().setProtocoleCourant(protocoleCourant);
211
		CacheClient.getInstance().setProtocoleCourant(protocoleCourant);
208
		EvenementChangementProtocole evenement = new EvenementChangementProtocole(protocoleCourant);
212
		EvenementChangementProtocole evenement = new EvenementChangementProtocole(protocoleCourant);
209
		BusEvenementiel.getInstance().fireEvent(evenement);
213
		BusEvenementiel.getInstance().fireEvent(evenement);
210
	}
214
	}
211
 
215
 
212
	private void chargerProtocoles() {
216
	private void chargerProtocoles() {
213
		// test pour ne pas charger les protocoles déjà chargés
217
		// test pour ne pas charger les protocoles déjà chargés
214
		// TODO: faire un systeme de cache gérés par les web service eux même
218
		// TODO: faire un systeme de cache gérés par les web service eux même
215
		if(CacheClient.getInstance().getListeProtocoles() == null) {
219
		if (CacheClient.getInstance().getListeProtocoles() == null) {
216
			protocoleService.getProtocoles(new ProtocolesCallback() {
220
			protocoleService.getProtocoles(new ProtocolesCallback() {
-
 
221
 
217
				@Override
222
				@Override
218
				public void surProtocolesRecus(ProtocoleServiceResultat protocolesRecus) {
223
				public void surRetour(ProtocoleServiceResultat protocolesRecus) {
219
					protocoles = protocolesRecus.getProtocoles();
224
					protocoles = protocolesRecus.getProtocoles();
220
					remplirListeProtocole(protocoles);
225
					remplirListeProtocole(protocoles);
-
 
226
 
221
				}		
227
				}
222
			});
228
			});
223
		} else {
229
		} else {
224
			protocoles = CacheClient.getInstance().getListeProtocoles();
230
			protocoles = CacheClient.getInstance().getListeProtocoles();
225
			remplirListeProtocole(CacheClient.getInstance().getListeProtocoles());
231
			remplirListeProtocole(CacheClient.getInstance().getListeProtocoles());
226
		}
232
		}
227
	}
233
	}
228
	
234
 
229
	private void remplirListeProtocole(List<Protocole> protocoles) {
235
	private void remplirListeProtocole(List<Protocole> protocoles) {
230
		for (Protocole protocole : protocoles) {
236
		for (Protocole protocole : protocoles) {
231
			vue.ajouterProtocole(protocole.getNom(), protocole.getId()+"");
237
			vue.ajouterProtocole(protocole.getNom(), protocole.getId() + "");
232
		}
238
		}
233
		if(CacheClient.getInstance().getProtocoleCourant() == null) {
239
		if (CacheClient.getInstance().getProtocoleCourant() == null) {
234
			vue.selectionnerProtocole(0);
240
			vue.selectionnerProtocole(0);
235
		}
241
		}
236
	}
242
	}
237
 
243
 
238
	public void rechercherImagesEtCreerWidgetPagination() {
244
	public void rechercherImagesEtCreerWidgetPagination() {
239
		// appel du service d'image pour avoir le nb total d'elements pour la
245
		// appel du service d'image pour avoir le nb total d'elements pour la
240
		// pagination
246
		// pagination
241
		ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
247
		ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
-
 
248
 
242
			@Override
249
			@Override
243
			public void surImagesRecues(ImageServiceResultat imagesRecues) {
250
			public void surRetour(ImageServiceResultat imagesRecues) {
244
				creerWidgetPagination(imagesRecues.getNbTotalImagesPourLaRecherche());
251
				creerWidgetPagination(imagesRecues.getNbTotalImagesPourLaRecherche());
245
				afficherImages(imagesRecues);
252
				afficherImages(imagesRecues);
-
 
253
 
-
 
254
			}
-
 
255
 
-
 
256
			@Override
-
 
257
			public void surErreur(String messageErreur) {
-
 
258
				Window.alert(messageErreur);
-
 
259
 
246
			}
260
			}
247
		};
261
		};
248
		final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
262
		final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
249
		final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
263
		final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
250
		imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), debut, fin, callback);
264
		imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), debut, fin, callback);
251
	}
265
	}
252
 
266
 
253
	private void chargerEtAfficherImages(final int premier, final int dernier) {
267
	private void chargerEtAfficherImages(final int premier, final int dernier) {
254
		vue.startChargement();
268
		vue.startChargement();
255
		vue.nettoyer();
269
		vue.nettoyer();
256
		ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
270
		ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
-
 
271
 
257
			@Override
272
			@Override
258
			public void surImagesRecues(ImageServiceResultat imagesRecues) {
273
			public void surRetour(ImageServiceResultat imagesRecues) {
259
				afficherImages(imagesRecues);
274
				afficherImages(imagesRecues);
-
 
275
 
-
 
276
			}
-
 
277
 
-
 
278
			@Override
-
 
279
			public void surErreur(String messageErreur) {
-
 
280
				Window.alert(messageErreur);
-
 
281
 
260
			}
282
			}
-
 
283
 
261
		};
284
		};
262
		imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), premier, dernier, callback);
285
		imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), premier, dernier, callback);
263
	}
286
	}
264
 
287
 
265
	public void afficherImages(ImageServiceResultat imageServiceResult) {
288
	public void afficherImages(ImageServiceResultat imageServiceResult) {
266
		List<Image> images = imageServiceResult.getImages();
289
		List<Image> images = imageServiceResult.getImages();
267
		if (images == null || images.size() == 0) {
290
		if (images == null || images.size() == 0) {
268
			vue.afficherElementsAucunResultatTrouve();
291
			vue.afficherElementsAucunResultatTrouve();
269
		} else {
292
		} else {
270
			vue.afficherElementsResultatsTrouve();
293
			vue.afficherElementsResultatsTrouve();
271
			for (Image image : images) {
294
			for (Image image : images) {
272
				ImagePresenteur imagePresenteur = new ImagePresenteur(image, CacheClient.getInstance().getProtocoleCourant(), new ImageVue());
295
				ImagePresenteur imagePresenteur = new ImagePresenteur(image, CacheClient.getInstance().getProtocoleCourant(), new ImageVue());
273
				imagePresenteur.go(vue.getImageTable());
296
				imagePresenteur.go(vue.getImageTable());
274
			}
297
			}
275
		}
298
		}
276
		vue.stopChargement();
299
		vue.stopChargement();
277
	}
300
	}
278
 
301
 
279
	private void creerWidgetPagination(int nbImages) {
302
	private void creerWidgetPagination(int nbImages) {
280
		PaginationPresenteur imagesPaginationPresenteurHaut = creerPresenteurPagination(nbImages);
303
		PaginationPresenteur imagesPaginationPresenteurHaut = creerPresenteurPagination(nbImages);
281
		PaginationPresenteur imagesPaginationPresenteurBas = creerPresenteurPagination(nbImages);
304
		PaginationPresenteur imagesPaginationPresenteurBas = creerPresenteurPagination(nbImages);
282
		imagesPaginationPresenteurHaut.setGroupePagination("pagination_images");
305
		imagesPaginationPresenteurHaut.setGroupePagination("pagination_images");
283
		imagesPaginationPresenteurBas.setGroupePagination("pagination_images");
306
		imagesPaginationPresenteurBas.setGroupePagination("pagination_images");
284
		imagesPaginationPresenteurHaut.go(vue.getPanneauPaginationHaut());
307
		imagesPaginationPresenteurHaut.go(vue.getPanneauPaginationHaut());
285
		imagesPaginationPresenteurBas.go(vue.getPanneauPagination());
308
		imagesPaginationPresenteurBas.go(vue.getPanneauPagination());
286
	}
309
	}
287
 
310
 
288
	public PaginationPresenteur creerPresenteurPagination(int nbImages) {
311
	public PaginationPresenteur creerPresenteurPagination(int nbImages) {
289
		PaginationPresenteur imagesPaginationPresenteur = new PaginationPresenteur(new PaginationVue(), nbImages, CacheClient.getInstance().getPasPagination(), CacheClient.getInstance()
312
		PaginationPresenteur imagesPaginationPresenteur = new PaginationPresenteur(new PaginationVue(), nbImages, CacheClient.getInstance().getPasPagination(), CacheClient.getInstance().getPageCouranteRechercheImage()) {
290
				.getPageCouranteRechercheImage()) {
-
 
291
			@Override
313
			@Override
292
			public void chargerElements(int debut, int fin) {
314
			public void chargerElements(int debut, int fin) {
293
				chargerEtAfficherImages(debut, fin);
315
				chargerEtAfficherImages(debut, fin);
294
				CacheClient.getInstance().setPageCouranteRechercheImages(getPageCourante());
316
				CacheClient.getInstance().setPageCouranteRechercheImages(getPageCourante());
295
			}
317
			}
296
 
318
 
297
			@Override
319
			@Override
298
			public void actualiserPasCache(int pas) {
320
			public void actualiserPasCache(int pas) {
299
				CacheClient.getInstance().setPasPagination(pas);
321
				CacheClient.getInstance().setPasPagination(pas);
300
			}
322
			}
301
		};
323
		};
302
		return imagesPaginationPresenteur;
324
		return imagesPaginationPresenteur;
303
	}
325
	}
304
 
326
 
305
	public void chargerEtAfficherImagesPageEnCours() {
327
	public void chargerEtAfficherImagesPageEnCours() {
306
		final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
328
		final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
307
		final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
329
		final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
308
		chargerEtAfficherImages(debut, fin);
330
		chargerEtAfficherImages(debut, fin);
309
	}
331
	}
310
 
332
 
311
	public Vue getVue() {
333
	public Vue getVue() {
312
		return vue;
334
		return vue;
313
	}
335
	}
314
}
336
}