/trunk/src/org/tela_botanica/del/client/composants/formulaires/autocompletion/AutoCompletionComboBoxVue.java |
---|
8,7 → 8,6 |
import com.google.gwt.user.client.ui.SuggestBox; |
import com.google.gwt.user.client.ui.SuggestOracle; |
import com.google.gwt.user.client.ui.SuggestOracle.Suggestion; |
import com.google.gwt.view.client.SelectionChangeEvent.HasSelectionChangedHandlers; |
public class AutoCompletionComboBoxVue extends LayoutPanel implements AutoCompletionComboBoxPresenteur.Vue { |
/trunk/src/org/tela_botanica/del/client/i18n/Vocabulary.properties |
---|
103,7 → 103,7 |
#ecran comparaison |
dateObservation = Date de la prise de vue |
taxonADeterminer = Taxon à déterminer |
imageEflore = Photos d'eFlore |
imageEflore = Photos du Carnet en Ligne |
metadonneesPhoto = Meta-donnees de la photo |
motsClefs = Mots-clés |
validePar = Validé par |
/trunk/src/org/tela_botanica/del/client/navigation/evenement/BusEvenementiel.java |
---|
73,7 → 73,6 |
} |
private void doComparaisonAvecEflore(String taxon) { |
CacheClient.getInstance().setTaxonPourRechercheEflore(taxon); |
History.newItem(ConstantesNavigation.PAGE_COMPARAISON_EFLORE, true); |
} |
/trunk/src/org/tela_botanica/del/client/utils/UtilitairesServiceResultat.java |
---|
26,7 → 26,6 |
import com.google.gwt.json.client.JSONObject; |
import com.google.gwt.json.client.JSONParser; |
import com.google.gwt.json.client.JSONValue; |
import com.google.gwt.user.client.Window; |
/** |
* Centralisation des methodes de parsing du code JSON retourné par les |
77,7 → 76,7 |
observation.setId(getValeurOuVide(observationJson, "id_observation")); |
observation.setIdLocalite(getValeurOuVide(observationJson, "id_zone_geo")); |
observation.setLocalite(getValeurOuVide(observationJson, "zone_geo")); |
String nomRetenu = getValeurOuVide(observationJson, "determination.ns"); |
observation.setNomRetenu(getValeurOuVide(observationJson, "determination.ns")); |
observation.setMilieu(getValeurOuVide(observationJson, "milieu")); |
87,27 → 86,30 |
observation.setNumNomenclatural(getValeurOuVide(observationJson, "determination.nn")); |
observation.setMotsClefs(parserMotsCles(UtilitairesServiceResultat.getValeurOuVide(observationJson, "mots_cles_texte"))); |
JSONValue propositions = observationJson.get("commentaires"); |
boolean creerPropositionAPartirObs = true; |
if (propositions != null && propositions.isObject() != null) { |
List<InterventionForum> interventions = parserInterventions(propositions.isObject()); |
for (InterventionForum interventionForum : interventions) { |
interventionForum.setObservation(observation); |
// Si une proposition avec le même nom retenu que l'observation est déjà présente, |
// alors il n'est pas nécessaire de créer la proposition "factice" |
if(interventionForum instanceof PropositionDetermination) { |
PropositionDetermination proposition = (PropositionDetermination)interventionForum; |
if(!nomRetenu.equals("") && proposition.getEspece().equals(nomRetenu)) { |
interventionForum.setObservation(observation); |
// Si une proposition avec le même nom retenu que l'observation |
// est déjà présente, |
// alors il n'est pas nécessaire de créer la proposition |
// "factice" |
if (interventionForum instanceof PropositionDetermination) { |
PropositionDetermination proposition = (PropositionDetermination) interventionForum; |
if (!nomRetenu.equals("") && proposition.getEspece().equals(nomRetenu)) { |
creerPropositionAPartirObs = false; |
} |
} |
} |
} |
observation.setInterventionsForum(interventions); |
} |
if(creerPropositionAPartirObs) { |
// Si elle est nécessaire, la proposition factice est ajoutée au début |
if (creerPropositionAPartirObs) { |
// Si elle est nécessaire, la proposition factice est ajoutée au |
// début |
observation.getInterventionsForum().add(0, creerPropositionDeterminationAPartirObservation(observation)); |
} |
return observation; |
123,7 → 125,7 |
String utilisateurNom = observation.getNomAuteur(); |
String utilisateurPrenom = observation.getPrenomAuteur(); |
String utilisateurCourriel = observation.getCourrielAuteur(); |
String utilisateurId = observation.getIdAuteur(); |
PropositionDetermination propositionDetermination = new PropositionDetermination(observation); |
202,9 → 204,9 |
if (!nbCommentaires.equals("")) { |
int nbComm = Integer.parseInt(nbCommentaires); |
// if (!texte.equals("")) { |
// nbComm++; |
// } |
// if (!texte.equals("")) { |
// nbComm++; |
// } |
intervention.setNbCommentaires(nbComm); |
} |
238,9 → 240,8 |
if (idParent != null && !idParent.equals("") && !idParent.equals("0") && interventionsNonTypees.containsKey(idParent)) { |
InterventionForum parent = interventionsNonTypees.get(idParent); |
intervention.setParent(parent); |
parent.ajouterCommentaire((Commentaire)intervention); |
} |
else{ |
parent.ajouterCommentaire((Commentaire) intervention); |
} else { |
retour.add(intervention); |
} |
} |
470,11 → 471,13 |
double total = retourJson.isObject().get("entete").isObject().get("total").isNumber().doubleValue(); |
nbTotalImagesPourLaRecherche = (int) total; |
JSONObject tableauImg = retourJson.isObject().get("resultats").isObject(); |
java.util.Iterator<String> it = tableauImg.keySet().iterator(); |
while (it.hasNext()) { |
JSONObject imageJson = tableauImg.get(it.next()).isObject(); |
Image image = parserRetourImage(imageJson); |
images.add(image); |
if (tableauImg != null) { |
java.util.Iterator<String> it = tableauImg.keySet().iterator(); |
while (it.hasNext()) { |
JSONObject imageJson = tableauImg.get(it.next()).isObject(); |
Image image = parserRetourImage(imageJson); |
images.add(image); |
} |
} |
} else { |
/trunk/src/org/tela_botanica/del/client/utils/StringUtils.java |
---|
New file |
0,0 → 1,12 |
package org.tela_botanica.del.client.utils; |
public class StringUtils { |
public static boolean checkStringNotNull(String s){ |
if(s!=null&&!s.equals("")){ |
return true; |
} |
return false; |
} |
} |
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/formulairerechercheeflore/FormulaireRechercheEfloreVue.java |
---|
5,29 → 5,32 |
import com.google.gwt.uibinder.client.UiField; |
import com.google.gwt.user.client.ui.Button; |
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.TextBox; |
import com.google.gwt.user.client.ui.Panel; |
import com.google.gwt.user.client.ui.Widget; |
public class FormulaireRechercheEfloreVue extends Composite { |
@UiField(provided = true) |
public TextBox formulaireRechercheObservationEflore = new TextBox(); |
@UiField(provided = true) |
public Button boutonValidationRechercheObservation = new Button(); |
interface FormulaireRechercheEfloreUIiBinder extends UiBinder<Widget, FormulaireRechercheEfloreVue>{}; |
@UiField |
public Panel propositionTaxon; |
interface FormulaireRechercheEfloreUIiBinder extends UiBinder<Widget, FormulaireRechercheEfloreVue> { |
}; |
FormulaireRechercheEfloreUIiBinder uiBinder = GWT.create(FormulaireRechercheEfloreUIiBinder.class); |
public FormulaireRechercheEfloreVue() { |
initWidget(uiBinder.createAndBindUi(this)); |
initWidget(uiBinder.createAndBindUi(this)); |
} |
public TextBox getFormulaireRechercheObservationEflore() { |
return formulaireRechercheObservationEflore; |
} |
public Button getBoutonValidationRechercheObservation() { |
return boutonValidationRechercheObservation; |
} |
public Panel getPropositionTaxon() { |
return propositionTaxon; |
} |
} |
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/formulairerechercheeflore/formulaireRechercheEflore.css |
---|
New file |
0,0 → 1,4 |
.propositionTaxon { |
width: 150px; |
height: 30px; |
} |
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/formulairerechercheeflore/FormulaireRechercheEfloreVue.ui.xml |
---|
4,12 → 4,15 |
xmlns:g='urn:import:com.google.gwt.user.client.ui'> |
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary"/> |
<ui:style src="formulaireRechercheEflore.css" /> |
<g:VerticalPanel> |
<g:Label text="{constants.comparer}" styleName="sousTitre"/> |
<g:Label text="{constants.infoComparer}" styleName="petit"/> |
<g:HTML><br /></g:HTML> |
<g:HorizontalPanel><g:TextBox ui:field="formulaireRechercheObservationEflore"/> |
<g:Button text="{constants.ok}" ui:field="boutonValidationRechercheObservation" /></g:HorizontalPanel> |
<g:HorizontalPanel > |
<g:HTMLPanel ui:field="propositionTaxon" styleName="{style.propositionTaxon}" /> |
<g:Button text="{constants.ok}" ui:field="boutonValidationRechercheObservation" /> |
</g:HorizontalPanel> |
</g:VerticalPanel> |
</ui:UiBinder> |
/trunk/src/org/tela_botanica/del/client/vues/plateformedetermination/formulairerechercheeflore/FormulaireRechercheEflorePresenteur.java |
---|
1,17 → 1,33 |
package org.tela_botanica.del.client.vues.plateformedetermination.formulairerechercheeflore; |
import org.tela_botanica.del.client.cache.CacheClient; |
import org.tela_botanica.del.client.composants.formulaires.autocompletion.AutoCompletionComboBoxPresenteur; |
import org.tela_botanica.del.client.composants.formulaires.autocompletion.AutoCompletionComboBoxVue; |
import org.tela_botanica.del.client.config.Config; |
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.utils.UtilitairesAutoCompletionService; |
import com.google.gwt.event.dom.client.ClickEvent; |
import com.google.gwt.event.dom.client.ClickHandler; |
import com.google.gwt.event.dom.client.KeyCodes; |
import com.google.gwt.event.dom.client.KeyPressEvent; |
import com.google.gwt.event.dom.client.KeyPressHandler; |
import com.google.gwt.http.client.Response; |
import com.google.gwt.user.client.ui.HasWidgets; |
public class FormulaireRechercheEflorePresenteur { |
FormulaireRechercheEfloreVue formulaireRechercheEfloreVue = new FormulaireRechercheEfloreVue(); |
private FormulaireRechercheEfloreVue formulaireRechercheEfloreVue = new FormulaireRechercheEfloreVue(); |
private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur; |
public FormulaireRechercheEflorePresenteur() { |
creerCompletionTaxons(); |
} |
public void go(HasWidgets composite) { |
autoCompletionNomTaxonsPresenteur.go(formulaireRechercheEfloreVue.getPropositionTaxon()); |
composite.add(formulaireRechercheEfloreVue); |
gererEvenements(); |
} |
21,10 → 37,42 |
@Override |
public void onClick(ClickEvent event) { |
EvenementComparaisonEflore evenementComparaisonEflore = new EvenementComparaisonEflore(formulaireRechercheEfloreVue.getFormulaireRechercheObservationEflore().getText()); |
BusEvenementiel.getInstance().fireEvent(evenementComparaisonEflore); |
lancerRechercheEflore(); |
} |
}); |
autoCompletionNomTaxonsPresenteur.getAutoCompletionComboBoxVue().getSuggestBoxHasKeyPressHandlers().addKeyPressHandler(new KeyPressHandler() { |
@Override |
public void onKeyPress(KeyPressEvent event) { |
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { |
lancerRechercheEflore(); |
} |
} |
}); |
} |
private void creerCompletionTaxons() { |
String url = new Config().getServiceBaseUrl() + "nomstaxons"; |
autoCompletionNomTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), url) { |
protected String effectuerPreTraitementChaineRequete(String requete) { |
requete = "?masque.nom=" + requete; |
return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete); |
} |
@Override |
protected String[] parserResultatRequete(Response response) { |
return UtilitairesAutoCompletionService.parserResultatRetourSimple(response); |
} |
}; |
} |
private void lancerRechercheEflore() { |
CacheClient.getInstance().setTaxonPourRechercheEflore(autoCompletionNomTaxonsPresenteur.getValeur()); |
EvenementComparaisonEflore evenementComparaisonEflore = new EvenementComparaisonEflore(autoCompletionNomTaxonsPresenteur.getValeur()); |
BusEvenementiel.getInstance().fireEvent(evenementComparaisonEflore); |
} |
} |
/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; |
} |
} |
/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); |
} |
} |