Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 249 → Rev 250

/trunk/src/org/tela_botanica/del/client/vues/rechercheimages/resultats/images/ImagePresenteur.java
2,6 → 2,7
 
import java.util.List;
 
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.VoteProtocole;
10,6 → 11,7
import org.tela_botanica.del.client.utils.MockDatasource;
import org.tela_botanica.del.client.vues.rechercheimages.resultats.ResultatRechercheImagePresenteur;
import org.tela_botanica.del.client.vues.rechercheimages.vote.MoyenneVotePresenteur;
import org.tela_botanica.del.client.vues.rechercheobservations.DetailImagePresenteur;
 
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
17,10 → 19,9
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
 
public class ImagePresenteur {
public class ImagePresenteur extends Presenteur {
 
private final MockDatasource validationService = MockDatasource.getInstance();
private ImageVue vue = new ImageVue();
private final Image image;
private boolean detailsOpen = false;
 
27,27 → 28,39
private Protocole protocole;
 
public ImagePresenteur(Image image, Protocole protocole) {
super(new ImageVue());
this.image = image;
this.protocole = protocole;
}
 
public void go(HasWidgets composite) {
boolean etrange = (this == null);
Object ca = this.getVue();
ImageVue vue = (ImageVue) this.getVue();
composite.add(vue);
vue.loadImage(image);
loadValidationData();
handleEvents();
 
gererEvenements();
}
 
private void loadValidationData() {
 
ImageVue vue = (ImageVue) this.getVue();
List<VoteProtocole> observationValidationDatas = validationService.getVoteByImageAndProtocol(image.getIdImage(), protocole.getNom());
new MoyenneVotePresenteur(observationValidationDatas).go(vue.voter);
 
}
 
private void handleEvents() {
 
@Override
protected void gererEvenements() {
ImageVue vue = (ImageVue) this.getVue();
vue.imagePrincipale.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
com.google.gwt.user.client.ui.Image photo = (com.google.gwt.user.client.ui.Image) event.getSource();
ouvrirFenetreModale(new DetailImagePresenteur(photo.getTitle(), photo.getAltText()));
}
});
vue.enSavoirPlus.addClickHandler(new ClickHandler() {
 
@Override
58,7 → 71,6
} else {
cacherDetails();
}
 
}
});
 
72,6 → 84,7
}
 
public void cacherDetails() {
ImageVue vue = (ImageVue) this.getVue();
VerticalPanel zoneCache = vue.zoneCache;
Label enSavoirPlus = vue.enSavoirPlus;
 
82,6 → 95,7
}
 
public void afficherDetails() {
ImageVue vue = (ImageVue) this.getVue();
ResultatRechercheImagePresenteur.getInstance().fermerTousPanneauxDetailsObservations();
 
VerticalPanel zoneCache = vue.zoneCache;
97,7 → 111,4
return detailsOpen;
}
 
public ImageVue getVue() {
return vue;
}
}