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