1 |
package org.tela_botanica.del.client.composants.moteurrecherche;
|
1 |
package org.tela_botanica.del.client.composants.moteurrecherche;
|
2 |
|
2 |
|
3 |
import org.tela_botanica.del.client.cache.CacheClient;
|
3 |
import org.tela_botanica.del.client.cache.CacheClient;
|
4 |
import org.tela_botanica.del.client.composants.formulaires.AutoCompletionComboBoxPresenteur;
|
4 |
import org.tela_botanica.del.client.composants.formulaires.AutoCompletionComboBoxPresenteur;
|
5 |
import org.tela_botanica.del.client.composants.formulaires.AutoCompletionComboBoxVue;
|
5 |
import org.tela_botanica.del.client.composants.formulaires.AutoCompletionComboBoxVue;
|
6 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
6 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
7 |
import org.tela_botanica.del.client.modeles.InformationsRecherche;
|
7 |
import org.tela_botanica.del.client.modeles.InformationsRecherche;
|
8 |
import org.tela_botanica.del.client.modeles.ModeRecherche;
|
8 |
import org.tela_botanica.del.client.modeles.ModeRecherche;
|
9 |
import org.tela_botanica.del.client.utils.UtilitairesAutoCompletionService;
|
9 |
import org.tela_botanica.del.client.utils.UtilitairesAutoCompletionService;
|
10 |
|
10 |
|
11 |
import com.google.gwt.event.dom.client.ClickEvent;
|
11 |
import com.google.gwt.event.dom.client.ClickEvent;
|
12 |
import com.google.gwt.event.dom.client.ClickHandler;
|
12 |
import com.google.gwt.event.dom.client.ClickHandler;
|
13 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
13 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
14 |
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
|
14 |
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
|
15 |
import com.google.gwt.event.dom.client.KeyCodes;
|
15 |
import com.google.gwt.event.dom.client.KeyCodes;
|
16 |
import com.google.gwt.event.dom.client.KeyPressEvent;
|
16 |
import com.google.gwt.event.dom.client.KeyPressEvent;
|
17 |
import com.google.gwt.event.dom.client.KeyPressHandler;
|
17 |
import com.google.gwt.event.dom.client.KeyPressHandler;
|
18 |
import com.google.gwt.http.client.Response;
|
18 |
import com.google.gwt.http.client.Response;
|
19 |
import com.google.gwt.user.client.ui.HasWidgets;
|
19 |
import com.google.gwt.user.client.ui.HasWidgets;
|
20 |
import com.google.gwt.user.client.ui.IsWidget;
|
20 |
import com.google.gwt.user.client.ui.IsWidget;
|
21 |
|
21 |
|
22 |
public abstract class MoteurRecherchePresenteur extends Presenteur {
|
22 |
public abstract class MoteurRecherchePresenteur extends Presenteur {
|
23 |
|
23 |
|
24 |
public abstract interface Vue extends IsWidget {
|
24 |
public abstract interface Vue extends IsWidget {
|
25 |
public void ajouterVue(HasWidgets composite);
|
25 |
public void ajouterVue(HasWidgets composite);
|
26 |
public HasClickHandlers getLienRechercheAvancee();
|
26 |
public HasClickHandlers getLienRechercheAvancee();
|
27 |
public void basculerAffichageZoneCache();
|
27 |
public void basculerAffichageZoneCache();
|
28 |
public HasClickHandlers getBoutonRechercheSimple();
|
28 |
public HasClickHandlers getBoutonRechercheSimple();
|
29 |
public HasClickHandlers getBoutonFermer();
|
29 |
public HasClickHandlers getBoutonFermer();
|
30 |
public HasClickHandlers getBoutonVider();
|
30 |
public HasClickHandlers getBoutonVider();
|
31 |
public HasClickHandlers getBoutonRechercheAvancee();
|
31 |
public HasClickHandlers getBoutonRechercheAvancee();
|
32 |
public HasKeyPressHandlers getChampSaisie();
|
32 |
public HasKeyPressHandlers getChampSaisie();
|
33 |
public HasClickHandlers getChampSaisieCliquable();
|
33 |
public HasClickHandlers getChampSaisieCliquable();
|
34 |
public String getValeurRechercheSimple();
|
34 |
public String getValeurRechercheSimple();
|
35 |
public String getLabelRecherche();
|
35 |
public String getLabelRecherche();
|
36 |
public String getContientMots();
|
36 |
public String getContientMots();
|
37 |
public String getDepartement();
|
37 |
public String getDepartement();
|
38 |
public HasWidgets getCommune();
|
38 |
public HasWidgets getCommune();
|
39 |
public HasWidgets getTaxon();
|
39 |
public HasWidgets getTaxon();
|
40 |
public String getFamille();
|
40 |
public String getFamille();
|
41 |
public String getGenre();
|
41 |
public String getGenre();
|
42 |
public String getTag();
|
42 |
public String getTag();
|
43 |
public String getMotCle();
|
43 |
public String getMotCle();
|
44 |
public String getAuteur();
|
44 |
public String getAuteur();
|
45 |
public String getDate();
|
45 |
public String getDate();
|
46 |
public void setValeurRechercheSimple(String valeurRecherche);
|
46 |
public void setValeurRechercheSimple(String valeurRecherche);
|
47 |
public void setContientMots(String mots);
|
47 |
public void setContientMots(String mots);
|
48 |
public void setValeurDepartement(String dpt);
|
48 |
public void setValeurDepartement(String dpt);
|
49 |
public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
|
49 |
public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche);
|
50 |
public void focusSaisie();
|
50 |
public void focusSaisie();
|
51 |
public void nettoyer();
|
51 |
public void nettoyer();
|
52 |
}
|
52 |
}
|
53 |
|
53 |
|
54 |
private final Vue vue;
|
54 |
private final Vue vue;
|
55 |
private ModeRecherche modeRecherche;
|
55 |
private ModeRecherche modeRecherche;
|
56 |
public enum TypeMoteur {SIMPLE, AVANCEE};
|
56 |
public enum TypeMoteur {SIMPLE, AVANCEE};
|
57 |
private TypeMoteur typeMoteur = TypeMoteur.SIMPLE;
|
57 |
private TypeMoteur typeMoteur = TypeMoteur.SIMPLE;
|
58 |
|
58 |
|
59 |
private AutoCompletionComboBoxPresenteur completionTaxonsPresenteur;
|
59 |
private AutoCompletionComboBoxPresenteur completionTaxonsPresenteur;
|
60 |
private AutoCompletionComboBoxPresenteur completionCommunesPresenteur;
|
60 |
private AutoCompletionComboBoxPresenteur completionCommunesPresenteur;
|
61 |
|
61 |
|
62 |
public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
|
62 |
public MoteurRecherchePresenteur(Vue vue, ModeRecherche mode) {
|
63 |
this.vue = vue;
|
63 |
this.vue = vue;
|
64 |
setMode(mode);
|
64 |
setMode(mode);
|
65 |
this.creerCompletionTaxons();
|
65 |
this.creerCompletionTaxons();
|
66 |
this.creerCompletionCommunes();
|
66 |
this.creerCompletionCommunes();
|
67 |
gererEvenements();
|
67 |
gererEvenements();
|
68 |
}
|
68 |
}
|
69 |
|
69 |
|
70 |
public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletionTaxon,
|
70 |
public MoteurRecherchePresenteur(AutoCompletionComboBoxPresenteur presenteurAutoCompletionTaxon,
|
71 |
AutoCompletionComboBoxPresenteur presenteurAutoCompletionCommunes,
|
71 |
AutoCompletionComboBoxPresenteur presenteurAutoCompletionCommunes,
|
72 |
Vue vue, ModeRecherche mode) {
|
72 |
Vue vue, ModeRecherche mode) {
|
73 |
this.vue = vue;
|
73 |
this.vue = vue;
|
74 |
setMode(mode);
|
74 |
setMode(mode);
|
75 |
completionTaxonsPresenteur = presenteurAutoCompletionTaxon;
|
75 |
completionTaxonsPresenteur = presenteurAutoCompletionTaxon;
|
76 |
completionCommunesPresenteur = presenteurAutoCompletionCommunes;
|
76 |
completionCommunesPresenteur = presenteurAutoCompletionCommunes;
|
77 |
gererEvenements();
|
77 |
gererEvenements();
|
78 |
}
|
78 |
}
|
79 |
|
79 |
|
80 |
private Vue getVue() {
|
80 |
private Vue getVue() {
|
81 |
return vue;
|
81 |
return vue;
|
82 |
}
|
82 |
}
|
83 |
|
83 |
|
84 |
public ModeRecherche getMode() {
|
84 |
public ModeRecherche getMode() {
|
85 |
return modeRecherche;
|
85 |
return modeRecherche;
|
86 |
}
|
86 |
}
|
87 |
|
87 |
|
88 |
private void setMode(ModeRecherche mode) {
|
88 |
private void setMode(ModeRecherche mode) {
|
89 |
modeRecherche = mode;
|
89 |
modeRecherche = mode;
|
90 |
}
|
90 |
}
|
91 |
|
91 |
|
92 |
public void setTypeMoteur(TypeMoteur typeMoteur) {
|
92 |
public void setTypeMoteur(TypeMoteur typeMoteur) {
|
93 |
this.typeMoteur = typeMoteur;
|
93 |
this.typeMoteur = typeMoteur;
|
94 |
}
|
94 |
}
|
95 |
|
95 |
|
96 |
public boolean estPourRechercheImages() {
|
96 |
public boolean estPourRechercheImages() {
|
97 |
return (modeRecherche == ModeRecherche.MODE_IMAGE);
|
97 |
return (modeRecherche == ModeRecherche.MODE_IMAGE);
|
98 |
}
|
98 |
}
|
99 |
|
99 |
|
100 |
public boolean estPourRechercheObservations() {
|
100 |
public boolean estPourRechercheObservations() {
|
101 |
return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
|
101 |
return (modeRecherche == ModeRecherche.MODE_OBSERVATION);
|
102 |
}
|
102 |
}
|
103 |
|
103 |
|
104 |
private void creerCompletionTaxons() {
|
104 |
private void creerCompletionTaxons() {
|
105 |
completionTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
|
105 |
completionTaxonsPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionNomLocale) {
|
106 |
protected String effectuerPreTraitementChaineRequete(String requete) {
|
106 |
protected String effectuerPreTraitementChaineRequete(String requete) {
|
107 |
return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
|
107 |
return UtilitairesAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceSlash(requete);
|
108 |
// A décommenter lors de l'utilisation des web services eflore
|
108 |
// A décommenter lors de l'utilisation des web services eflore
|
109 |
// return
|
109 |
// return
|
110 |
// RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
|
110 |
// RetourAutoCompletionService.effectuerPreTraitementChaineRequeteGenreEspeceEflore(requete);
|
111 |
}
|
111 |
}
|
112 |
|
112 |
|
113 |
@Override
|
113 |
@Override
|
114 |
protected String[] parserResultatRequete(Response response) {
|
114 |
protected String[] parserResultatRequete(Response response) {
|
115 |
return UtilitairesAutoCompletionService.parserRetourSimple(response);
|
115 |
return UtilitairesAutoCompletionService.parserRetourSimple(response);
|
116 |
// A décommenter lors de l'utilisation des web services eflore
|
116 |
// A décommenter lors de l'utilisation des web services eflore
|
117 |
// return RetourAutoCompletionService.parserRetourOss(response);
|
117 |
// return RetourAutoCompletionService.parserRetourOss(response);
|
118 |
}
|
118 |
}
|
119 |
};
|
119 |
};
|
120 |
}
|
120 |
}
|
121 |
|
121 |
|
122 |
private void creerCompletionCommunes() {
|
122 |
private void creerCompletionCommunes() {
|
123 |
completionCommunesPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionCommunes) {
|
123 |
completionCommunesPresenteur = new AutoCompletionComboBoxPresenteur(new AutoCompletionComboBoxVue(), UtilitairesAutoCompletionService.urlServiceCompletionCommunes) {
|
124 |
protected String effectuerPreTraitementChaineRequete(String requete) {
|
124 |
protected String effectuerPreTraitementChaineRequete(String requete) {
|
125 |
return requete;
|
125 |
return requete;
|
126 |
}
|
126 |
}
|
127 |
|
127 |
|
128 |
@Override
|
128 |
@Override
|
129 |
protected void surSelectionSuggestion(String suggestion) {
|
129 |
protected void surSelectionSuggestion(String suggestion) {
|
130 |
String[] tableauCommuneDpt = suggestion.split(" ");
|
- |
|
131 |
if(tableauCommuneDpt.length == 2) {
|
130 |
collecterInfosRecherche();
|
132 |
String dpt = tableauCommuneDpt[1].replaceAll("\\(", "").replaceAll("\\)", "");
|
131 |
setValeur(getInformationsRechercheEnCache().getCommune());
|
133 |
getVue().setValeurDepartement(dpt);
|
132 |
vue.setValeurDepartement(getInformationsRechercheEnCache().getDepartement());
|
134 |
setValeur(tableauCommuneDpt[0]);
|
- |
|
135 |
}
|
- |
|
136 |
}
|
133 |
}
|
137 |
|
134 |
|
138 |
@Override
|
135 |
@Override
|
139 |
protected String[] parserResultatRequete(Response response) {
|
136 |
protected String[] parserResultatRequete(Response response) {
|
140 |
return UtilitairesAutoCompletionService.parserRetourSimple(response);
|
137 |
return UtilitairesAutoCompletionService.parserRetourSimple(response);
|
141 |
}
|
138 |
}
|
142 |
};
|
139 |
};
|
143 |
}
|
140 |
}
|
144 |
|
141 |
|
145 |
@Override
|
142 |
@Override
|
146 |
public void go(HasWidgets composite) {
|
143 |
public void go(HasWidgets composite) {
|
147 |
afficherRequeteEtLancerRecherche();
|
144 |
afficherRequeteEtLancerRecherche();
|
148 |
completionTaxonsPresenteur.go(vue.getTaxon());
|
145 |
completionTaxonsPresenteur.go(vue.getTaxon());
|
149 |
completionCommunesPresenteur.go(vue.getCommune());
|
146 |
completionCommunesPresenteur.go(vue.getCommune());
|
150 |
vue.ajouterVue(composite);
|
147 |
vue.ajouterVue(composite);
|
151 |
vue.focusSaisie();
|
148 |
vue.focusSaisie();
|
152 |
}
|
149 |
}
|
153 |
|
150 |
|
154 |
@Override
|
151 |
@Override
|
155 |
protected void gererEvenements() {
|
152 |
protected void gererEvenements() {
|
156 |
vue.getLienRechercheAvancee().addClickHandler(new ClickHandler() {
|
153 |
vue.getLienRechercheAvancee().addClickHandler(new ClickHandler() {
|
157 |
public void onClick(ClickEvent event) {
|
154 |
public void onClick(ClickEvent event) {
|
158 |
vue.setContientMots(vue.getValeurRechercheSimple());
|
155 |
vue.setContientMots(vue.getValeurRechercheSimple());
|
159 |
vue.basculerAffichageZoneCache();
|
156 |
vue.basculerAffichageZoneCache();
|
160 |
}
|
157 |
}
|
161 |
});
|
158 |
});
|
162 |
|
159 |
|
163 |
vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
|
160 |
vue.getBoutonRechercheSimple().addClickHandler(new ClickHandler() {
|
164 |
public void onClick(ClickEvent event) {
|
161 |
public void onClick(ClickEvent event) {
|
165 |
setTypeMoteur(TypeMoteur.SIMPLE);
|
162 |
setTypeMoteur(TypeMoteur.SIMPLE);
|
166 |
collecterInfosRecherche();
|
163 |
collecterInfosRecherche();
|
167 |
afficherRequeteEtLancerRecherche();
|
164 |
afficherRequeteEtLancerRecherche();
|
168 |
}
|
165 |
}
|
169 |
});
|
166 |
});
|
170 |
|
167 |
|
171 |
vue.getBoutonFermer().addClickHandler(new ClickHandler() {
|
168 |
vue.getBoutonFermer().addClickHandler(new ClickHandler() {
|
172 |
public void onClick(ClickEvent event) {
|
169 |
public void onClick(ClickEvent event) {
|
173 |
vue.setValeurRechercheSimple(vue.getContientMots());
|
170 |
vue.setValeurRechercheSimple(vue.getContientMots());
|
174 |
vue.basculerAffichageZoneCache();
|
171 |
vue.basculerAffichageZoneCache();
|
175 |
}
|
172 |
}
|
176 |
});
|
173 |
});
|
177 |
|
174 |
|
178 |
vue.getBoutonVider().addClickHandler(new ClickHandler() {
|
175 |
vue.getBoutonVider().addClickHandler(new ClickHandler() {
|
179 |
public void onClick(ClickEvent event) {
|
176 |
public void onClick(ClickEvent event) {
|
180 |
nettoyerChamps();
|
177 |
nettoyerChamps();
|
181 |
InformationsRecherche infosRecherche = new InformationsRecherche();
|
178 |
InformationsRecherche infosRecherche = new InformationsRecherche();
|
182 |
if (estPourRechercheImages()) {
|
179 |
if (estPourRechercheImages()) {
|
183 |
CacheClient.getInstance().setInformationsRechercheImage(infosRecherche);
|
180 |
CacheClient.getInstance().setInformationsRechercheImage(infosRecherche);
|
184 |
} else if (estPourRechercheObservations()) {
|
181 |
} else if (estPourRechercheObservations()) {
|
185 |
CacheClient.getInstance().setInformationsRechercheObservation(infosRecherche);
|
182 |
CacheClient.getInstance().setInformationsRechercheObservation(infosRecherche);
|
186 |
}
|
183 |
}
|
187 |
}
|
184 |
}
|
188 |
});
|
185 |
});
|
189 |
|
186 |
|
190 |
vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
|
187 |
vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
|
191 |
public void onClick(ClickEvent event) {
|
188 |
public void onClick(ClickEvent event) {
|
192 |
setTypeMoteur(TypeMoteur.AVANCEE);
|
189 |
setTypeMoteur(TypeMoteur.AVANCEE);
|
193 |
collecterInfosRecherche();
|
190 |
collecterInfosRecherche();
|
194 |
vue.basculerAffichageZoneCache();
|
191 |
vue.basculerAffichageZoneCache();
|
195 |
afficherRequeteEtLancerRecherche();
|
192 |
afficherRequeteEtLancerRecherche();
|
196 |
}
|
193 |
}
|
197 |
});
|
194 |
});
|
198 |
|
195 |
|
199 |
vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
|
196 |
vue.getChampSaisie().addKeyPressHandler(new KeyPressHandler() {
|
200 |
public void onKeyPress(KeyPressEvent event) {
|
197 |
public void onKeyPress(KeyPressEvent event) {
|
201 |
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
|
198 |
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
|
202 |
setTypeMoteur(TypeMoteur.SIMPLE);
|
199 |
setTypeMoteur(TypeMoteur.SIMPLE);
|
203 |
collecterInfosRecherche();
|
200 |
collecterInfosRecherche();
|
204 |
afficherRequeteEtLancerRecherche();
|
201 |
afficherRequeteEtLancerRecherche();
|
205 |
}
|
202 |
}
|
206 |
}
|
203 |
}
|
207 |
});
|
204 |
});
|
208 |
|
205 |
|
209 |
vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
|
206 |
vue.getChampSaisieCliquable().addClickHandler(new ClickHandler() {
|
210 |
public void onClick(ClickEvent event) {
|
207 |
public void onClick(ClickEvent event) {
|
211 |
if (vue.getValeurRechercheSimple().equals(vue.getLabelRecherche())) {
|
208 |
if (vue.getValeurRechercheSimple().equals(vue.getLabelRecherche())) {
|
212 |
vue.setValeurRechercheSimple("");
|
209 |
vue.setValeurRechercheSimple("");
|
213 |
}
|
210 |
}
|
214 |
}
|
211 |
}
|
215 |
});
|
212 |
});
|
216 |
}
|
213 |
}
|
217 |
|
214 |
|
218 |
private void nettoyerChamps() {
|
215 |
private void nettoyerChamps() {
|
219 |
completionCommunesPresenteur.nettoyer();
|
216 |
completionCommunesPresenteur.nettoyer();
|
220 |
completionTaxonsPresenteur.nettoyer();
|
217 |
completionTaxonsPresenteur.nettoyer();
|
221 |
vue.nettoyer();
|
218 |
vue.nettoyer();
|
222 |
}
|
219 |
}
|
223 |
|
220 |
|
224 |
public void collecterInfosRecherche() {
|
221 |
public void collecterInfosRecherche() {
|
225 |
InformationsRecherche informationRecherche = new InformationsRecherche();
|
222 |
InformationsRecherche informationRecherche = new InformationsRecherche();
|
226 |
informationRecherche.setRechercheLibre(this.getRechercheLibre());
|
223 |
informationRecherche.setRechercheLibre(this.getRechercheLibre());
|
227 |
if (this.typeMoteur == TypeMoteur.AVANCEE) {
|
224 |
if (this.typeMoteur == TypeMoteur.AVANCEE) {
|
228 |
informationRecherche.setTaxon(completionTaxonsPresenteur.getValeur());
|
225 |
informationRecherche.setTaxon(completionTaxonsPresenteur.getValeur());
|
229 |
informationRecherche.setDepartement(vue.getDepartement());
|
226 |
informationRecherche.setDepartement(vue.getDepartement());
|
230 |
informationRecherche.setCommune(completionCommunesPresenteur.getValeur());
|
227 |
informationRecherche.setCommune(completionCommunesPresenteur.getValeur());
|
231 |
informationRecherche.setFamille(vue.getFamille());
|
228 |
informationRecherche.setFamille(vue.getFamille());
|
232 |
informationRecherche.setGenre(vue.getGenre());
|
229 |
informationRecherche.setGenre(vue.getGenre());
|
233 |
informationRecherche.setTag(vue.getTag());
|
230 |
informationRecherche.setTag(vue.getTag());
|
234 |
informationRecherche.setMotClef(vue.getMotCle());
|
231 |
informationRecherche.setMotClef(vue.getMotCle());
|
235 |
informationRecherche.setAuteur(vue.getAuteur());
|
232 |
informationRecherche.setAuteur(vue.getAuteur());
|
236 |
informationRecherche.setDate(vue.getDate());
|
233 |
informationRecherche.setDate(vue.getDate());
|
237 |
}
|
234 |
}
|
238 |
|
235 |
|
239 |
if (estPourRechercheImages()) {
|
236 |
if (estPourRechercheImages()) {
|
240 |
CacheClient.getInstance().setPageCouranteRechercheImages(1);
|
237 |
CacheClient.getInstance().setPageCouranteRechercheImages(1);
|
241 |
CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
|
238 |
CacheClient.getInstance().setInformationsRechercheImage(informationRecherche);
|
242 |
} else if (estPourRechercheObservations()) {
|
239 |
} else if (estPourRechercheObservations()) {
|
243 |
CacheClient.getInstance().setPageCouranteRechercheObservations(1);
|
240 |
CacheClient.getInstance().setPageCouranteRechercheObservations(1);
|
244 |
CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
|
241 |
CacheClient.getInstance().setInformationsRechercheObservation(informationRecherche);
|
245 |
}
|
242 |
}
|
246 |
}
|
243 |
}
|
247 |
|
244 |
|
248 |
private String getRechercheLibre() {
|
245 |
private String getRechercheLibre() {
|
249 |
String rechercheLibre = "";
|
246 |
String rechercheLibre = "";
|
250 |
switch (this.typeMoteur) {
|
247 |
switch (this.typeMoteur) {
|
251 |
case SIMPLE :
|
248 |
case SIMPLE :
|
252 |
rechercheLibre = vue.getValeurRechercheSimple();
|
249 |
rechercheLibre = vue.getValeurRechercheSimple();
|
253 |
break;
|
250 |
break;
|
254 |
case AVANCEE :
|
251 |
case AVANCEE :
|
255 |
rechercheLibre = vue.getContientMots();
|
252 |
rechercheLibre = vue.getContientMots();
|
256 |
break;
|
253 |
break;
|
257 |
default:
|
254 |
default:
|
258 |
// TODO : voir comment gérer les exceptions proprement
|
255 |
// TODO : voir comment gérer les exceptions proprement
|
259 |
//throw new Exception("Le type de moteur de recherche indiqué n'est pas disponilbe");
|
256 |
//throw new Exception("Le type de moteur de recherche indiqué n'est pas disponilbe");
|
260 |
}
|
257 |
}
|
261 |
return rechercheLibre;
|
258 |
return rechercheLibre;
|
262 |
}
|
259 |
}
|
263 |
|
260 |
|
264 |
private InformationsRecherche getInformationsRechercheEnCache() {
|
261 |
private InformationsRecherche getInformationsRechercheEnCache() {
|
265 |
if (estPourRechercheImages()) {
|
262 |
if (estPourRechercheImages()) {
|
266 |
return CacheClient.getInstance().getInformationsRechercheImage();
|
263 |
return CacheClient.getInstance().getInformationsRechercheImage();
|
267 |
} else if (estPourRechercheObservations()) {
|
264 |
} else if (estPourRechercheObservations()) {
|
268 |
return CacheClient.getInstance().getInformationsRechercheObservation();
|
265 |
return CacheClient.getInstance().getInformationsRechercheObservation();
|
269 |
}
|
266 |
}
|
270 |
return null;
|
267 |
return null;
|
271 |
}
|
268 |
}
|
272 |
|
269 |
|
273 |
public void afficherRequeteEtLancerRecherche() {
|
270 |
public void afficherRequeteEtLancerRecherche() {
|
274 |
InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
|
271 |
InformationsRecherche informationsRecherche = getInformationsRechercheEnCache();
|
275 |
if (informationsRecherche != null) {
|
272 |
if (informationsRecherche != null) {
|
276 |
completionTaxonsPresenteur.setValeur(informationsRecherche.getTaxon());
|
273 |
completionTaxonsPresenteur.setValeur(informationsRecherche.getTaxon());
|
- |
|
274 |
completionCommunesPresenteur.setValeur(informationsRecherche.getCommune());
|
277 |
vue.chargerValeursRecherchePrecedente(informationsRecherche);
|
275 |
vue.chargerValeursRecherchePrecedente(informationsRecherche);
|
278 |
}
|
276 |
}
|
279 |
lancerRecherche();
|
277 |
lancerRecherche();
|
280 |
}
|
278 |
}
|
281 |
|
279 |
|
282 |
public abstract void lancerRecherche();
|
280 |
public abstract void lancerRecherche();
|
283 |
}
|
281 |
}
|