Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 334 → Rev 335

/trunk/src/org/tela_botanica/del/client/navigation/evenement/BusEvenementiel.java
1,7 → 1,5
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;
13,12 → 11,13
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 {
 
58,10 → 57,20
 
@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
84,13 → 93,18
}
 
private void doRechercheImage() {
History.newItem(ConstantesNavigation.PAGE_RESULTAT_RECHERCHE_IMAGES, true);
History.newItem(ConstantesNavigation.PAGE_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_RESULTAT_RECHERCHE_IMAGES, true);
History.newItem(ConstantesNavigation.PAGE_RECHERCHE_IMAGES, true);
History.fireCurrentHistoryState();
}
 
/trunk/src/org/tela_botanica/del/client/navigation/evenement/rechercheobservation/EvenementRechercheObservation.java
New file
0,0 → 1,22
package org.tela_botanica.del.client.navigation.evenement.rechercheobservation;
 
import com.google.gwt.event.shared.GwtEvent;
 
public class EvenementRechercheObservation extends GwtEvent<GestionnaireEvenementRechercheObservation> {
 
public static com.google.gwt.event.shared.GwtEvent.Type<GestionnaireEvenementRechercheObservation> TYPE = new com.google.gwt.event.shared.GwtEvent.Type<GestionnaireEvenementRechercheObservation>();
 
public EvenementRechercheObservation() {
}
 
@Override
protected void dispatch(GestionnaireEvenementRechercheObservation handler) {
handler.onRechercheObservation(this);
}
 
@Override
public com.google.gwt.event.shared.GwtEvent.Type<GestionnaireEvenementRechercheObservation> getAssociatedType() {
return TYPE;
}
 
}
/trunk/src/org/tela_botanica/del/client/navigation/evenement/rechercheobservation/GestionnaireEvenementRechercheObservation.java
New file
0,0 → 1,8
package org.tela_botanica.del.client.navigation.evenement.rechercheobservation;
 
 
import com.google.gwt.event.shared.EventHandler;
 
