Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 335 → Rev 334

/trunk/src/org/tela_botanica/del/client/navigation/evenement/rechercheobservation/EvenementRechercheObservation.java
File deleted
/trunk/src/org/tela_botanica/del/client/navigation/evenement/rechercheobservation/GestionnaireEvenementRechercheObservation.java
File deleted
/trunk/src/org/tela_botanica/del/client/navigation/evenement/BusEvenementiel.java
1,5 → 1,7
package org.tela_botanica.del.client.navigation.evenement;
 
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
import org.tela_botanica.del.client.modeles.Image;
11,13 → 13,12
import org.tela_botanica.del.client.navigation.evenement.comparaisoneflore.GestionnaireEvenementComparaisonEflore;
import org.tela_botanica.del.client.navigation.evenement.rechercheimage.EvenementRechercheImage;
import org.tela_botanica.del.client.navigation.evenement.rechercheimage.GestionnaireEvenementRechercheImage;
import org.tela_botanica.del.client.navigation.evenement.rechercheobservation.EvenementRechercheObservation;
import org.tela_botanica.del.client.navigation.evenement.rechercheobservation.GestionnaireEvenementRechercheObservation;
import org.tela_botanica.del.client.navigation.evenement.validationobservation.EvenementValidation;
import org.tela_botanica.del.client.navigation.evenement.validationobservation.GestionnaireEvenementValidation;
 
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
 
public class BusEvenementiel extends HandlerManager {
 
57,20 → 58,10
 
@Override
public void onRechercheImage(EvenementRechercheImage event) {
 
doRechercheImage();
}
});
 
addHandler(EvenementRechercheObservation.TYPE, new GestionnaireEvenementRechercheObservation() {
 
@Override
public void onRechercheObservation(EvenementRechercheObservation event) {
doRechercheObservation();
 
}
});
 
