/trunk/src/org/tela_botanica/del/client/services/rest/async/ImagesParTaxonCallback.java |
---|
28,7 → 28,6 |
public abstract void surImagesRecues(ImageServiceResultat imagesRecues); |
private ImageServiceResultat convertirReponseVersListeImage(Response reponse) { |
//Window.alert(reponse.getText()); |
ImageServiceResultat resultat = new ImageServiceResultat(JSONParser.parseStrict(reponse.getText())); |
return resultat; |
} |
/trunk/src/org/tela_botanica/del/client/services/UtilitairesAutoCompletionService.java |
---|
New file |
0,0 → 1,62 |
package org.tela_botanica.del.client.services; |
import com.google.gwt.http.client.Response; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONParser; |
import com.google.gwt.json.client.JSONValue; |
public class UtilitairesAutoCompletionService { |
// Attention à n'utiliser que si eflore est installé |
public static String urlServiceCompletionNomEflore = "http://localhost/service:eflore:0.1/bdtfx/noms"; |
public static String urlServiceCompletionNomLocale = "../jrest/NomsTaxons/"; |
public static String effectuerPreTraitementChaineRequeteGenreEspeceSlash(String requete) { |
String chaineTraitee = requete; |
String[] parties = requete.split(" ", 2); |
if(parties.length == 2) { |
if(parties[1].trim().isEmpty()) { |
parties[1] = "*"; |
} |
chaineTraitee = parties[0]+"/"+parties[1]; |
} |
return chaineTraitee; |
} |
public static String effectuerPreTraitementChaineRequeteGenreEspeceEflore(String requete) { |
String chaineTraitee = "?recherche=etendue&ns.structure=au&retour.format=oss&masque="+requete; |
return chaineTraitee; |
} |
public static String[] parserRetourSimple(Response response) { |
final JSONValue responseValue = JSONParser.parseStrict(response.getText()); |
JSONArray noms; |
String[] valeurs = new String[0]; |
if ((noms=responseValue.isArray()) != null) { |
final int taillemax = noms.size(); |
valeurs = new String[taillemax]; |
for (int i = 0; i < taillemax; i++) { |
valeurs[i] = (noms.get(i).isArray().get(0).isString().stringValue()); |
} |
} |
return valeurs; |
} |
public static String[] parserRetourOss(Response response) { |
JSONValue retourJson = JSONParser.parseStrict(response.getText()); |
JSONArray tableauResultat = retourJson.isArray().get(1).isArray(); |
String[] suggestions = new String[tableauResultat.size()]; |
for (int i = 0; i < tableauResultat.size(); i++) { |
suggestions[i] = tableauResultat.get(i).isString().stringValue(); |
} |
return suggestions; |
} |
} |
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.ui.xml |
---|
26,7 → 26,7 |
<g:HTMLPanel styleName="{style.champRecherche}"> |
<g:Label text="{constants.taxon}" /> |
<g:TextBox ui:field="taxon" /> |
<g:HTMLPanel ui:field="taxon" /> |
</g:HTMLPanel> |
<g:HTMLPanel styleName="{style.champRecherche}"> |
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRecherchePresenteur.java |
---|
1,8 → 1,10 |
package org.tela_botanica.del.client.composants.moteurrecherche; |
import org.tela_botanica.del.client.cache.CacheClient; |
import org.tela_botanica.del.client.composants.formulaires.AutoCompletionComboBoxPresenteur; |
import org.tela_botanica.del.client.composants.presenteur.Presenteur; |
import org.tela_botanica.del.client.modeles.InformationsRecherche; |
import org.tela_botanica.del.client.services.UtilitairesAutoCompletionService; |
import com.google.gwt.event.dom.client.ClickEvent; |
import com.google.gwt.event.dom.client.ClickHandler; |
11,6 → 13,10 |
import com.google.gwt.event.dom.client.KeyCodes; |
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.json.client.JSONArray; |
import com.google.gwt.json.client.JSONParser; |
import com.google.gwt.json.client.JSONValue; |
import com.google.gwt.user.client.ui.HasText; |
import com.google.gwt.user.client.ui.HasWidgets; |
import com.google.gwt.user.client.ui.IsWidget; |
43,7 → 49,7 |
public HasText getCommune(); |
public HasText getTaxon(); |
public HasWidgets getTaxon(); |
public HasText getFamille(); |
63,10 → 69,28 |
private final Vue vue; |
private final boolean pourRechercheImages, pourRechercheObservations; |
private AutoCompletionComboBoxPresenteur autoCompletionNomTaxonsPresenteur; |
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 |
//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); |
} |
}; |
gererEvenements(); |
} |
73,6 → 97,7 |
@Override |
public void go(HasWidgets composite) { |
afficherRequeteEtLancerRecherche(); |
autoCompletionNomTaxonsPresenteur.go(vue.getTaxon()); |
composite.add(vue.asWidget()); |
} |
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.java |
---|
11,6 → 11,7 |
import com.google.gwt.user.client.ui.Button; |
import com.google.gwt.user.client.ui.Composite; |
import com.google.gwt.user.client.ui.HasText; |
import com.google.gwt.user.client.ui.HasWidgets; |
import com.google.gwt.user.client.ui.Label; |
import com.google.gwt.user.client.ui.Panel; |
import com.google.gwt.user.client.ui.TextBox; |
25,13 → 26,13 |
private String labelRecherche = ""; |
@UiField |
Panel rechercheAvancee; |
Panel rechercheAvancee,taxon; |
@UiField |
Label lienRechercheAvancee, recherchePrecedente; |
@UiField |
Button boutonRecherche, boutonRechercheAvancee; |
@UiField |
TextBox recherchePrincipale, departement, commune, taxon, famille, genre, tag, motCle, auteur, date; |
TextBox recherchePrincipale, departement, commune, famille, genre, tag, motCle, auteur, date; |
public MoteurRechercheVue(String labelRecherche) { |
initWidget(uiBinder.createAndBindUi(this)); |
148,7 → 149,7 |
return commune; |
} |
public HasText getTaxon() { |
public HasWidgets getTaxon() { |
return taxon; |
} |
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRecherche.css |
---|
1,6 → 1,6 |
.recherchePrincipale {width: 370px; font-size:18px; padding:5px; -moz-border-radius:10px; border:solid 1px #AAA; float:left;} |
.boutonRecherche {border:solid 1px #AAA; -moz-border-radius:10px; padding:5px; cursor:pointer; float:left; margin:0 10px 0 10px} |
.lienRechercheAvancee {cursor:pointer; text-decoration:underline; color:blue; float:left; margin-right:240px; margin:5px } |
.rechercheAvancee {border:solid 1px #333; padding:10px; -moz-border-radius:0 0 10px 10px; -moz-box-shadow:5px 5px 10px #EEE;position:absolute; width:700px; margin-top:40px; background:white; } |
.rechercheAvancee {border:solid 1px #333; padding:10px; -moz-border-radius:0 0 10px 10px; -moz-box-shadow:5px 5px 10px #EEE;position:absolute; width:700px; margin-top:40px; background:white; z-index:5000} |
.champRecherche {float:left; width:50%; padding-bottom:5px} |
.recherchePrecedente {color:#555; padding:5px; font-style:italic; clear:left} |
/trunk/src/org/tela_botanica/del/client/composants/formulaires/AutoCompletionComboBoxVue.java |
---|
1,8 → 1,6 |
package org.tela_botanica.del.client.composants.formulaires; |
import com.google.gwt.user.client.Timer; |
import com.google.gwt.user.client.ui.LayoutPanel; |
import com.google.gwt.user.client.ui.ListBox; |
import com.google.gwt.user.client.ui.MultiWordSuggestOracle; |
import com.google.gwt.user.client.ui.SuggestBox; |
import com.google.gwt.user.client.ui.SuggestOracle; |
15,7 → 13,8 |
public AutoCompletionComboBoxVue() { |
add(suggestions); |
setHeight("100%"); |
//TODO: voir avec greg si la taille doit être définie ici |
setHeight("25px"); |
setWidth("100%"); |
} |