Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 1061 → Rev 1062

/trunk/src/org/tela_botanica/del/client/vues/comparaisoneflore/ComparaisonEfloreVue.ui.xml
7,7 → 7,10
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary" />
<ui:style src="comparaisonEflore.css" />
<g:HorizontalPanel styleName="{style.zoneComparaison}">
<g:HTMLPanel >
<g:HTMLPanel ui:field="formulaireRecherche" styleName="{style.zoneComparaison}" />
<g:HorizontalPanel styleName="{style.zoneComparaison}" >
<g:VerticalPanel styleName="{style.photoPrincipale} arrondi">
<g:Label text="{constants.taxonADeterminer}" styleName="titre" />
<g:Label text="{constants.taxonADeterminer}" styleName="petit" />
15,46 → 18,44
 
<g:HTMLPanel styleName="{style.meta}">
<g:Label text="{constants.metadonneesPhoto}" styleName="titre" />
<g:Label text="{constants.metadonneesPhoto}" styleName="petit" />
 
<br />
<g:Label text="{constants.observateur}" styleName="petit" />
<g:Label ui:field="nomAuteurTitre" text="{constants.observateur}" styleName="petit" />
<g:Label ui:field="nomAuteur" />
<g:Label text="{constants.dateObservation}" styleName="petit" />
<g:Label ui:field="dateObservationTitre" text="{constants.dateObservation}" styleName="petit" />
<g:Label ui:field="dateObservation" />
<g:Label text="{constants.commentaires}" styleName="petit" />
<g:Label ui:field="familleTitre" text="{constants.famille}" styleName="petit" />
<g:Label ui:field="famille" />
 
<g:Label text="{constants.motsClefs}" styleName="petit" />
<g:Label ui:field="commentairesTitre" text="{constants.commentaires}" styleName="petit" />
<g:Label ui:field="commentaires" />
<g:Label ui:field="motsClefsTitre" text="{constants.motsClefs}" styleName="petit" />
<g:Label ui:field="motsClefs" />
 
<br />
<g:Label text="{constants.validePar}" styleName="petit" />
<g:Label ui:field="validateurs" />
 
<g:Label text="{constants.dateValidation}" styleName="petit" />
<g:Label ui:field="dateValidation" />
<g:Label ui:field="nomRetenuTitre" text="{constants.nomRetenu}" styleName="petit" />
<g:Label ui:field="nomRetenu" />
<g:Label ui:field="nomCommunTitre" styleName="petit" text="{constants.nomCommun}" />
<g:Label ui:field="nomCommun" />
<g:Label ui:field="localiteTitre" styleName="petit" text="{constants.lieuDuReleve}" />
<g:Label ui:field="localite" />
<g:Label ui:field="milieuTitre" styleName="petit" text="{constants.milieu}" />
<g:Label ui:field="milieu"/>
</g:HTMLPanel>
 
</g:VerticalPanel>
<g:VerticalPanel styleName="{style.photoComparee} arrondi">
<g:VerticalPanel ui:field="panneauChargement">
<g:Image url="./img/wait.gif"></g:Image>
</g:VerticalPanel>
<g:Label text="{constants.imageEflore}" styleName="titre" />
<g:Label text="{constants.imageEflore}" styleName="petit" />
<g:Label ui:field="texteEflore" text="{constants.imageEflore}" styleName="petit" />
 
<g:Image ui:field="imageEflore" />
<g:HorizontalPanel styleName="{style.fleches}">
<g:Image ui:field="scrollLeftImage" resource='{res.arrowLeft}'
styleName="gauche" />
styleName="gauche" visible="false" />
<g:Image ui:field="scrollRightImage" resource='{res.arrowRight}'
styleName="droite" />
styleName="droite" visible="false" />
</g:HorizontalPanel>
 
