650 |
gduche |
1 |
package org.tela_botanica.del.client.vues.plateformedetermination.ligneProtocole;
|
649 |
gduche |
2 |
|
|
|
3 |
import org.tela_botanica.del.client.cache.CacheClient;
|
1045 |
benjamin |
4 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
649 |
gduche |
5 |
import org.tela_botanica.del.client.composants.votes.moyennevotes.MoyenneVotePresenteur;
|
|
|
6 |
import org.tela_botanica.del.client.composants.votes.moyennevotes.MoyenneVoteVue;
|
848 |
aurelien |
7 |
import org.tela_botanica.del.client.modeles.Image;
|
649 |
gduche |
8 |
import org.tela_botanica.del.client.modeles.Protocole;
|
1045 |
benjamin |
9 |
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
|
|
|
10 |
import org.tela_botanica.del.client.navigation.evenement.changementimagevalidation.EvenementChangementImageValidation;
|
|
|
11 |
import org.tela_botanica.del.client.navigation.evenement.changementimagevalidation.GestionnaireEvenementChangementImageValidation;
|
959 |
benjamin |
12 |
import org.tela_botanica.del.client.services.rest.VoteProtocoleServiceConcret;
|
|
|
13 |
|
649 |
gduche |
14 |
import com.google.gwt.user.client.ui.HasWidgets;
|
|
|
15 |
import com.google.gwt.user.client.ui.IsWidget;
|
|
|
16 |
|
1045 |
benjamin |
17 |
public class LigneProtocolePresenteur extends Presenteur {
|
649 |
gduche |
18 |
|
|
|
19 |
public interface Vue extends IsWidget {
|
|
|
20 |
|
|
|
21 |
void setNom(String nom);
|
959 |
benjamin |
22 |
|
649 |
gduche |
23 |
HasWidgets getZoneVote();
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
private Vue vue;
|
|
|
27 |
private Protocole protocole;
|
|
|
28 |
|
|
|
29 |
public LigneProtocolePresenteur(Protocole protocole, Vue vue) {
|
|
|
30 |
this.vue = vue;
|
|
|
31 |
this.protocole = protocole;
|
|
|
32 |
setNom(protocole.getNom());
|
1045 |
benjamin |
33 |
chargerValeursProtocolePourImageCourante();
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
public void chargerValeursProtocolePourImageCourante(){
|
|
|
37 |
vue.getZoneVote().clear();
|
848 |
aurelien |
38 |
Image imageCourante = CacheClient.getInstance().getImageCourante();
|
959 |
benjamin |
39 |
MoyenneVotePresenteur votePresenteur = new MoyenneVotePresenteur(imageCourante, protocole, new MoyenneVoteVue(), new VoteProtocoleServiceConcret());
|
649 |
gduche |
40 |
votePresenteur.go(vue.getZoneVote());
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
public void setNom(String nom) {
|
|
|
44 |
vue.setNom(nom);
|
|
|
45 |
}
|
959 |
benjamin |
46 |
|
649 |
gduche |
47 |
public Vue getVue() {
|
|
|
48 |
return vue;
|
|
|
49 |
}
|
959 |
benjamin |
50 |
|
649 |
gduche |
51 |
public void go(HasWidgets composite) {
|
|
|
52 |
composite.add(vue.asWidget());
|
1045 |
benjamin |
53 |
gererEvenements();
|
649 |
gduche |
54 |
}
|
1045 |
benjamin |
55 |
|
|
|
56 |
@Override
|
|
|
57 |
protected void gererEvenements() {
|
|
|
58 |
BusEvenementiel.getInstance().addHandler(EvenementChangementImageValidation.TYPE, new GestionnaireEvenementChangementImageValidation() {
|
|
|
59 |
|
|
|
60 |
@Override
|
|
|
61 |
public void onChangementImage(EvenementChangementImageValidation event) {
|
|
|
62 |
chargerValeursProtocolePourImageCourante();
|
|
|
63 |
}
|
|
|
64 |
});
|
|
|
65 |
}
|
649 |
gduche |
66 |
}
|