addHandler(EvenementChangementProtocole.TYPE, new GestionnaireEvenementChangementProtocole() {
 
@Override
93,18 → 84,13
}
 
private void doRechercheImage() {
History.newItem(ConstantesNavigation.PAGE_RECHERCHE_IMAGES, true);
History.newItem(ConstantesNavigation.PAGE_RESULTAT_RECHERCHE_IMAGES, true);
History.fireCurrentHistoryState();
}
private void doRechercheObservation() {
History.newItem(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS, true);
History.fireCurrentHistoryState();
}
 
private void doChangementProtocole(Protocole protocole) {
CacheClient.getInstance().setProtocoleCourant(protocole);
History.newItem(ConstantesNavigation.PAGE_RECHERCHE_IMAGES, true);
History.newItem(ConstantesNavigation.PAGE_RESULTAT_RECHERCHE_IMAGES, true);
History.fireCurrentHistoryState();
}
 
/trunk/src/org/tela_botanica/del/client/utils/MockDatasource.java
10,7 → 10,6
import org.tela_botanica.del.client.exceptions.ExceptionClient;
import org.tela_botanica.del.client.modeles.Commentaire;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.modeles.PropositionDetermination;
import org.tela_botanica.del.client.modeles.Protocole;
239,8 → 238,8
* (java.util.HashMap)
*/
@Override
public List<Observation> getObservations(InformationsRecherche informationsRecherche) {
if (informationsRecherche == null) {
public List<Observation> getObservations(HashMap<String, String> champsRecherche) {
if (champsRecherche == null) {
return getObservations();
} else {
int nbResultats = (int) Math.round(Math.random() * 20);
401,7 → 400,7
}
 
@Override
public List<Image> getImagesParTaxon(InformationsRecherche informationsRecherche, int debut, int fin) {
public List<Image> getImagesParTaxon(String taxon, int debut, int fin) {
return MockDatasource.getInstance().getImages(debut, fin);
}
 
/trunk/src/org/tela_botanica/del/client/cache/CacheClient.java
3,7 → 3,6
import java.util.List;
 
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.modeles.Protocole;
 
15,12 → 14,11
private Protocole protocoleCourant;
private List<Image> images;
private int numPageRechercheImage = 0;
 
private int pasPagination = 10;
private int pageCouranteRecherche = 0;
private InformationsRecherche informationsRechercheImage;
private InformationsRecherche informationsRechercheObservation;
 
private String especeRecherche = "";
private static CacheClient instance;
 
private CacheClient() {
54,19 → 52,27
return numPageRechercheImage;
}
 
// Pour la recherche :
//Pour la recherche :
public int getPasPagination() {
return pasPagination;
}
 
public void setPasPagination(int pasPagination) {
this.pasPagination = pasPagination;
}
 
public String getEspeceRecherche() {
return especeRecherche;
}
public void setEspeceRecherche(String especeRecherche) {
this.especeRecherche = especeRecherche;
}
public void setPageCouranteRecherche(int pageCouranteRecherche) {
this.pageCouranteRecherche = pageCouranteRecherche;
}
 
public int getPageCouranteRecherche() {
return this.pageCouranteRecherche;
}
102,20 → 108,4
this.protocoleCourant = protocoleCourant;
}
 
public InformationsRecherche getInformationsRechercheImage() {
return informationsRechercheImage;
}
 
public InformationsRecherche getInformationsRechercheObservation() {
return informationsRechercheObservation;
}
 
public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
this.informationsRechercheImage = informationsRechercheImage;
}
 
public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
this.informationsRechercheObservation = informationsRechercheObservation;
}
 
}
/trunk/src/org/tela_botanica/del/client/i18n/Vocabulary.properties
29,17 → 29,12
commentaires= Commentaires
autre = autre
 
#ecran recherche image
#ecran recherche taxons
rechercherImage = Rechercher une image
entrerMotClef = Entrez un nom de genre ou d'espèce, un nom de commune, un numéro de département, l'email d'un utilisateur ou un mot-clef
rechercherTaxon = Rechercher le taxon
 
#ecran recherche observation
rechercherObservation = Rechercher une observation
 
 
 
 
#ecran determination
proposerSaDetermination = Proposer votre détermination
infoProposerDetermination = Pour proposer une détermination, remplissez les champs ci-dessous et cliquez sur le bouton Proposer !
75,20 → 70,4
infoVotes = Voici la moyenne des votes en fonction du protocole choisi :
protocoleEsthetisme = Esthetisme
protocoleIdentificationAuto = Identification automatique
monVote = Mon vote
 
#composant recherche simple
rechercher = Rechercher
rechercheLibre=Recherche libre
 
#composant recherche avancee
rechercheAvancee= Recherche avancee
departement = Departement
taxon = Taxon
genre = Genre
mot_clef= Mot-clef
date= Date
commune = Commune
famille = Famille
tag = tag
auteur = Auteur
monVote = Mon vote
/trunk/src/org/tela_botanica/del/client/i18n/Vocabulary.java
2,7 → 2,7
 
/**
* Interface to represent the constants contained in resource bundle:
* 'D:/dev/workspaces/interface-validation-workspace/del-new/src/org/tela_botanica/del/client/i18n/Vocabulary.properties'.
* '/home/aurelien/web/del/src/org/tela_botanica/del/client/i18n/Vocabulary.properties'.
*/
public interface Vocabulary extends com.google.gwt.i18n.client.Constants {
106,15 → 106,6
String commentaires();
 
/**
* Translated "Commune".
*
* @return translated "Commune"
*/
@DefaultStringValue("Commune")
@Key("commune")
String commune();
 
/**
* Translated "Comparer cette image".
*
* @return translated "Comparer cette image"
187,15 → 178,6
String dateValidation();
 
/**
* Translated "Departement".
*
* @return translated "Departement"
*/
@DefaultStringValue("Departement")
@Key("departement")
String departement();
 
/**
* Translated "Entrez un nom de genre ou d'espèce, un nom de commune, un numéro de département, l'email d'un utilisateur ou un mot-clef".
*
* @return translated "Entrez un nom de genre ou d'espèce, un nom de commune, un numéro de département, l'email d'un utilisateur ou un mot-clef"
232,15 → 214,6
String fiabilite();
 
/**
* Translated "Genre".
*
* @return translated "Genre"
*/
@DefaultStringValue("Genre")
@Key("genre")
String genre();
 
/**
* Translated "Photos d'eFlore".
*
* @return translated "Photos d'eFlore"
286,11 → 259,11
String infoPropositions();
 
/**
* Translated "<b>Saisissez <b>un nouveau nom</b> dans le champ ci-après.".
* Translated "<b>Choisissez un taxon</b> dans la liste déroulante <b>OU</b> saisissez <b>un nouveau nom</b> dans le champ ci-après.".
*
* @return translated "<b>Saisissez <b>un nouveau nom</b> dans le champ ci-après."
* @return translated "<b>Choisissez un taxon</b> dans la liste déroulante <b>OU</b> saisissez <b>un nouveau nom</b> dans le champ ci-après."
*/
@DefaultStringValue("<b>Saisissez <b>un nouveau nom</b> dans le champ ci-après.")
@DefaultStringValue("<b>Choisissez un taxon</b> dans la liste déroulante <b>OU</b> saisissez <b>un nouveau nom</b> dans le champ ci-après.")
@Key("infoTaxon")
String infoTaxon();
 
349,15 → 322,6
String monVote();
 
/**
* Translated "Mot-clef".
*
* @return translated "Mot-clef"
*/
@DefaultStringValue("Mot-clef")
@Key("mot_clef")
String mot_clef();
 
/**
* Translated "Mots-clefs".
*
* @return translated "Mots-clefs"
475,33 → 439,6
String protocoleIdentificationAuto();
 
/**
* Translated "Recherche avancee".
*
* @return translated "Recherche avancee"
*/
@DefaultStringValue("Recherche avancee")
@Key("rechercheAvancee")
String rechercheAvancee();
 
/**
* Translated "Recherche libre".
*
* @return translated "Recherche libre"
*/
@DefaultStringValue("Recherche libre")
@Key("rechercheLibre")
String rechercheLibre();
 
/**
* Translated "Rechercher".
*
* @return translated "Rechercher"
*/
@DefaultStringValue("Rechercher")
@Key("rechercher")
String rechercher();
 
/**
* Translated "Rechercher une image".
*
* @return translated "Rechercher une image"
511,15 → 448,6
String rechercherImage();
 
/**
* Translated "Rechercher une observation".
*
* @return translated "Rechercher une observation"
*/
@DefaultStringValue("Rechercher une observation")
@Key("rechercherObservation")
String rechercherObservation();
 
/**
* Translated "Rechercher le taxon ".
*
* @return translated "Rechercher le taxon "
529,15 → 457,6
String rechercherTaxon();
 
/**
* Translated "tag".
*
* @return translated "tag"
*/
@DefaultStringValue("tag")
@Key("tag")
String tag();
 
/**
* Translated "Taxon".
*
* @return translated "Taxon"
/trunk/src/org/tela_botanica/del/client/vues/rechercheimages/MoteurRechercheImagePresenteur.java
8,14 → 8,22
import org.tela_botanica.del.client.i18n.I18n;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
import org.tela_botanica.del.client.navigation.evenement.ajoutdetermination.EvenementAjoutDetermination;
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
import org.tela_botanica.del.client.navigation.evenement.rechercheimage.EvenementRechercheImage;
import org.tela_botanica.del.client.services.rest.ProtocoleService;
import org.tela_botanica.del.client.utils.MockDatasource;
import org.tela_botanica.del.client.vues.rechercheimages.resultats.ResultatRechercheImagePresenteur;
 
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
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.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
 
22,33 → 30,29
public class MoteurRechercheImagePresenteur {
 
public interface Vue extends IsWidget {
 
public abstract void ajouterProtocole(String protocole);
 
public abstract void selectionnerProtocole(int index);
 
public abstract HasChangeHandlers getListeProtocoles();
 
public abstract HasWidgets getZoneResultats();
 
public abstract HasWidgets getZoneRecherche();
}
 
private Vue vue;
 
// private final ImageService imageService = MockDatasource.getInstance();
private final ProtocoleService protocoleService = MockDatasource.getInstance();
private List<Protocole> protocoles;
 
// TODO : passer ça en cache
//TODO : passer ça en cache
private String protocoleParDefaut = Protocole.IDENTIFICATION_AUTOMATIQUE;
 
/**
* Constructeur
* */
public MoteurRechercheImagePresenteur(Vue vue) {
this.vue = vue;
 
if (CacheClient.getInstance().getProtocoleCourant() == null) {
CacheClient.getInstance().setProtocoleCourant(protocoleService.getProtocole(protocoleParDefaut));
}
75,7 → 79,7
 
@Override
public void onChange(ChangeEvent event) {
 
Protocole protocoleCourant = (Protocole) event.getSource();
EvenementChangementProtocole evenement = new EvenementChangementProtocole(protocoleCourant);
BusEvenementiel.getInstance().fireEvent(evenement);
82,20 → 86,17
}
});
}
 
