Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1196 Rev 1203
Line 19... Line 19...
19
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
19
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
20
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
20
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
21
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImagePresenteur;
21
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImagePresenteur;
22
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImageVue;
22
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImageVue;
Line -... Line 23...
-
 
23
 
-
 
24
import com.google.gwt.dom.client.NodeList;
-
 
25
import com.google.gwt.dom.client.OptionElement;
23
 
26
import com.google.gwt.dom.client.SelectElement;
24
import com.google.gwt.event.dom.client.ChangeEvent;
27
import com.google.gwt.event.dom.client.ChangeEvent;
25
import com.google.gwt.event.dom.client.ChangeHandler;
28
import com.google.gwt.event.dom.client.ChangeHandler;
26
import com.google.gwt.event.dom.client.ClickEvent;
29
import com.google.gwt.event.dom.client.ClickEvent;
27
import com.google.gwt.event.dom.client.ClickHandler;
30
import com.google.gwt.event.dom.client.ClickHandler;
Line 33... Line 36...
33
import com.google.gwt.user.client.ui.IsWidget;
36
import com.google.gwt.user.client.ui.IsWidget;
34
import com.google.gwt.user.client.ui.ListBox;
37
import com.google.gwt.user.client.ui.ListBox;
Line 35... Line 38...
35
 
38
 
