103 |
benjamin |
1 |
package org.tela_botanica.del.client.vues.plateformedetermination.vote;
|
|
|
2 |
|
629 |
aurelien |
3 |
import java.util.HashMap;
|
103 |
benjamin |
4 |
import java.util.List;
|
|
|
5 |
|
|
|
6 |
import org.tela_botanica.del.client.cache.CacheClient;
|
500 |
aurelien |
7 |
import org.tela_botanica.del.client.modeles.Image;
|
103 |
benjamin |
8 |
import org.tela_botanica.del.client.modeles.Protocole;
|
148 |
benjamin |
9 |
import org.tela_botanica.del.client.modeles.VoteProtocole;
|
286 |
benjamin |
10 |
import org.tela_botanica.del.client.services.rest.ProtocoleService;
|
|
|
11 |
import org.tela_botanica.del.client.services.rest.VoteProtocoleService;
|
103 |
benjamin |
12 |
import org.tela_botanica.del.client.utils.MockDatasource;
|
116 |
benjamin |
13 |
import org.tela_botanica.del.client.vues.plateformedetermination.vote.protocole.moyenne.MoyenneVoteProtocolePresenteur;
|
103 |
benjamin |
14 |
|
500 |
aurelien |
15 |
import com.google.gwt.user.client.Window;
|
103 |
benjamin |
16 |
import com.google.gwt.user.client.ui.HasWidgets;
|
298 |
benjamin |
17 |
import com.google.gwt.user.client.ui.IsWidget;
|
103 |
benjamin |
18 |
|
|
|
19 |
public class EnsembleVotesPresenteur {
|
|
|
20 |
|
298 |
benjamin |
21 |
public interface Vue extends IsWidget {
|
|
|
22 |
public HasWidgets getPanneauVotes();
|
|
|
23 |
}
|
103 |
benjamin |
24 |
|
298 |
benjamin |
25 |
private Vue vue;
|
286 |
benjamin |
26 |
private ProtocoleService protocoleService = MockDatasource.getInstance();
|
103 |
benjamin |
27 |
|
298 |
benjamin |
28 |
public EnsembleVotesPresenteur(Vue vue) {
|
|
|
29 |
this.vue = vue;
|
|
|
30 |
}
|
|
|
31 |
|
103 |
benjamin |
32 |
public void go(HasWidgets container) {
|
298 |
benjamin |
33 |
container.add(vue.asWidget());
|
103 |
benjamin |
34 |
afficherVotes();
|
|
|
35 |
}
|
|
|
36 |
|
298 |
benjamin |
37 |
public void afficherVotes() {
|
103 |
benjamin |
38 |
|
500 |
aurelien |
39 |
Image imageCourante = CacheClient.getInstance().getImageCourante();
|
116 |
benjamin |
40 |
|
286 |
benjamin |
41 |
Protocole protocoleEsthetisme = protocoleService.getProtocole(Protocole.ESTHETISME);
|
629 |
aurelien |
42 |
HashMap<String, VoteProtocole> observationValidationsEsthetisme = imageCourante.getVotesProtocoles(protocoleEsthetisme.getId());
|
116 |
benjamin |
43 |
new MoyenneVoteProtocolePresenteur(protocoleEsthetisme, observationValidationsEsthetisme).go(vue.getPanneauVotes());
|
103 |
benjamin |
44 |
|
286 |
benjamin |
45 |
Protocole protocoleIdentification = protocoleService.getProtocole(Protocole.IDENTIFICATION_AUTOMATIQUE);
|
629 |
aurelien |
46 |
HashMap<String, VoteProtocole> observationValidationsIdentification = imageCourante.getVotesProtocoles(protocoleIdentification.getId());
|
116 |
benjamin |
47 |
new MoyenneVoteProtocolePresenteur(protocoleIdentification, observationValidationsIdentification).go(vue.getPanneauVotes());
|
103 |
benjamin |
48 |
}
|
|
|
49 |
}
|