<g:HTMLPanel styleName="{style.meta}">
<g:HTMLPanel ui:field="metadonneesEflore" styleName="{style.meta}">
<g:Label text="{constants.metadonneesPhoto}" styleName="titre" />
<g:Label text="{constants.metadonneesPhoto}" styleName="petit" />
 
<g:Label text="{constants.taxon}" styleName="petit" />
<g:Label ui:field="nomEspeceEflore" />
70,4 → 71,5
</g:HTMLPanel>
</g:VerticalPanel>
</g:HorizontalPanel>
</g:HTMLPanel>
</ui:UiBinder>
/trunk/src/org/tela_botanica/del/client/vues/comparaisoneflore/ComparaisonEflorePresenteur.java
1,5 → 1,6
package org.tela_botanica.del.client.vues.comparaisoneflore;
 
import java.util.ArrayList;
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
6,13 → 7,18
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
import org.tela_botanica.del.client.navigation.evenement.comparaisoneflore.EvenementComparaisonEflore;
import org.tela_botanica.del.client.navigation.evenement.comparaisoneflore.GestionnaireEvenementComparaisonEflore;
import org.tela_botanica.del.client.services.rest.ImageService;
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
import org.tela_botanica.del.client.vues.plateformedetermination.formulairerechercheeflore.FormulaireRechercheEflorePresenteur;
 
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
 
32,6 → 38,12
public void startChargement();
 
public void stopChargement();
 
public void afficherAucuneImageTrouvee();
 
public HTMLPanel getFormulaireRecherche();
public void setCurrentIndexImages(int index);
}
 
private Vue vue;
39,7 → 51,9
 
private Image imagePrincipale;
private String nomTaxonComparaison;
private List<org.tela_botanica.del.client.modeles.Image> imagesEflore;
private List<org.tela_botanica.del.client.modeles.Image> imagesEflore = new ArrayList<Image>();
private int page = 0;
private int nbImagesPreFetch = 10;
 
public ComparaisonEflorePresenteur(Vue vue, ImageService imageService) {
this.vue = vue;
53,10 → 67,14
vue.chargerImagePrincipale(imagePrincipale);
chargerObservationsEflore();
gererEvenements();
new FormulaireRechercheEflorePresenteur().go(vue.getFormulaireRecherche());
}
 
public void chargerObservationsEflore() {
 
int debut = (page * nbImagesPreFetch) + 1;
int fin = (page + 1) * nbImagesPreFetch;
 
vue.startChargement();
 
InformationsRecherche informationsRecherche = new InformationsRecherche();
66,24 → 84,24
 
@Override
public void surRetour(ImageServiceResultat imagesRecues) {
if (imagesRecues == null||imagesRecues.getImages()==null||imagesRecues.getImages().size()==0) {
vue.stopChargement();
if (imagesRecues == null || imagesRecues.getImages() == null || imagesRecues.getImages().size() == 0) {
vue.afficherAucuneImageTrouvee();
} else {
setImagesEflore(imagesRecues.getImages());
vue.chargerImagesEflore(imagesRecues.getImages(), 0);
addImagesEflore(imagesRecues.getImages());
vue.stopChargement();
vue.chargerImagesEflore(imagesEflore, vue.getCurrentIndexImages());
}
}
 
@Override
public void surErreur(String messageErreur) {
vue.afficherAucuneImageTrouvee();
Window.alert(messageErreur);
 
}
 
};
 
imageService.getImagesParTaxon(informationsRecherche, 1, 100, callback);
imageService.getImagesParTaxon(informationsRecherche, debut, fin, callback);
 
}
 
100,9 → 118,25
 
@Override
public void onClick(ClickEvent event) {
vue.chargerImagesEflore(imagesEflore, vue.getCurrentIndexImages() + 1);
 
if (vue.getCurrentIndexImages() == imagesEflore.size() - 1) {
page += 1;
vue.setCurrentIndexImages(vue.getCurrentIndexImages()+1);
chargerObservationsEflore();
} else {
vue.chargerImagesEflore(imagesEflore, vue.getCurrentIndexImages() + 1);
}
}
});
 