public void chargerMoteurRechercheAvancee() {
MoteurRecherchePresenteur presenteurRecherche = new MoteurRecherchePresenteur(new MoteurRechercheVue(I18n.getVocabulary().rechercherImage()), true, false) {
public void lancerRecherche() {
chercherImages();
MoteurRecherchePresenteur presenteurRecherche = new MoteurRecherchePresenteur(new MoteurRechercheVue(I18n.getVocabulary().rechercherImage())) {
public void lancerRecherche(String termeRecherche) {
CacheClient.getInstance().setEspeceRecherche(termeRecherche);
BusEvenementiel.getInstance().fireEvent(new EvenementRechercheImage());
}
};
presenteurRecherche.go(vue.getZoneRecherche());
}
 
public void chercherImages() {
new ResultatRechercheImagePresenteur().go(vue.getZoneResultats());
}
 
public HasWidgets getZoneResultats() {
return vue.getZoneResultats();
}
/trunk/src/org/tela_botanica/del/client/vues/rechercheimages/resultats/ResultatRechercheImagePresenteur.java
5,13 → 5,14
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.composants.pagination.PaginationPresenteur;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.services.rest.ImageService;
import org.tela_botanica.del.client.utils.MockDatasource;
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImagePresenteur;
import org.tela_botanica.del.client.vues.rechercheimages.resultats.images.ImageVue;
 
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Panel;
 
28,7 → 29,7
 
public void go(HasWidgets composite) {
composite.add(vue);
CacheClient.getInstance().setImages(serviceImage.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), 0, CacheClient.getInstance().getPasPagination()));
CacheClient.getInstance().setImages(serviceImage.getImagesParTaxon(CacheClient.getInstance().getEspeceRecherche(), 0, CacheClient.getInstance().getPasPagination()));
createPaginationWidget(CacheClient.getInstance().getImages().size());
actualiserImagesEtMoyenneVoteProtocole(0, CacheClient.getInstance().getPasPagination());
}
/trunk/src/org/tela_botanica/del/client/vues/rechercheimages/MoteurRechercheImageVue.java
2,14 → 2,20
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
import com.google.gwt.uibinder.client.UiBinder;
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.FlowPanel;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
 