public interface GestionnaireEvenementRechercheObservation extends EventHandler {
public void onRechercheObservation(EvenementRechercheObservation event);
}
/trunk/src/org/tela_botanica/del/client/utils/MockDatasource.java
10,6 → 10,7
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;
238,8 → 239,8
* (java.util.HashMap)
*/
@Override
public List<Observation> getObservations(HashMap<String, String> champsRecherche) {
if (champsRecherche == null) {
public List<Observation> getObservations(InformationsRecherche informationsRecherche) {
if (informationsRecherche == null) {
return getObservations();
} else {
int nbResultats = (int) Math.round(Math.random() * 20);
400,7 → 401,7
}
 
@Override
public List<Image> getImagesParTaxon(String taxon, int debut, int fin) {
public List<Image> getImagesParTaxon(InformationsRecherche informationsRecherche, int debut, int fin) {
return MockDatasource.getInstance().getImages(debut, fin);
}
 
/trunk/src/org/tela_botanica/del/client/cache/CacheClient.java
3,6 → 3,7
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;
 
14,11 → 15,12
private Protocole protocoleCourant;
private List<Image> images;
private int numPageRechercheImage = 0;
 
private int pasPagination = 10;
private int pageCouranteRecherche = 0;
private String especeRecherche = "";
private InformationsRecherche informationsRechercheImage;
private InformationsRecherche informationsRechercheObservation;
 
private static CacheClient instance;
 
private CacheClient() {
52,27 → 54,19
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;
}
108,4 → 102,20
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.java
2,7 → 2,7
 
/**
* Interface to represent the constants contained in resource bundle:
* '/home/aurelien/web/del/src/org/tela_botanica/del/client/i18n/Vocabulary.properties'.
* 'D:/dev/workspaces/interface-validation-workspace/del-new/src/org/tela_botanica/del/client/i18n/Vocabulary.properties'.
*/
public interface Vocabulary extends com.google.gwt.i18n.client.Constants {
106,6 → 106,15
String commentaires();
 
/**
* Translated "Commune".
*
* @return translated "Commune"
*/
@DefaultStringValue("Commune")
@Key("commune")
String commune();
 
/**
* Translated "Comparer cette image".
*
* @return translated "Comparer cette image"
178,6 → 187,15
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"
214,6 → 232,15
String fiabilite();
 
/**
* Translated "Genre".
*
* @return translated "Genre"
*/
@DefaultStringValue("Genre")
@Key("genre")
String genre();
 
/**
* Translated "Photos d'eFlore".
*
* @return translated "Photos d'eFlore"
259,11 → 286,11
String infoPropositions();
 
/**
* 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.".
* 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."
* @return translated "<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.")
@DefaultStringValue("<b>Saisissez <b>un nouveau nom</b> dans le champ ci-après.")
@Key("infoTaxon")
String infoTaxon();
 
322,6 → 349,15
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"
439,6 → 475,33
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"
448,6 → 511,15
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 "
457,6 → 529,15
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/i18n/Vocabulary.properties
29,12 → 29,17
commentaires= Commentaires
autre = autre
 
#ecran recherche taxons
#ecran recherche image
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 !
70,4 → 75,20
infoVotes = Voici la moyenne des votes en fonction du protocole choisi :
protocoleEsthetisme = Esthetisme
protocoleIdentificationAuto = Identification automatique
monVote = Mon vote
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
/trunk/src/org/tela_botanica/del/client/vues/rechercheimages/MoteurRechercheImagePresenteur.java
8,22 → 8,14
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;
 
30,29 → 22,33
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));
}
79,7 → 75,7
 
@Override
public void onChange(ChangeEvent event) {
 
Protocole protocoleCourant = (Protocole) event.getSource();
EvenementChangementProtocole evenement = new EvenementChangementProtocole(protocoleCourant);
BusEvenementiel.getInstance().fireEvent(evenement);
86,17 → 82,20
}
});
}
 
public void chargerMoteurRechercheAvancee() {
MoteurRecherchePresenteur presenteurRecherche = new MoteurRecherchePresenteur(new MoteurRechercheVue(I18n.getVocabulary().rechercherImage())) {
public void lancerRecherche(String termeRecherche) {
CacheClient.getInstance().setEspeceRecherche(termeRecherche);
BusEvenementiel.getInstance().fireEvent(new EvenementRechercheImage());
MoteurRecherchePresenteur presenteurRecherche = new MoteurRecherchePresenteur(new MoteurRechercheVue(I18n.getVocabulary().rechercherImage()), true, false) {
public void lancerRecherche() {
chercherImages();
}
};
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,14 → 5,13
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.composants.pagination.PaginationPresenteur;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.composants.pagination.PaginationPresenteur;
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;
 
29,7 → 28,7
 
public void go(HasWidgets composite) {
composite.add(vue);
CacheClient.getInstance().setImages(serviceImage.getImagesParTaxon(CacheClient.getInstance().getEspeceRecherche(), 0, CacheClient.getInstance().getPasPagination()));
CacheClient.getInstance().setImages(serviceImage.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), 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,20 → 2,14
 
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,41 → 1,31
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) {
50,30 → 40,26
ajouterMoteurRechercheAvancee();
gererEvenements();
 
// On commence par afficher la totalité des observations
chercherObservations(null);
afficherObservations();
}
 
protected void ajouterMoteurRechercheAvancee() {
MoteurRecherchePresenteur presenteur = new MoteurRecherchePresenteur(new MoteurRechercheVue("Rechercher une observation"){}) {
MoteurRecherchePresenteur presenteur = new MoteurRecherchePresenteur(new MoteurRechercheVue(I18n.getVocabulary().rechercherObservation()) {
}, false, true) {
 
@Override
public void lancerRecherche(String termeRecherche) {
chercherObservations(null);
afficherObservations();
public void lancerRecherche() {
chercherObservations();
}
};
presenteur.go(vue.getZoneRecherche());
}
 
protected void gererEvenements() {}
 
public void chercherObservations(HashMap<String, String> champsRecherche) {
this.observations = MockDatasource.getInstance().getObservations(champsRecherche);
protected void gererEvenements() {
}
 
public void afficherObservations() {
public void chercherObservations() {
 
this.observations = MockDatasource.getInstance().getObservations(CacheClient.getInstance().getInformationsRechercheObservation());
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(HashMap<String, String> champsRecherche);
public List<Observation> getObservations(InformationsRecherche informationsRecherche);
 
public List<Observation> getObservations();
 
/trunk/src/org/tela_botanica/del/client/services/rest/ImageService.java
3,11 → 3,12
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(String taxon, int debut, int fin);
public abstract List<Image> getImagesParTaxon(InformationsRecherche informationsRecherche, int debut, int fin);
 
}
/trunk/src/org/tela_botanica/del/client/gestionhistorique/ConstantesNavigation.java
4,7 → 4,6
 
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,7 → 6,6
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;
27,18 → 26,12
* */
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"));
47,7 → 40,8
new ComparaisonEflorePresenteur(new ComparaisonEfloreVue()).go(RootPanel.get("contenu"));
} else if (event.getValue().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS)) {
RootPanel.get("contenu").clear();
new RechercheObservationsPresenteur(new RechercheObservationsVue()).go(RootPanel.get("contenu"));
RechercheObservationsPresenteur presenteur = new RechercheObservationsPresenteur(new RechercheObservationsVue());
presenteur.go(RootPanel.get("contenu"));
}
}
}
/trunk/src/org/tela_botanica/del/client/composants/pagination/PaginationPresenteur.java
1,13 → 1,9
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;
36,7 → 32,7
* */
public PaginationPresenteur(int nbElementsTotal, int pas) {
this.nbElementsTotal = nbElementsTotal;
changerPas(pas);
this.pas=pas;
vue = new PaginationVue();
}
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.java
1,7 → 1,7
package org.tela_botanica.del.client.composants.moteurrecherche;
 
import java.util.HashMap;
import java.util.Iterator;
import org.tela_botanica.del.client.i18n.I18n;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
8,10 → 8,9
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.IsWidget;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;
19,15 → 18,21
 
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;
38,7 → 43,7
public String getLabelRecherche() {
return labelRecherche;
}
 
@Override
public HasClickHandlers getLienRechercheAvancee() {
return lienRechercheAvancee;
53,7 → 58,7
public HasClickHandlers getBoutonRechercheSimple() {
return boutonRecherche;
}
 
@Override
public HasClickHandlers getBoutonRechercheAvancee() {
return boutonRechercheAvancee;
73,70 → 78,102
public HasClickHandlers getChampSaisieCliquable() {
return recherchePrincipale;
}
 
@Override
public void setValeurRechercheSimple(String valeurRecherche) {
recherchePrincipale.setText(valeurRecherche);
}
 
@Override
public HashMap<String, String> collecterFormulaire() {
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());
 
HashMap<String, String> champsRecherche = new HashMap<String, String>();
if (!recherchePrincipale.getText().equals("")) {
champsRecherche.put("search", recherchePrincipale.getText());
}
if (!departement.getText().equals("")) {
champsRecherche.put("dept", departement.getText());
if (informationsRecherche.getRechercheLibre() != null && !informationsRecherche.getRechercheLibre().equals("")) {
getRecherchePrincipale().setText(informationsRecherche.getRechercheLibre());
}
if (!commune.getText().equals("")) {
champsRecherche.put("com", commune.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 (!taxon.getText().equals("")) {
champsRecherche.put("taxon", taxon.getText());
if (!informationRecherche.getAuteur().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().auteur() + ":" + informationRecherche.getAuteur() + " ");
}
if (!famille.getText().equals("")) {
champsRecherche.put("fam", famille.getText());
if (!informationRecherche.getCommune().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
}
if (!genre.getText().equals("")) {
champsRecherche.put("gen", genre.getText());
if (!informationRecherche.getDate().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
}
if (!tag.getText().equals("")) {
champsRecherche.put("tag", tag.getText());
if (!informationRecherche.getDepartement().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
}
if (!motCle.getText().equals("")) {
champsRecherche.put("motCle", motCle.getText());
if (!informationRecherche.getFamille().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
}
if (!auteur.getText().equals("")) {
champsRecherche.put("auteur", auteur.getText());
if (!informationRecherche.getGenre().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().genre() + ":" + informationRecherche.getGenre() + " ");
}
if (!date.getText().equals("")) {
champsRecherche.put("date", date.getText());
if (!informationRecherche.getMotClef().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().mot_clef() + ":" + informationRecherche.getMotClef() + " ");
}
return champsRecherche;
recherchePrecedente.setText(texteRecherchePrecedente.toString());
}
@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 getRecherchePrincipale() {
return recherchePrincipale;
}
 
@Override
public void setRecherchePrecedente() {
recherchePrecedente.setText(getChaineRecherche());
public HasText getDepartement() {
return departement;
}
 
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/moteurrecherche/MoteurRechercheVue.ui.xml
1,62 → 1,68
<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">{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: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:HTMLPanel>
<g:Label ui:field="recherchePrecedente" styleName="{style.recherchePrecedente}" />
<g:HTMLPanel ui:field="zonePagination" />
 
<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:HTMLPanel>
</ui:UiBinder>
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRecherchePresenteur.java
1,9 → 1,8
package org.tela_botanica.del.client.composants.moteurrecherche;
 
import java.util.HashMap;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
import org.tela_botanica.del.client.i18n.I18n;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
 
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
12,36 → 11,68
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.Window;
import com.google.gwt.user.client.ui.HasText;
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 abstract HashMap<String, String> collecterFormulaire();
public String getChaineRecherche();
public abstract void setRecherchePrecedente();
 
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);
}
 
private Vue vue;
public MoteurRecherchePresenteur(Vue vue) {
private final Vue vue;
private final boolean pourRechercheImages, pourRechercheObservations;
 
public MoteurRecherchePresenteur(Vue vue, boolean pourRechercheImages, boolean pourRechercheObservations) {
this.vue = vue;
this.pourRechercheImages = pourRechercheImages;
this.pourRechercheObservations = pourRechercheObservations;
gererEvenements();
}
 
@Override
public void go(HasWidgets composite) {
afficherRequeteEtLancerRecherche();
composite.add(vue.asWidget());
}
 
52,33 → 83,34
vue.basculerAffichageZoneCache();
}
});
 
vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
afficherInfoRecherche();
lancerRecherche(vue.getChaineRecherche());
collecterInfosRecherche();
afficherRequeteEtLancerRecherche();
}
});
 
vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
afficherInfoRecherche();
lancerRecherche(vue.getChaineRecherche());
collecterInfosRecherche();
vue.basculerAffichageZoneCache();
afficherRequeteEtLancerRecherche();
}
});
 
vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
 
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
afficherInfoRecherche();
lancerRecherche(vue.getChaineRecherche());
collecterInfosRecherche();
afficherRequeteEtLancerRecherche();
}
}
});
 
vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
 
@Override
public void onClick(ClickEvent event) {
if (vue.getValeurRechercheSimple().equals(vue.getLabelRecherche())) {
86,12 → 118,52
}
}
});
}
private void afficherInfoRecherche() {
vue.setRecherchePrecedente();
 
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);
}
}
public abstract void lancerRecherche(String termeRecherche);
 
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;
}
}
/trunk/src/org/tela_botanica/del/client/modeles/InformationsRecherche.java
New file
0,0 → 1,104
package org.tela_botanica.del.client.modeles;
 
public class InformationsRecherche {
 
private String rechercheLibre;
private String departement;
private String taxon;
private String genre;
private String motClef;
private String date;
private String commune;
private String famille;
private String tag;
private String auteur;
 
public String getRechercheLibre() {
return rechercheLibre;
}
 
public void setRechercheLibre(String rechercheLibre) {
this.rechercheLibre = rechercheLibre;
}
 
public String getDepartement() {
return departement;
}
 
public void setDepartement(String departement) {
this.departement = departement;
}
 
public String getTaxon() {
return taxon;
}
 
public void setTaxon(String taxon) {
this.taxon = taxon;
}
 
public String getGenre() {
return genre;
}
 
public void setGenre(String genre) {
this.genre = genre;
}
 
public String getMotClef() {
return motClef;
}
 
public void setMotClef(String motClef) {
this.motClef = motClef;
}
 
public String getDate() {
return date;
}
 
public void setDate(String date) {
this.date = date;
}
 
public String getCommune() {
return commune;
}
 
public void setCommune(String commune) {
this.commune = commune;
}
 
public String getFamille() {
return famille;
}
 
public void setFamille(String famille) {
this.famille = famille;
}
 
public String getTag() {
return tag;
}
 
public void setTag(String tag) {
this.tag = tag;
}
 
public String getAuteur() {
return auteur;
}
 
public void setAuteur(String auteur) {
this.auteur = auteur;
}
}