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; |
} |
} |