Subversion Repositories eFlore/Applications.del

Rev

Rev 650 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
650 gduche 1
package org.tela_botanica.del.client.vues.plateformedetermination.ligneProtocole;
649 gduche 2
 
3
 
4
import org.tela_botanica.del.client.cache.CacheClient;
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;
9
import com.google.gwt.user.client.ui.HasWidgets;
10
import com.google.gwt.user.client.ui.IsWidget;
11
 
12
public class LigneProtocolePresenteur {
13
 
14
	public interface Vue extends IsWidget {
15
 
16
		void setNom(String nom);
17
		HasWidgets getZoneVote();
18
	}
19
 
20
	private Vue vue;
21
	private Protocole protocole;
22
 
23
	public LigneProtocolePresenteur(Protocole protocole, Vue vue) {
24
		this.vue = vue;
25
		this.protocole = protocole;
26
		setNom(protocole.getNom());
848 aurelien 27
		Image imageCourante = CacheClient.getInstance().getImageCourante();
28
		if(imageCourante == null) {
29
			// on suppose qu'il y a toujours au moins une image associée à l'observation en cours
30
			imageCourante = CacheClient.getInstance().getObservationCourante().getImages().get(0);
31
		}
32
 
33
		MoyenneVotePresenteur votePresenteur = new MoyenneVotePresenteur(imageCourante, protocole, new MoyenneVoteVue());
649 gduche 34
		votePresenteur.go(vue.getZoneVote());
35
	}
36
 
37
	public void setNom(String nom) {
38
		vue.setNom(nom);
39
	}
40
 
41
	public Vue getVue() {
42
		return vue;
43
	}
44
 
45
	public void go(HasWidgets composite) {
46
		composite.add(vue.asWidget());
47
	}
48
}