public class MoteurRechercheImageVue extends Composite implements MoteurRechercheImagePresenteur.Vue {
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservationsPresenteur.java
1,31 → 1,41
package org.tela_botanica.del.client.vues.rechercheobservations;
 
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.composants.moteurrecherche.MoteurRecherchePresenteur;
import org.tela_botanica.del.client.composants.moteurrecherche.MoteurRechercheVue;
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
import org.tela_botanica.del.client.i18n.I18n;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.utils.MockDatasource;
 
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.event.dom.client.HasKeyPressHandlers;
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.user.client.ui.Button;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.HasVisibility;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
 
public class RechercheObservationsPresenteur extends Presenteur {
 
public abstract interface Vue extends IsWidget {
public HasWidgets getZoneRecherche();
 
public HasWidgets getZoneObservations();
 
public HasWidgets getZonePagination();
}
 
private Vue vue;
 
private List<Observation> observations;
 
public RechercheObservationsPresenteur(Vue vue) {
40,26 → 50,30
ajouterMoteurRechercheAvancee();
gererEvenements();
 
// On commence par afficher la totalité des observations
chercherObservations(null);
afficherObservations();
}
 
protected void ajouterMoteurRechercheAvancee() {
MoteurRecherchePresenteur presenteur = new MoteurRecherchePresenteur(new MoteurRechercheVue(I18n.getVocabulary().rechercherObservation()) {
}, false, true) {
 
MoteurRecherchePresenteur presenteur = new MoteurRecherchePresenteur(new MoteurRechercheVue("Rechercher une observation"){}) {
@Override
public void lancerRecherche() {
chercherObservations();
public void lancerRecherche(String termeRecherche) {
chercherObservations(null);
afficherObservations();
}
};
presenteur.go(vue.getZoneRecherche());
}
 
protected void gererEvenements() {
protected void gererEvenements() {}
 
public void chercherObservations(HashMap<String, String> champsRecherche) {
this.observations = MockDatasource.getInstance().getObservations(champsRecherche);
}
 
public void chercherObservations() {
 
this.observations = MockDatasource.getInstance().getObservations(CacheClient.getInstance().getInformationsRechercheObservation());
public void afficherObservations() {
vue.getZoneObservations().clear();
for (Observation observation : observations) {
ObservationPresenteur presenteur = new ObservationPresenteur(new ObservationVue(), observation);
/trunk/src/org/tela_botanica/del/client/services/rest/ObservationService.java
1,13 → 1,13
package org.tela_botanica.del.client.services.rest;
 
import java.util.HashMap;
import java.util.List;
 
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.Observation;
 
public interface ObservationService {
 
public List<Observation> getObservations(InformationsRecherche informationsRecherche);
public List<Observation> getObservations(HashMap<String, String> champsRecherche);
 
public List<Observation> getObservations();
 
/trunk/src/org/tela_botanica/del/client/services/rest/ImageService.java
3,12 → 3,11
import java.util.List;
 
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
 
public interface ImageService {
 
public abstract List<Image> getImagesEfloreParTaxon(String nomTaxon);
 
public abstract List<Image> getImagesParTaxon(InformationsRecherche informationsRecherche, int debut, int fin);
public abstract List<Image> getImagesParTaxon(String taxon, int debut, int fin);
 
}
/trunk/src/org/tela_botanica/del/client/gestionhistorique/ConstantesNavigation.java
4,6 → 4,7
 
public static final String PAGE_PRINCIPALE = "page_principale";
public static final String PAGE_RECHERCHE_IMAGES = "page_recherche_images";
public static final String PAGE_RESULTAT_RECHERCHE_IMAGES = "page_recherche_images_resultat";
public static final String PAGE_RECHERCHE_OBSERVATIONS = "page_recherche_observations";
public static final String PAGE_VALIDATION = "page_validation";
public static final String PAGE_COMPARAISON_EFLORE = "page_comparaison_eflore";
/trunk/src/org/tela_botanica/del/client/gestionhistorique/GestionnaireHistorique.java
6,6 → 6,7
import org.tela_botanica.del.client.vues.plateformedetermination.DeterminationVue;
import org.tela_botanica.del.client.vues.rechercheimages.MoteurRechercheImagePresenteur;
import org.tela_botanica.del.client.vues.rechercheimages.MoteurRechercheImageVue;
import org.tela_botanica.del.client.vues.rechercheimages.resultats.ResultatRechercheImagePresenteur;
import org.tela_botanica.del.client.vues.rechercheobservations.RechercheObservationsPresenteur;
import org.tela_botanica.del.client.vues.rechercheobservations.RechercheObservationsVue;
import org.tela_botanica.del.client.vues.vueinitiale.PresenteurInitial;
26,12 → 27,18
* */
public void onValueChange(ValueChangeEvent<String> event) {
 
RootPanel.get("navigation").clear();
new PresenteurInitial().go(RootPanel.get("navigation"));
 
if (event.getValue().equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
RootPanel.get("contenu").clear();
new MoteurRechercheImagePresenteur(new MoteurRechercheImageVue()).go(RootPanel.get("contenu"));
} else if (event.getValue().equals(ConstantesNavigation.PAGE_RESULTAT_RECHERCHE_IMAGES)) {
RootPanel.get("contenu").clear();
MoteurRechercheImagePresenteur presenteur = new MoteurRechercheImagePresenteur(new MoteurRechercheImageVue());
presenteur.go(RootPanel.get("contenu"));
new ResultatRechercheImagePresenteur().go(presenteur.getZoneResultats());
} else if (event.getValue().equals(ConstantesNavigation.PAGE_VALIDATION)) {
RootPanel.get("contenu").clear();
new DeterminationPresenteur(new DeterminationVue()).go(RootPanel.get("contenu"));
40,8 → 47,7
new ComparaisonEflorePresenteur(new ComparaisonEfloreVue()).go(RootPanel.get("contenu"));
} else if (event.getValue().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS)) {
RootPanel.get("contenu").clear();
RechercheObservationsPresenteur presenteur = new RechercheObservationsPresenteur(new RechercheObservationsVue());
presenteur.go(RootPanel.get("contenu"));
new RechercheObservationsPresenteur(new RechercheObservationsVue()).go(RootPanel.get("contenu"));
}
}
}
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.ui.xml
1,68 → 1,62
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
ui:generateLocales="default">
<ui:with field='res' type='org.tela_botanica.del.client.Ressources' />
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary" />
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'
ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat' ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator" ui:generateLocales="default">
<ui:with field='res' type='org.tela_botanica.del.client.Ressources'/>
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary"/>
 
<ui:style src="MoteurRecherche.css" />
<ui:style src="MoteurRecherche.css" />
<g:HTMLPanel>
<g:TextBox styleName="{style.recherchePrincipale}" ui:field="recherchePrincipale" text="{constants.rechercherObservation}"></g:TextBox>
<g:Button styleName="{style.boutonRecherche}" ui:field="boutonRecherche" text="{constants.rechercher}">
</g:Button>
<g:Label styleName="{style.lienRechercheAvancee}" ui:field="lienRechercheAvancee" text="{constants.rechercheAvancee}"></g:Label>
<g:HTMLPanel styleName="{style.rechercheAvancee}"
ui:field="rechercheAvancee">
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.departement}" />
<g:TextBox ui:field="departement" />
<g:TextBox styleName="{style.recherchePrincipale}" ui:field="recherchePrincipale">{constants.}</g:TextBox>
<g:Button styleName="{style.boutonRecherche}" ui:field="boutonRecherche">Rechercher</g:Button>
<g:Label styleName="{style.lienRechercheAvancee}" ui:field="lienRechercheAvancee">Recherche avancée</g:Label>
<g:HTMLPanel styleName="{style.rechercheAvancee}" ui:field="rechercheAvancee">
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Département"/>
<g:TextBox ui:field="departement"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Commune"/>
<g:TextBox ui:field="commune"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Taxon"/>
<g:TextBox ui:field="taxon"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Famille"/>
<g:TextBox ui:field="famille"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Genre"/>
<g:TextBox ui:field="genre"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Tag"/>
<g:TextBox ui:field="tag"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Mot-clé"/>
<g:TextBox ui:field="motCle"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Auteur"/>
<g:TextBox ui:field="auteur"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Date"/>
<g:TextBox ui:field="date"/>
</g:HTMLPanel>
<g:Button styleName="{style.boutonRecherche}" ui:field="boutonRechercheAvancee">Rechercher</g:Button>
<g:HTMLPanel styleName="nettoyage" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.commune}" />
<g:TextBox ui:field="commune" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.taxon}" />
<g:TextBox ui:field="taxon" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.famille}" />
<g:TextBox ui:field="famille" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.genre}" />
<g:TextBox ui:field="genre" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.tag}" />
<g:TextBox ui:field="tag" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.mot_clef}" />
<g:TextBox ui:field="motCle" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.auteur}" />
<g:TextBox ui:field="auteur" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.date}" />
<g:TextBox ui:field="date" />
</g:HTMLPanel>
<g:Button styleName="{style.boutonRecherche}" ui:field="boutonRechercheAvancee" text="{constants.rechercher}">
</g:Button>
<g:HTMLPanel styleName="nettoyage" />
</g:HTMLPanel>
<g:Label ui:field="recherchePrecedente" styleName="{style.recherchePrecedente}" />
<g:HTMLPanel ui:field="zonePagination" />
<g:Label ui:field="recherchePrecedente" styleName="{style.recherchePrecedente}" />
<g:HTMLPanel ui:field="zonePagination" />
</g:HTMLPanel>
</ui:UiBinder>
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRecherchePresenteur.java
1,8 → 1,9
package org.tela_botanica.del.client.composants.moteurrecherche;
 
