Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 450 → Rev 451

/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRecherchePresenteur.java
2,8 → 2,10
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.composants.formulaires.AutoCompletionComboBoxPresenteur;
import org.tela_botanica.del.client.composants.formulaires.AutoCompletionComboBoxVue;
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.ModeRecherche;
import org.tela_botanica.del.client.services.UtilitairesAutoCompletionService;
 
import com.google.gwt.event.dom.client.ClickEvent;
22,67 → 24,42
 
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 setValeurRechercheSimple(String valeurRecherche);
 
public String getLabelRecherche();
 
public HasText getRecherchePrincipale();
 
public HasText getDepartement();
 
public HasText getCommune();
 
public String getRecherchePrincipale();
public String getDepartement();
public String getCommune();
public HasWidgets getTaxon();
 
public HasText getFamille();
 
public HasText getGenre();
 
public HasText getTag();
 
public HasText getMotCle();
 
public HasText getAuteur();
 
public HasText getDate();
 
public String getFamille();
public String getGenre();
public String getTag();
public String getMotCle();
public String getAuteur();
public String getDate();
public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
 
public void focusSaisie();
 
public void nettoyer();
}
 
private final Vue vue;
private final boolean pourRechercheImages, pourRechercheObservations;
private boolean pourRechercheImages = false, pourRechercheObservations= false;
 
private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
AutoCompletionComboBoxPresenteur completionNomTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
 
public MoteurRecherchePresenteur(Vue vue, boolean pourRechercheImages, boolean pourRechercheObservations) {
this.vue = vue;
this.pourRechercheImages = pourRechercheImages;
this.pourRechercheObservations = pourRechercheObservations;
 
autoCompletionNomTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
 
protected String effectuerPreTraitementChaineRequete(String requete) {
return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
// A décommenter lors de l'utilisation des web services eflore
97,14 → 74,36
// return RetourAutoCompletionService.parserRetourOss(response);
}
};
this.vue = vue;
setMode(mode);
 
autoCompletionNomTaxonsPresenteur = completionNomTaxonsPresenteur;
gererEvenements();
}
private void setMode(ModeRecherche mode) {
switch(mode) {
case MODE_IMAGE:
this.pourRechercheImages = true;
break;
case MODE_OBSERVATION:
this.pourRechercheObservations = true;
}
}
public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletion, Vue vue, ModeRecherche mode) {
this.vue = vue;
setMode(mode);
autoCompletionNomTaxonsPresenteur = presenteurAutoCompletion;
gererEvenements();
}
 
@Override
public void go(HasWidgets composite) {
afficherRequeteEtLancerRecherche();
autoCompletionNomTaxonsPresenteur.go(vue.getTaxon());
composite.add(vue.asWidget());
vue.ajouterVue(composite);
vue.focusSaisie();
}
 
140,9 → 139,9
vue.nettoyer();
 
InformationsRecherche infosRecherche = new InformationsRecherche();
if (isPourRechercheImages()) {
if (estPourRechercheImages()) {
CacheClient.getInstance().setInformationsRechercheImage(infosRecherche);
} else if (isPourRechercheObservations()) {
} else if (estPourRechercheObservations()) {
CacheClient.getInstance().setInformationsRechercheObservation(infosRecherche);
}
}
177,30 → 176,30
});
}
 
private void collecterInfosRecherche() {
public void collecterInfosRecherche() {
InformationsRecherche informationRecherche = new InformationsRecherche();
informationRecherche.setTaxon(autoCompletionNomTaxonsPresenteur.getValeur());
informationRecherche.setDepartement(vue.getDepartement().getText());
informationRecherche.setCommune(vue.getCommune().getText());
informationRecherche.setFamille(vue.getFamille().getText());
informationRecherche.setGenre(vue.getGenre().getText());
informationRecherche.setTag(vue.getTag().getText());
informationRecherche.setMotClef(vue.getMotCle().getText());
informationRecherche.setAuteur(vue.getAuteur().getText());
informationRecherche.setDate(vue.getDate().getText());
informationRecherche.setRechercheLibre(vue.getRecherchePrincipale().getText());
informationRecherche.setDepartement(vue.getDepartement());
informationRecherche.setCommune(vue.getCommune());
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(vue.getRecherchePrincipale());
 
if (isPourRechercheImages()) {
if (estPourRechercheImages()) {
CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
} else if (isPourRechercheObservations()) {
} else if (estPourRechercheObservations()) {
CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
}
}
 
private InformationsRecherche getInformationsRechercheEnCache() {
if (isPourRechercheImages()) {
if (estPourRechercheImages()) {
return CacheClient.getInstance().getInformationsRechercheImage();
} else if (isPourRechercheObservations()) {
} else if (estPourRechercheObservations()) {
return CacheClient.getInstance().getInformationsRechercheObservation();
}
return null;
217,11 → 216,19
 
public abstract void lancerRecherche();
 
public boolean isPourRechercheImages() {
public boolean estPourRechercheImages() {
return pourRechercheImages;
}
 
public boolean isPourRechercheObservations() {
public boolean estPourRechercheObservations() {
return pourRechercheObservations;
}
public ModeRecherche getMode() {
if(estPourRechercheImages()) {
return ModeRecherche.MODE_IMAGE;
} else {
return ModeRecherche.MODE_OBSERVATION;
}
}
}