Subversion Repositories eFlore/Applications.del

Rev

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

Rev 564 Rev 590
Line 7... Line 7...
7
import org.tela_botanica.del.client.composants.pagination.PaginationVue;
7
import org.tela_botanica.del.client.composants.pagination.PaginationVue;
8
import org.tela_botanica.del.client.modeles.Image;
8
import org.tela_botanica.del.client.modeles.Image;
9
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
9
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
10
import org.tela_botanica.del.client.modeles.InformationsRecherche;
10
import org.tela_botanica.del.client.modeles.InformationsRecherche;
11
import org.tela_botanica.del.client.modeles.ModeTri;
11
import org.tela_botanica.del.client.modeles.ModeTri;
-
 
12
import org.tela_botanica.del.client.modeles.Protocole;
12
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
13
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
13
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
14
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
14
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.GestionnaireEvenementChangementProtocole;
15
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.GestionnaireEvenementChangementProtocole;
15
import org.tela_botanica.del.client.services.rest.ImageService;
16
import org.tela_botanica.del.client.services.rest.ImageService;
-
 
17
import org.tela_botanica.del.client.services.rest.ProtocoleService;
16
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
18
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
-
 
19
import org.tela_botanica.del.client.utils.MockDatasource;
17
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImagePresenteur;
20
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImagePresenteur;
18
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImageVue;
21
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImageVue;
Line -... Line 22...
-
 
22
 
-
 
23
import com.google.gwt.event.dom.client.ChangeEvent;
19
 
24
import com.google.gwt.event.dom.client.ChangeHandler;
20
import com.google.gwt.event.dom.client.ClickEvent;
25
import com.google.gwt.event.dom.client.ClickEvent;
-
 
26
import com.google.gwt.event.dom.client.ClickHandler;
21
import com.google.gwt.event.dom.client.ClickHandler;
27
import com.google.gwt.event.dom.client.HasChangeHandlers;
22
import com.google.gwt.event.dom.client.HasClickHandlers;
28
import com.google.gwt.event.dom.client.HasClickHandlers;
23
import com.google.gwt.user.client.ui.HTMLPanel;
29
import com.google.gwt.user.client.ui.HTMLPanel;
24
import com.google.gwt.user.client.ui.HasWidgets;
30
import com.google.gwt.user.client.ui.HasWidgets;
-
 
31
import com.google.gwt.user.client.ui.IsWidget;
Line 25... Line 32...
25
import com.google.gwt.user.client.ui.IsWidget;
32
import com.google.gwt.user.client.ui.ListBox;
Line 26... Line 33...
26
 
33
 
27
public class ResultatRechercheImagePresenteur {
34
public class ResultatRechercheImagePresenteur {
Line 52... Line 59...
52
		public void afficherElementsAucunResultatTrouve();
59
		public void afficherElementsAucunResultatTrouve();
Line 53... Line 60...
53
 
60
 
Line 54... Line 61...
54
		public void afficherElementsResultatsTrouve();
61
		public void afficherElementsResultatsTrouve();
-
 
62
 
-
 
63
		public HTMLPanel getImageTable();
-
 
64
		
-
 
65
		public String getNomProtocolSelectionne();
-
 
66
 
-
 
67
		public int getIdProtocoleSelectionne();
-
 
68
		
-
 
69
		public void setListeProtocoles(ListBox listeProtocoles);
-
 
70
		
-
 
71
		public HasChangeHandlers getListeProtocoles();
-
 
72
		
-
 
73
		public void ajouterProtocole(String protocole);
-
 
74
 
55
 
75
		public void selectionnerProtocole(int index);
Line 56... Line 76...
56
		public HTMLPanel getImageTable();
76
		
57
	}
77
	}
58
 
78
 
59
	// new ResultatRechercheImageVue();
79
	// new ResultatRechercheImageVue();
-
 
80
	private Vue vue;
-
 
81
	private ImageService imageService;
-
 
82
	
-
 
83
	private final ProtocoleService protocoleService = MockDatasource.getInstance();
-
 
84
	private List<Protocole> protocoles;
-
 
85
 
60
	private Vue vue;
86
	// TODO : passer ça en cache
61
	private ImageService imageService;
87
	private String protocoleParDefaut = Protocole.ESTHETISME;
62
 
88
	
63
	public ResultatRechercheImagePresenteur(ImageService imageService, Vue vue) {
89
	public ResultatRechercheImagePresenteur(ImageService imageService, Vue vue) {
Line 64... Line 90...
64
		this.vue = vue;
90
		this.vue = vue;
65
		this.imageService = imageService;
91
		this.imageService = imageService;
66
	}
92
	}
67
 
93
 
68
	public void go(HasWidgets composite) {
94
	public void go(HasWidgets composite) {
-
 
95
		composite.add(vue.asWidget());
69
		composite.add(vue.asWidget());
96
		vue.startChargement();
Line 70... Line 97...
70
		vue.startChargement();
97
		rechercherImagesEtCreerWidgetPagination();
Line -... Line 98...
-
 
98
		gererEvenements();
-
 
99
		chargerProtocoles();
-
 
100
	}
-
 
101
 
-
 
102
	public void gererEvenements() {
-
 
103
 
-
 
104
		vue.getListeProtocoles().addChangeHandler(new ChangeHandler() {
-
 
105
 
71
		rechercherImagesEtCreerWidgetPagination();
106
			@Override
Line 72... Line 107...
72
		gererEvenements();
107
			public void onChange(ChangeEvent event) {
73
	}
108
				surChangementProtocole();
74
 
109
			}
Line 132... Line 167...
132
				}
167
				}
133
			}
168
			}
134
		});
169
		});
135
	}
170
	}
Line -... Line 171...
-
 
171
 
-
 
172
	public void surChangementProtocole() {
-
 
173
		Protocole protocoleCourant = null;
-
 
174
		for (Protocole protocole : protocoles) {
-
 
175
			if (protocole.getId() == vue.getIdProtocoleSelectionne()) {
-
 
176
				protocoleCourant = protocole;
-
 
177
			}
-
 
178
		}
-
 
179
 
-
 
180
		CacheClient.getInstance().setProtocoleCourant(protocoleCourant);
-
 
181
		EvenementChangementProtocole evenement = new EvenementChangementProtocole(protocoleCourant);
-
 
182
		BusEvenementiel.getInstance().fireEvent(evenement);
-
 
183
	}
-
 
184
	
-
 
185
	private void chargerProtocoles() {
-
 
186
		protocoles = protocoleService.getProtocoles();
-
 
187
		for (Protocole protocole : protocoles) {
-
 
188
			vue.ajouterProtocole(protocole.getNom());
-
 
189
		}
-
 
190
		vue.selectionnerProtocole(protocoles.indexOf(CacheClient.getInstance().getProtocoleCourant()));
-
 
191
	}
136
 
192
	
Line 137... Line 193...
137
	public void rechercherImagesEtCreerWidgetPagination() {
193
	public void rechercherImagesEtCreerWidgetPagination() {
138
 
194
 
139
		// appel du service d'image pour avoir le nb total d'elements pour la
195
		// appel du service d'image pour avoir le nb total d'elements pour la