import org.tela_botanica.del.client.cache.CacheClient;
import java.util.HashMap;
 
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.i18n.I18n;
 
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
11,68 → 12,36
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.user.client.ui.HasText;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
 
public abstract class MoteurRecherchePresenteur extends Presenteur {
 
public abstract interface Vue extends IsWidget {
 
public abstract HasClickHandlers getLienRechercheAvancee();
 
public abstract void basculerAffichageZoneCache();
 
public abstract HasClickHandlers getBoutonRechercheSimple();
 
public abstract HasClickHandlers getBoutonRechercheAvancee();
 
public abstract HasKeyPressHandlers getChampSaisie();
 
public abstract HasClickHandlers getChampSaisieCliquable();
 
public abstract String getValeurRechercheSimple();
 
public void setValeurRechercheSimple(String valeurRecherche);
 
public String getLabelRecherche();
 
public HasText getRecherchePrincipale();
 
public HasText getDepartement();
 
public HasText getCommune();
 
public HasText getTaxon();
 
public HasText getFamille();
 
public HasText getGenre();
 
public HasText getTag();
 
public HasText getMotCle();
 
public HasText getAuteur();
 
public HasText getDate();
 
public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
public abstract HashMap<String, String> collecterFormulaire();
public String getChaineRecherche();
public abstract void setRecherchePrecedente();
}
 
private final Vue vue;
private final boolean pourRechercheImages, pourRechercheObservations;
 
public MoteurRecherchePresenteur(Vue vue, boolean pourRechercheImages, boolean pourRechercheObservations) {
private Vue vue;
public MoteurRecherchePresenteur(Vue vue) {
this.vue = vue;
this.pourRechercheImages = pourRechercheImages;
this.pourRechercheObservations = pourRechercheObservations;
gererEvenements();
}
 
@Override
public void go(HasWidgets composite) {
afficherRequeteEtLancerRecherche();
composite.add(vue.asWidget());
}
 
83,34 → 52,33
vue.basculerAffichageZoneCache();
}
});
 
vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
collecterInfosRecherche();
afficherRequeteEtLancerRecherche();
afficherInfoRecherche();
lancerRecherche(vue.getChaineRecherche());
}
});
 
vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
collecterInfosRecherche();
vue.basculerAffichageZoneCache();
afficherRequeteEtLancerRecherche();
afficherInfoRecherche();
lancerRecherche(vue.getChaineRecherche());
}
});
 
vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
 
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
collecterInfosRecherche();
afficherRequeteEtLancerRecherche();
afficherInfoRecherche();
lancerRecherche(vue.getChaineRecherche());
}
}
});
 
vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
 
@Override
public void onClick(ClickEvent event) {
if (vue.getValeurRechercheSimple().equals(vue.getLabelRecherche())) {
118,52 → 86,12
}
}
});
}
 
private void collecterInfosRecherche() {
InformationsRecherche informationRecherche = new InformationsRecherche();
informationRecherche.setAuteur(vue.getAuteur().getText());
informationRecherche.setCommune(vue.getCommune().getText());
informationRecherche.setDate(vue.getDate().getText());
informationRecherche.setDepartement(vue.getDepartement().getText());
informationRecherche.setFamille(vue.getFamille().getText());
informationRecherche.setGenre(vue.getGenre().getText());
informationRecherche.setMotClef(vue.getMotCle().getText());
 
if (!vue.getRecherchePrincipale().getText().equals(vue.getLabelRecherche())) {
informationRecherche.setRechercheLibre(vue.getRecherchePrincipale().getText());
}
if (isPourRechercheImages()) {
CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
} else if (isPourRechercheObservations()) {
CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
}
private void afficherInfoRecherche() {
vue.setRecherchePrecedente();
}
 
private InformationsRecherche getInformationsRechercheEnCache() {
if (isPourRechercheImages()) {
return CacheClient.getInstance().getInformationsRechercheImage();
} else if (isPourRechercheObservations()) {
return CacheClient.getInstance().getInformationsRechercheObservation();
}
return null;
}
 
public void afficherRequeteEtLancerRecherche() {
InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
if (informationsRecherche != null) {
vue.chargerValeursRecherchePrecedente(informationsRecherche);
}
lancerRecherche();
}
 
public abstract void lancerRecherche();
 
public boolean isPourRechercheImages() {
return pourRechercheImages;
}
 
public boolean isPourRechercheObservations() {
return pourRechercheObservations;
}
public abstract void lancerRecherche(String termeRecherche);
}
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.java
1,7 → 1,7
package org.tela_botanica.del.client.composants.moteurrecherche;
 