36
public class ResultatPictofloraPresenteur {
39
public class ResultatPictofloraPresenteur {
-
 
40
	public interface Vue extends IsWidget {
-
 
41
		
37
	public interface Vue extends IsWidget {
42
		
Line 38... Line 43...
38
		public void startChargement();
43
		public void startChargement();
Line 39... Line 44...
39
 
44
 
Line 65... Line 70...
65
 
70
 
Line 66... Line 71...
66
		public void afficherElementsResultatsTrouve();
71
		public void afficherElementsResultatsTrouve();
Line 67... Line -...
67
 
-
 
68
		public HTMLPanel getImageTable();
-
 
69
 
-
 
70
		public String getNomProtocoleSelectionne();
-
 
71
 
-
 
72
		public int getIdProtocoleSelectionne();
-
 
73
 
-
 
74
		public void setListeProtocoles(ListBox listeProtocoles);
-
 
75
 
-
 
76
		public HasChangeHandlers getListeProtocoles();
-
 
77
		
-
 
78
		public void ajouterProtocoles(List<Protocole> protocoles);
-
 
79
 
72
 
Line 80... Line 73...
80
		public void selectionnerProtocole(int index);
73
		public HTMLPanel getImageTable();
Line 81... Line 74...
81
 
74
 
Line 107... Line 100...
107
 
100
 
Line 108... Line 101...
108
		public void masquerTagDescendant();
101
		public void masquerTagDescendant();
Line 109... Line -...
109
 
-
 
110
		public void afficherTagAscendant();
-
 
111
 
102
 
Line 112... Line 103...
112
		public void mettreAJourDescriptionProtocoleCourant(
103
		public void afficherTagAscendant();
113
				Protocole protocoleCourant);
104
 
114
	}
105
	}
115
 
-
 
116
	private Vue vue;
106
 
117
	private ImageService imageService;
107
	private Vue vue;
118
	private final ProtocoleService protocoleService;
108
	private ImageService imageService;
Line 119... Line 109...
119
	private List<Protocole> protocoles;
109
	private final ProtocoleService protocoleService;
Line 130... Line 120...
130
	public void go(HasWidgets composite) {
120
	public void go(HasWidgets composite) {
131
		composite.add(vue.asWidget());
121
		composite.add(vue.asWidget());
132
		vue.startChargement();
122
		vue.startChargement();
133
		rechercherImagesEtCreerWidgetPagination();
123
		rechercherImagesEtCreerWidgetPagination();
134
		gererEvenements();
124
		gererEvenements();
135
		chargerProtocoles();
-
 
136
		vue.masquerVoteDescendant();
125
		vue.masquerVoteDescendant();
137
		vue.masquerVoteAscendant();
126
		vue.masquerVoteAscendant();
138
		// vue.masquerDateDescendant();
127
		// vue.masquerDateDescendant();
139
		vue.masquerDateAscendant();
128
		vue.masquerDateAscendant();
140
		vue.masquerTagAscendant();
129
		vue.masquerTagAscendant();
141
		vue.masquerTagDescendant();
130
		vue.masquerTagDescendant();
142
	}
131
	}
Line 143... Line 132...
143
 
132
 
144
	public void gererEvenements() {
-
 
145
		vue.getListeProtocoles().addChangeHandler(new ChangeHandler() {
-
 
146
			@Override
-
 
147
			public void onChange(ChangeEvent event) {
-
 
148
				surChangementProtocole();
-
 
149
			}
-
 
150
		});
-
 
151
 
133
	public void gererEvenements() {
152
		ClickHandler surClicTriVote = new ClickHandler() {
134
		ClickHandler surClicTriVote = new ClickHandler() {
153
			@Override
135
			@Override
154
			public void onClick(ClickEvent event) {
136
			public void onClick(ClickEvent event) {
155
				surClicTriVote();
137
				surClicTriVote();
Line 255... Line 237...
255
		informationsRechercheImages.setTriParNbVotes(ModeTri.PAS_DE_TRI);
237
		informationsRechercheImages.setTriParNbVotes(ModeTri.PAS_DE_TRI);
256
		informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
238
		informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
257
		chargerEtAfficherImagesPageEnCours();
239
		chargerEtAfficherImagesPageEnCours();
258
	}
240
	}
Line 259... Line -...
259
 
-
 
260
	public void surChangementProtocole() {
-
 
261
		Protocole protocoleCourant = null;
-
 
262
		for (Protocole protocole : protocoles) {
-
 
263
			if (protocole.getId() == vue.getIdProtocoleSelectionne()) {
-
 
264
				protocoleCourant = protocole;
-
 
265
			}
-
 
266
		}
-
 
267
		vue.mettreAJourDescriptionProtocoleCourant(protocoleCourant);
-
 
268
		CacheClient.getInstance().setProtocoleCourant(protocoleCourant);
-
 
269
		EvenementChangementProtocole evenement = new EvenementChangementProtocole(protocoleCourant);
-
 
270
		BusEvenementiel.getInstance().fireEvent(evenement);
-
 
271
	}
-
 
272
 
-
 
273
	private void chargerProtocoles() {
-
 
274
		// test pour ne pas charger les protocoles déjà chargés
-
 
275
		// TODO: faire un systeme de cache gérés par les web service eux même
-
 
276
		if (CacheClient.getInstance().getListeProtocoles() == null) {
-
 
277
			protocoleService.getProtocoles(new ProtocolesCallback() {
-
 
278
 
-
 
279
				@Override
-
 
280
				public void surRetour(ProtocoleServiceResultat protocolesRecus) {
-
 
281
					protocoles = protocolesRecus.getProtocoles();
-
 
282
					remplirListeProtocole(protocoles);
-
 
283
 
-
 
284
				}
-
 
285
			});
-
 
286
		} else {
-
 
287
			protocoles = CacheClient.getInstance().getListeProtocoles();
-
 
288
			remplirListeProtocole(CacheClient.getInstance().getListeProtocoles());
-
 
289
		}
-
 
290
	}
-
 
291
 
-
 
292
	private void remplirListeProtocole(List<Protocole> protocoles) {
-
 
293
		vue.ajouterProtocoles(protocoles);
-
 
294
		if (CacheClient.getInstance().getProtocoleCourant() == null) {
-
 
295
			vue.selectionnerProtocole(0);
-
 
296
			vue.mettreAJourDescriptionProtocoleCourant(protocoles.get(0));
-
 
297
		} else {
-
 
298
			vue.mettreAJourDescriptionProtocoleCourant(CacheClient.getInstance().getProtocoleCourant());
-
 
299
		}
-
 
300
	}
-
 
301
 
241
 
302
	public void rechercherImagesEtCreerWidgetPagination() {
242
	public void rechercherImagesEtCreerWidgetPagination() {
303
		// appel du service d'image pour avoir le nb total d'elements pour la
243
		// appel du service d'image pour avoir le nb total d'elements pour la
304
		// pagination
244
		// pagination