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