/src/org/tela_botanica/del/client/vues/comparaisoneflore/ComparaisonEfloreVue.ui.xml |
---|
1,6 → 1,8 |
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' |
xmlns:g='urn:import:com.google.gwt.user.client.ui'> |
<ui:with field='res' type='org.tela_botanica.del.client.Ressources' /> |
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary" /> |
8,30 → 10,49 |
<g:VerticalPanel> |
<g:HorizontalPanel> |
<g:VerticalPanel> |
<g:Label text="{constants.taxon_a_determiner} : " /> |
<g:Label text="{constants.taxon_a_determiner} : " /> |
<g:HorizontalPanel> |
<g:Image ui:field="imagePrincipale" /> |
</g:HorizontalPanel> |
<g:HTML> |
<br /> |
</g:HTML> |
<g:HorizontalPanel> |
<g:Label text="{constants.nom_retenu} : " /> |
<g:Label ui:field="nomEspece">Nom</g:Label> |
<g:Label text="{constants.metadonnees_photo} : " /> |
</g:HorizontalPanel> |
<g:HTML> |
<br /> |
</g:HTML> |
<g:HorizontalPanel> |
<g:Label text="{constants.observateur} : " /> |
<g:Label ui:field="nomAuteur">Auteur</g:Label> |
<g:Label ui:field="nomAuteur"></g:Label> |
</g:HorizontalPanel> |
<g:Label text="----------------" /> |
<g:HorizontalPanel> |
<g:Label text="{constants.date_observation} : " /> |
<g:Label ui:field="dateObservation">Date</g:Label> |
<g:Label ui:field="dateObservation"></g:Label> |
</g:HorizontalPanel> |
<g:Label text="----------------" /> |
<g:HorizontalPanel> |
<g:Label text="{constants.famille} : " /> |
<g:Label ui:field="famille">Famille</g:Label> |
<g:Label text="{constants.commentaires} : " /> |
<g:Label ui:field="famille"></g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label text="{constants.localite} : " /> |
<g:Label ui:field="localite">Localite</g:Label> |
<g:Label text="{constants.mots_clefs} : " /> |
<g:Label ui:field="motsClefs"></g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label text="{constants.valide_par} : " /> |
<g:Label ui:field="validateurs"></g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label text="{constants.date_validation} : " /> |
<g:Label ui:field="dateValidation"></g:Label> |
</g:HorizontalPanel> |
</g:VerticalPanel> |
<g:VerticalPanel> |
<g:Label text="{constants.image_eflore} : " /> |
40,19 → 61,32 |
<g:Image ui:field="imageEflore" /> |
<g:Image ui:field="scrollRightImage" resource='{res.arrowRight}' /> |
</g:HorizontalPanel> |
<g:HTML> |
<br /> |
</g:HTML> |
<g:HorizontalPanel> |
<g:Label text="{constants.nom_retenu} : " /> |
<g:Label ui:field="nomEspeceEflore">Nom</g:Label> |
<g:Label text="{constants.metadonnees_photo} : " /> |
</g:HorizontalPanel> |
<g:HTML> |
<br /> |
</g:HTML> |
<g:HorizontalPanel> |
<g:Label text="{constants.observateur} : " /> |
<g:Label ui:field="nomAuteurEflore">Auteur</g:Label> |
<g:Label text="{constants.taxon} : " /> |
<g:Label ui:field="nomEspeceEflore"></g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label text="{constants.localite} : " /> |
<g:Label ui:field="localiteEflore">Localite</g:Label> |
<g:Label ui:field="dateObservationEflore">Date</g:Label> |
<g:Label ui:field="localiteEflore"></g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label text="{constants.auteur} : " /> |
<g:Label ui:field="nomAuteurEflore"></g:Label> |
</g:HorizontalPanel> |
<g:HorizontalPanel> |
<g:Label text="{constants.transmis_le} : " /> |
<g:Label ui:field="dateObservationEflore"></g:Label> |
</g:HorizontalPanel> |
</g:VerticalPanel> |
</g:HorizontalPanel> |
</g:VerticalPanel> |
/src/org/tela_botanica/del/client/vues/comparaisoneflore/ComparaisonEflorePresenteur.java |
---|
3,6 → 3,7 |
import java.util.List; |
import org.tela_botanica.del.client.modeles.Observation; |
import org.tela_botanica.del.client.modeles.ObservationValidation; |
import org.tela_botanica.del.client.utils.MockDatasource; |
import com.google.gwt.event.dom.client.ClickEvent; |
15,12 → 16,14 |
private final MockDatasource observationService = MockDatasource.getInstance(); |
private final MockDatasource validationService = MockDatasource.getInstance(); |
private Observation observationPrincipale; |
private String nomTaxonComparaison; |
private List<Observation> observationsEflore ; |
private List<Observation> observationsEflore; |
public ComparaisonEflorePresenteur(Observation observationPrincipale, String nomTaxonComparaison) { |
this.observationPrincipale = observationPrincipale; |
this.nomTaxonComparaison = nomTaxonComparaison; |
28,11 → 31,17 |
public void go(HasWidgets composite) { |
composite.add(vue); |
chargerValidationObservationPrincipale(); |
vue.chargerImagePrincipale(observationPrincipale); |
chargerObservationsEflore(); |
gererEvenements(); |
} |
private void chargerValidationObservationPrincipale() { |
List<ObservationValidation> observationValidations = validationService.getValidationData(observationPrincipale.getIdImage()); |
observationPrincipale.setImageCelValidationDatas(observationValidations); |
} |
private void chargerObservationsEflore() { |
observationsEflore = observationService.getObservationsEfloreParTaxon(nomTaxonComparaison); |
vue.chargerImagesEflore(observationsEflore, 0); |
43,15 → 52,15 |
@Override |
public void onClick(ClickEvent event) { |
vue.chargerImagesEflore(observationsEflore, vue.getCurrentIndexImages()-1); |
vue.chargerImagesEflore(observationsEflore, vue.getCurrentIndexImages() - 1); |
} |
}); |
vue.getScrollRightImage().addClickHandler(new ClickHandler() { |
@Override |
public void onClick(ClickEvent event) { |
vue.chargerImagesEflore(observationsEflore, vue.getCurrentIndexImages()+1); |
vue.chargerImagesEflore(observationsEflore, vue.getCurrentIndexImages() + 1); |
} |
}); |
} |
/src/org/tela_botanica/del/client/vues/comparaisoneflore/ComparaisonEfloreVue.java |
---|
1,10 → 1,14 |
package org.tela_botanica.del.client.vues.comparaisoneflore; |
import java.util.Date; |
import java.util.List; |
import org.tela_botanica.del.client.modeles.Observation; |
import org.tela_botanica.del.client.modeles.ObservationValidation; |
import com.google.gwt.core.client.GWT; |
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; |
20,7 → 24,7 |
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class); |
@UiField |
Label nomEspece, nomAuteur, dateObservation, famille, localite; |
Label nomAuteur, dateObservation, famille, motsClefs, validateurs, dateValidation; |
@UiField |
Label nomEspeceEflore, nomAuteurEflore, localiteEflore, dateObservationEflore; |
45,18 → 49,43 |
protected void chargerImagePrincipale(Observation observationPrincipale) { |
nomEspece.setText(observationPrincipale.getSpecies()); |
// mots clefs |
String motsClefsConcatenes = ""; |
for (String motClef : observationPrincipale.getMotsClefs()) { |
motsClefsConcatenes += motClef + ","; |
} |
motsClefsConcatenes = motsClefsConcatenes.subSequence(0, motsClefsConcatenes.lastIndexOf(",")).toString(); |
// validateurs |
String validateursConcatenes = ""; |
for (ObservationValidation observationValidation : observationPrincipale.getImageCelValidationDatas()) { |
validateursConcatenes += observationValidation.getContributor() + ","; |
} |
validateursConcatenes = validateursConcatenes.subSequence(0, validateursConcatenes.lastIndexOf(",")).toString(); |
// date derniere validation |
Date dateDerniereValidation = null; |
for (ObservationValidation observationValidation : observationPrincipale.getImageCelValidationDatas()) { |
if (dateDerniereValidation == null) { |
dateDerniereValidation = observationValidation.getDate(); |
} else if (dateDerniereValidation.before(observationValidation.getDate())) { |
dateDerniereValidation = observationValidation.getDate(); |
} |
} |
motsClefs.setText(motsClefsConcatenes); |
nomAuteur.setText(observationPrincipale.getAuteur()); |
imagePrincipale.setUrl(observationPrincipale.getUrl()); |
dateObservation.setText(observationPrincipale.getDate()); |
famille.setText(observationPrincipale.getFamille()); |
localite.setText(observationPrincipale.getLocalite()); |
validateurs.setText(validateursConcatenes); |
dateValidation.setText(DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(dateDerniereValidation)); |
} |
protected void chargerImagesEflore(List<Observation> observationsEflore, int indexImage) { |
if (indexImage >= 0 && indexImage <observationsEflore.size()) { |
if (indexImage >= 0 && indexImage < observationsEflore.size()) { |
currentIndexImages = indexImage; |
} |