BusEvenementiel.getInstance().addHandler(EvenementComparaisonEflore.TYPE, new GestionnaireEvenementComparaisonEflore() {
 
@Override
public void onComparaisonEflore(EvenementComparaisonEflore event) {
nomTaxonComparaison = event.getTaxonDemande();
chargerObservationsEflore();
}
});
}
 
public List<org.tela_botanica.del.client.modeles.Image> getImagesEflore() {
109,8 → 143,8
return imagesEflore;
}
 
public void setImagesEflore(List<org.tela_botanica.del.client.modeles.Image> imagesEflore) {
this.imagesEflore = imagesEflore;
public void addImagesEflore(List<org.tela_botanica.del.client.modeles.Image> imagesEflore) {
this.imagesEflore.addAll(imagesEflore);
}
 
}
/trunk/src/org/tela_botanica/del/client/vues/comparaisoneflore/ComparaisonEfloreVue.java
1,17 → 1,16
package org.tela_botanica.del.client.vues.comparaisoneflore;
 
import java.util.Date;
import java.util.List;
 
import org.tela_botanica.del.client.modeles.VoteProtocole;
import org.tela_botanica.del.client.i18n.I18n;
import org.tela_botanica.del.client.utils.StringUtils;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
23,17 → 22,23
}
 
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
private int currentIndexImages;
private int currentIndexImages=0;
 
@UiField
Label nomAuteur, dateObservation, famille, motsClefs, validateurs, dateValidation, nomEspeceEflore, nomAuteurEflore, localiteEflore, dateObservationEflore;
Label nomAuteur, dateObservation, famille, motsClefs, nomRetenu, nomCommun, localite, milieu, commentaires, nomEspeceEflore, nomAuteurEflore, localiteEflore, dateObservationEflore, texteEflore;
 
@UiField
Label nomAuteurTitre, dateObservationTitre, familleTitre, motsClefsTitre, nomRetenuTitre, nomCommunTitre, localiteTitre, milieuTitre, commentairesTitre;
 
@UiField
Image imagePrincipale, imageEflore, scrollLeftImage, scrollRightImage;
 
@UiField
Panel panneauChargement;
 
@UiField
HTMLPanel formulaireRecherche, metadonneesEflore;
 
public ComparaisonEfloreVue() {
initWidget(uiBinder.createAndBindUi(this));
}
51,45 → 56,70
// TODO: handle exception
}
 
