Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 456 → Rev 457

/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.ui.xml
38,7 → 38,7
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.commune}" />
<g:TextBox ui:field="commune" />
<g:HTMLPanel ui:field="commune" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRecherchePresenteur.java
16,6 → 16,7
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.http.client.Response;
import com.google.gwt.user.client.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;
35,10 → 36,11
public abstract HasClickHandlers getChampSaisieCliquable();
public abstract String getValeurRechercheSimple();
public void setValeurRechercheSimple(String valeurRecherche);
public void setValeurDepartement(String dpt);
public String getLabelRecherche();
public String getRecherchePrincipale();
public String getDepartement();
public String getCommune();
public HasWidgets getCommune();
public HasWidgets getTaxon();
public String getFamille();
public String getGenre();
52,9 → 54,10
}
 
private final Vue vue;
private boolean pourRechercheImages = false, pourRechercheObservations= false;
private ModeRecherche modeRecherche;
 
private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur;
private AutoCompletionComboBoxPresenteur autoCompletionCommunesPresenteur;
public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
74,28 → 77,48
// 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;
gererEvenements();
}
private void setMode(ModeRecherche mode) {
switch(mode) {
case MODE_IMAGE:
this.pourRechercheImages = true;
break;
case MODE_OBSERVATION:
this.pourRechercheObservations = true;
}
modeRecherche = mode;
}
public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletion, Vue vue, ModeRecherche mode) {
public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletionTaxon,
AutoCompletionComboBoxPresenteur presenteurAutoCompletionCommunes,
Vue vue, ModeRecherche mode) {
this.vue = vue;
setMode(mode);
autoCompletionNomTaxonsPresenteur = presenteurAutoCompletion;
autoCompletionNomTaxonsPresenteur = presenteurAutoCompletionTaxon;
autoCompletionCommunesPresenteur = presenteurAutoCompletionCommunes;
gererEvenements();
}
 
103,6 → 126,7
public void go(HasWidgets composite) {
afficherRequeteEtLancerRecherche();
autoCompletionNomTaxonsPresenteur.go(vue.getTaxon());
autoCompletionCommunesPresenteur.go(vue.getCommune());
vue.ajouterVue(composite);
vue.focusSaisie();
}
135,8 → 159,7
@Override
public void onClick(ClickEvent event) {
 
autoCompletionNomTaxonsPresenteur.nettoyer();
vue.nettoyer();
nettoyerChamps();
 
InformationsRecherche infosRecherche = new InformationsRecherche();
if (estPourRechercheImages()) {
175,12 → 198,18
}
});
}
private void nettoyerChamps() {
autoCompletionCommunesPresenteur.nettoyer();
autoCompletionNomTaxonsPresenteur.nettoyer();
vue.nettoyer();
}
 
public void collecterInfosRecherche() {
InformationsRecherche informationRecherche = new InformationsRecherche();
informationRecherche.setTaxon(autoCompletionNomTaxonsPresenteur.getValeur());
informationRecherche.setDepartement(vue.getDepartement());
informationRecherche.setCommune(vue.getCommune());
informationRecherche.setCommune(autoCompletionCommunesPresenteur.getValeur());
informationRecherche.setFamille(vue.getFamille());
informationRecherche.setGenre(vue.getGenre());
informationRecherche.setTag(vue.getTag());
217,18 → 246,18
public abstract void lancerRecherche();
 
public boolean estPourRechercheImages() {
return pourRechercheImages;
return (modeRecherche == ModeRecherche.MODE_IMAGE);
}
 
public boolean estPourRechercheObservations() {
return pourRechercheObservations;
return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
}
private Vue getVue() {
return vue;
}
public ModeRecherche getMode() {
if(estPourRechercheImages()) {
return ModeRecherche.MODE_IMAGE;
} else {
return ModeRecherche.MODE_OBSERVATION;
}
return modeRecherche;
}
}
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.java
26,13 → 26,13
private String labelRecherche = "";
 
@UiField
Panel rechercheAvancee, taxon;
Panel rechercheAvancee, taxon, commune;
@UiField
Label lienRechercheAvancee, recherchePrecedente;
@UiField
Button boutonRecherche, boutonRechercheAvancee, boutonFermer, boutonVider;
@UiField
TextBox recherchePrincipale, departement, commune, famille, genre, tag, motCle, auteur, date;
TextBox recherchePrincipale, departement, famille, genre, tag, motCle, auteur, date;
 
public MoteurRechercheVue(String labelRecherche) {
initWidget(uiBinder.createAndBindUi(this));
96,11 → 96,15
public void setValeurRechercheSimple(String valeurRecherche) {
recherchePrincipale.setText(valeurRecherche);
}
@Override
public void setValeurDepartement(String dpt) {
departement.setValue(dpt);
}
 
public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche) {
recherchePrincipale.setText(informationsRecherche.getRechercheLibre());
departement.setText(informationsRecherche.getDepartement());
commune.setText(informationsRecherche.getCommune());
famille.setText(informationsRecherche.getFamille());
genre.setText(informationsRecherche.getGenre());
tag.setText(informationsRecherche.getTag());
168,8 → 172,8
return departement.getText();
}
 
public String getCommune() {
return commune.getText();
public HasWidgets getCommune() {
return commune;
}
 
public HasWidgets getTaxon() {