import org.tela_botanica.del.client.i18n.I18n;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import java.util.HashMap;
import java.util.Iterator;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
8,9 → 8,10
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;
18,21 → 19,15
 
public class MoteurRechercheVue extends Composite implements MoteurRecherchePresenteur.Vue {
 
interface Binder extends UiBinder<Widget, MoteurRechercheVue> {
}
 
interface Binder extends UiBinder<Widget, MoteurRechercheVue> {}
private static Binder uiBinder = GWT.create(Binder.class);
private String labelRecherche = "";
 
@UiField
Panel rechercheAvancee;
@UiField
Label lienRechercheAvancee, recherchePrecedente;
@UiField
Button boutonRecherche, boutonRechercheAvancee;
@UiField
TextBox recherchePrincipale, departement, commune, taxon, famille, genre, tag, motCle, auteur, date;
 
@UiField Panel rechercheAvancee;
@UiField Label lienRechercheAvancee, recherchePrecedente;
@UiField Button boutonRecherche, boutonRechercheAvancee;
@UiField TextBox recherchePrincipale, departement, commune, taxon, famille, genre, tag, motCle, auteur, date;
public MoteurRechercheVue(String labelRecherche) {
initWidget(uiBinder.createAndBindUi(this));
this.labelRecherche = labelRecherche;
43,7 → 38,7
public String getLabelRecherche() {
return labelRecherche;
}
 
@Override
public HasClickHandlers getLienRechercheAvancee() {
return lienRechercheAvancee;
58,7 → 53,7
public HasClickHandlers getBoutonRechercheSimple() {
return boutonRecherche;
}
 
@Override
public HasClickHandlers getBoutonRechercheAvancee() {
return boutonRechercheAvancee;
78,102 → 73,70
public HasClickHandlers getChampSaisieCliquable() {
return recherchePrincipale;
}
 
@Override
public void setValeurRechercheSimple(String valeurRecherche) {
recherchePrincipale.setText(valeurRecherche);
}
 
public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche) {
getAuteur().setText(informationsRecherche.getAuteur());
getCommune().setText(informationsRecherche.getCommune());
getDate().setText(informationsRecherche.getDate());
getDepartement().setText(informationsRecherche.getDepartement());
getFamille().setText(informationsRecherche.getFamille());
getMotCle().setText(informationsRecherche.getMotClef());
@Override
public HashMap<String, String> collecterFormulaire() {
 
HashMap<String, String> champsRecherche = new HashMap<String, String>();
if (!recherchePrincipale.getText().equals("")) {
champsRecherche.put("search", recherchePrincipale.getText());
}
if (informationsRecherche.getRechercheLibre() != null && !informationsRecherche.getRechercheLibre().equals("")) {
getRecherchePrincipale().setText(informationsRecherche.getRechercheLibre());
if (!departement.getText().equals("")) {
champsRecherche.put("dept", departement.getText());
}
 
afficherLigneInfoRecherche(informationsRecherche);
}
 
/**
* Affiche la ligne d'en tête montrant les elements de la requête à
* l'utilisateur
*
* @param informationRecherche
*/
private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
 
StringBuffer texteRecherchePrecedente = new StringBuffer();
if (informationRecherche.getRechercheLibre()!=null&&!informationRecherche.getRechercheLibre().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().rechercheLibre() + ":" + informationRecherche.getRechercheLibre() + " ");
if (!commune.getText().equals("")) {
champsRecherche.put("com", commune.getText());
}
if (!informationRecherche.getAuteur().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().auteur() + ":" + informationRecherche.getAuteur() + " ");
if (!taxon.getText().equals("")) {
champsRecherche.put("taxon", taxon.getText());
}
if (!informationRecherche.getCommune().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
if (!famille.getText().equals("")) {
champsRecherche.put("fam", famille.getText());
}
if (!informationRecherche.getDate().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
if (!genre.getText().equals("")) {
champsRecherche.put("gen", genre.getText());
}
if (!informationRecherche.getDepartement().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
if (!tag.getText().equals("")) {
champsRecherche.put("tag", tag.getText());
}
if (!informationRecherche.getFamille().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
if (!motCle.getText().equals("")) {
champsRecherche.put("motCle", motCle.getText());
}
if (!informationRecherche.getGenre().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().genre() + ":" + informationRecherche.getGenre() + " ");
if (!auteur.getText().equals("")) {
champsRecherche.put("auteur", auteur.getText());
}
if (!informationRecherche.getMotClef().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().mot_clef() + ":" + informationRecherche.getMotClef() + " ");
if (!date.getText().equals("")) {
champsRecherche.put("date", date.getText());
}
recherchePrecedente.setText(texteRecherchePrecedente.toString());
return champsRecherche;
}
 
public HasText getRecherchePrincipale() {
return recherchePrincipale;
@Override
public String getChaineRecherche() {
HashMap<String, String> valeursRecherche = collecterFormulaire();
String chaineRecherche = "";
if (valeursRecherche != null) {
Iterator<String> itCles = valeursRecherche.keySet().iterator();
while (itCles.hasNext()) {
String cle = itCles.next();
String valeur = valeursRecherche.get(cle);
if (valeur != "") {
chaineRecherche += cle + ":=" + valeur + " ";
}
}
}
return chaineRecherche;
}
 
public HasText getDepartement() {
return departement;
@Override
public void setRecherchePrecedente() {
recherchePrecedente.setText(getChaineRecherche());
}
 
public HasText getCommune() {
return commune;
}
 
public HasText getTaxon() {
return taxon;
}
 
public HasText getFamille() {
return famille;
}
 
public HasText getGenre() {
return genre;
}
 
public HasText getTag() {
return tag;
}
 
public HasText getMotCle() {
return motCle;
}
 
public HasText getAuteur() {
return auteur;
}
 
public HasText getDate() {
return date;
}
 
}
/trunk/src/org/tela_botanica/del/client/composants/pagination/PaginationPresenteur.java
1,9 → 1,13
package org.tela_botanica.del.client.composants.pagination;
 
import java.util.Iterator;
import java.util.Vector;
 
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.HorizontalPanel;
32,7 → 36,7
* */
public PaginationPresenteur(int nbElementsTotal, int pas) {
this.nbElementsTotal = nbElementsTotal;
this.pas=pas;
changerPas(pas);
vue = new PaginationVue();
}
/trunk/src/org/tela_botanica/del/client/modeles/InformationsRecherche.java
File deleted