// validateurs
String validateursConcatenes = "";
try {
/*for (VoteProtocole observationValidation : image.getVoteProtocoles()) {
validateursConcatenes += observationValidation.getContributeur() + ", ";
}*/
validateursConcatenes = validateursConcatenes.subSequence(0, validateursConcatenes.lastIndexOf(",")).toString();
} catch (Exception e) {
 
if (StringUtils.checkStringNotNull(motsClefsConcatenes)) {
motsClefs.setText(motsClefsConcatenes);
} else {
motsClefs.setVisible(false);
motsClefsTitre.setVisible(false);
}
 
// date derniere validation
Date dateDerniereValidation = null;
try {
/*for (VoteProtocole observationValidation : image.getVoteProtocoles()) {
if (dateDerniereValidation == null) {
dateDerniereValidation = observationValidation.getDate();
} else if (dateDerniereValidation.before(observationValidation.getDate())) {
dateDerniereValidation = observationValidation.getDate();
}
}*/
} catch (Exception e) {
if (StringUtils.checkStringNotNull(image.getObservation().getAuteur())) {
nomAuteur.setText(image.getObservation().getAuteur());
} else {
nomAuteur.setVisible(false);
nomAuteurTitre.setVisible(false);
}
 
motsClefs.setText(motsClefsConcatenes);
nomAuteur.setText(image.getObservation().getAuteur());
imagePrincipale.setUrl(image.getUrl());
dateObservation.setText(image.getObservation().getDateReleve());
famille.setText(image.getObservation().getFamille());
validateurs.setText(validateursConcatenes);
 
if (dateDerniereValidation != null) {
dateValidation.setText(DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(dateDerniereValidation));
if (StringUtils.checkStringNotNull(image.getUrl())) {
imagePrincipale.setUrl(image.getUrl());
}
if (StringUtils.checkStringNotNull(image.getObservation().getDateReleve())) {
dateObservation.setText(image.getObservation().getDateReleve());
} else {
dateObservation.setVisible(false);
dateObservationTitre.setVisible(false);
}
if (StringUtils.checkStringNotNull(image.getObservation().getFamille())) {
famille.setText(image.getObservation().getFamille());
} else {
famille.setVisible(false);
familleTitre.setVisible(false);
}
if (StringUtils.checkStringNotNull(image.getObservation().getNomRetenu())) {
nomRetenu.setText(image.getObservation().getNomRetenu());
} else {
nomRetenu.setVisible(false);
nomRetenuTitre.setVisible(false);
}
if (StringUtils.checkStringNotNull(image.getObservation().getNomCommun())) {
nomCommun.setText(image.getObservation().getNomCommun());
} else {
nomCommun.setVisible(false);
nomCommunTitre.setVisible(false);
}
if (StringUtils.checkStringNotNull(image.getObservation().getLocaliteAvecIdFormatee())) {
localite.setText(image.getObservation().getLocaliteAvecIdFormatee());
} else {
localite.setVisible(false);
localiteTitre.setVisible(false);
}
if (StringUtils.checkStringNotNull(image.getObservation().getMilieu())) {
milieu.setText(image.getObservation().getMilieu());
} else {
milieu.setVisible(false);
milieuTitre.setVisible(false);
}
if (StringUtils.checkStringNotNull(image.getObservation().getCommentaire())) {
commentaires.setText(image.getObservation().getCommentaire());
} else {
commentaires.setVisible(false);
commentairesTitre.setVisible(false);
}
 
}
 
public void chargerImagesEflore(List<org.tela_botanica.del.client.modeles.Image> observationsEflore, int indexImage) {
 
texteEflore.setText(I18n.getVocabulary().imageEflore());
 
if (indexImage >= 0 && indexImage < observationsEflore.size()) {
currentIndexImages = indexImage;
}
101,7 → 131,13
imageEflore.setUrl(observationEflore.getUrl());
dateObservationEflore.setText(observationEflore.getObservation().getDateReleve());
localiteEflore.setText(observationEflore.getObservation().getLocalite());
metadonneesEflore.setVisible(true);
imageEflore.setVisible(true);
 
if (observationsEflore.size() > 1) {
scrollLeftImage.setVisible(true);
scrollRightImage.setVisible(true);
}
}
 
public void setScrollLeftImage(Image scrollLeftImage) {
123,6 → 159,11
}
 
public void startChargement() {
texteEflore.setText(I18n.getVocabulary().chargement());
metadonneesEflore.setVisible(false);
imageEflore.setVisible(false);
scrollLeftImage.setVisible(false);
scrollRightImage.setVisible(false);
panneauChargement.setVisible(true);
}
 
130,6 → 171,13
panneauChargement.setVisible(false);
}
 
public void afficherAucuneImageTrouvee() {
texteEflore.setText(I18n.getVocabulary().aucunResultat());
scrollLeftImage.setVisible(false);
scrollRightImage.setVisible(false);
panneauChargement.setVisible(false);
}
 
public Label getNomAuteur() {
return nomAuteur;
}
138,4 → 186,11
return imagePrincipale;
}
 
public HTMLPanel getFormulaireRecherche() {
return formulaireRecherche;
}
 
public void setCurrentIndexImages(int index){
currentIndexImages=index;
}
}