Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 544 → Rev 545

/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRecherchePresenteur.java
22,17 → 22,16
public abstract class MoteurRecherchePresenteur extends Presenteur {
 
public abstract interface Vue extends IsWidget {
 
public abstract void ajouterVue(HasWidgets composite);
public abstract HasClickHandlers getLienRechercheAvancee();
public abstract void basculerAffichageZoneCache();
public abstract HasClickHandlers getBoutonRechercheSimple();
public abstract HasClickHandlers getBoutonFermer();
public abstract HasClickHandlers getBoutonVider();
public abstract HasClickHandlers getBoutonRechercheAvancee();
public abstract HasKeyPressHandlers getChampSaisie();
public abstract HasClickHandlers getChampSaisieCliquable();
public abstract String getValeurRechercheSimple();
public void ajouterVue(HasWidgets composite);
public HasClickHandlers getLienRechercheAvancee();
public void basculerAffichageZoneCache();
public HasClickHandlers getBoutonRechercheSimple();
public HasClickHandlers getBoutonFermer();
public HasClickHandlers getBoutonVider();
public HasClickHandlers getBoutonRechercheAvancee();
public HasKeyPressHandlers getChampSaisie();
public HasClickHandlers getChampSaisieCliquable();
public String getValeurRechercheSimple();
public String getLabelRecherche();
public String getContientMots();
public String getDepartement();
57,54 → 56,14
public enum TypeMoteur {SIMPLE, AVANCEE};
private TypeMoteur typeMoteur = TypeMoteur.SIMPLE;
 
private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
private AutoCompletionComboBoxPresenteur autoCompletionCommunesPresenteur;
private AutoCompletionComboBoxPresenteur completionTaxonsPresenteur;
private AutoCompletionComboBoxPresenteur completionCommunesPresenteur;
public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
AutoCompletionComboBoxPresenteur completionNomTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
 
protected String effectuerPreTraitementChaineRequete(String requete) {
return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
// A décommenter lors de l'utilisation des web services eflore
// return
// RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
}
 
@Override
protected String[] parserResultatRequete(Response response) {
return UtilitairesAutoCompletionService.parserRetourSimple(response);
// A décommenter lors de l'utilisation des web services eflore
// return RetourAutoCompletionService.parserRetourOss(response);
}
};
AutoCompletionComboBoxPresenteur completionCommunesPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionCommunes) {
 
protected String effectuerPreTraitementChaineRequete(String requete) {
return requete;
}
@Override
protected void surSelectionSuggestion(String suggestion) {
String[] tableauCommuneDpt = suggestion.split(" ");
if(tableauCommuneDpt.length == 2) {
String dpt = tableauCommuneDpt[1].replaceAll("\\(", "").replaceAll("\\)", "");
getVue().setValeurDepartement(dpt);
setValeur(tableauCommuneDpt[0]);
}
}
 
@Override
protected String[] parserResultatRequete(Response response) {
return UtilitairesAutoCompletionService.parserRetourSimple(response);
}
};
this.vue = vue;
setMode(mode);
 
autoCompletionCommunesPresenteur = completionCommunesPresenteur;
autoCompletionNomTaxonsPresenteur = completionNomTaxonsPresenteur;
this.creerCompletionTaxons();
this.creerCompletionCommunes();
gererEvenements();
}
113,8 → 72,8
Vue vue, ModeRecherche mode) {
this.vue = vue;
setMode(mode);
autoCompletionNomTaxonsPresenteur = presenteurAutoCompletionTaxon;
autoCompletionCommunesPresenteur = presenteurAutoCompletionCommunes;
completionTaxonsPresenteur = presenteurAutoCompletionTaxon;
completionCommunesPresenteur = presenteurAutoCompletionCommunes;
gererEvenements();
}
142,11 → 101,52
return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
}
 
private void creerCompletionTaxons() {
completionTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
protected String effectuerPreTraitementChaineRequete(String requete) {
return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
// A décommenter lors de l'utilisation des web services eflore
// return
// RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
}
 
@Override
protected String[] parserResultatRequete(Response response) {
return UtilitairesAutoCompletionService.parserRetourSimple(response);
// A décommenter lors de l'utilisation des web services eflore
// return RetourAutoCompletionService.parserRetourOss(response);
}
};
}
private void creerCompletionCommunes() {
completionCommunesPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionCommunes) {
protected String effectuerPreTraitementChaineRequete(String requete) {
return requete;
}
@Override
protected void surSelectionSuggestion(String suggestion) {
String[] tableauCommuneDpt = suggestion.split(" ");
if(tableauCommuneDpt.length == 2) {
String dpt = tableauCommuneDpt[1].replaceAll("\\(", "").replaceAll("\\)", "");
getVue().setValeurDepartement(dpt);
setValeur(tableauCommuneDpt[0]);
}
}
 
@Override
protected String[] parserResultatRequete(Response response) {
return UtilitairesAutoCompletionService.parserRetourSimple(response);
}
};
}
@Override
public void go(HasWidgets composite) {
afficherRequeteEtLancerRecherche();
autoCompletionNomTaxonsPresenteur.go(vue.getTaxon());
autoCompletionCommunesPresenteur.go(vue.getCommune());
completionTaxonsPresenteur.go(vue.getTaxon());
completionCommunesPresenteur.go(vue.getCommune());
vue.ajouterVue(composite);
vue.focusSaisie();
}
216,23 → 216,25
}
private void nettoyerChamps() {
autoCompletionCommunesPresenteur.nettoyer();
autoCompletionNomTaxonsPresenteur.nettoyer();
completionCommunesPresenteur.nettoyer();
completionTaxonsPresenteur.nettoyer();
vue.nettoyer();
}
 
public void collecterInfosRecherche() {
InformationsRecherche informationRecherche = new InformationsRecherche();
informationRecherche.setTaxon(autoCompletionNomTaxonsPresenteur.getValeur());
informationRecherche.setDepartement(vue.getDepartement());
informationRecherche.setCommune(autoCompletionCommunesPresenteur.getValeur());
informationRecherche.setFamille(vue.getFamille());
informationRecherche.setGenre(vue.getGenre());
informationRecherche.setTag(vue.getTag());
informationRecherche.setMotClef(vue.getMotCle());
informationRecherche.setAuteur(vue.getAuteur());
informationRecherche.setDate(vue.getDate());
informationRecherche.setRechercheLibre(this.getRechercheLibre());
if (this.typeMoteur == TypeMoteur.AVANCEE) {
informationRecherche.setTaxon(completionTaxonsPresenteur.getValeur());
informationRecherche.setDepartement(vue.getDepartement());
informationRecherche.setCommune(completionCommunesPresenteur.getValeur());
informationRecherche.setFamille(vue.getFamille());
informationRecherche.setGenre(vue.getGenre());
informationRecherche.setTag(vue.getTag());
informationRecherche.setMotClef(vue.getMotCle());
informationRecherche.setAuteur(vue.getAuteur());
informationRecherche.setDate(vue.getDate());
}
 
if (estPourRechercheImages()) {
CacheClient.getInstance().setPageCouranteRechercheImages(1);
271,7 → 273,7
public void afficherRequeteEtLancerRecherche() {
InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
if (informationsRecherche != null) {
autoCompletionNomTaxonsPresenteur.setValeur(informationsRecherche.getTaxon());
completionTaxonsPresenteur.setValeur(informationsRecherche.getTaxon());
vue.chargerValeursRecherchePrecedente(informationsRecherche);
}
lancerRecherche();