Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 1985 → Rev 1986

/trunk/src/org/tela_botanica/del/client/modeles/InformationsRecherche.java
27,6 → 27,8
private String motClefCel;
 
private String date;
private String pays;
 
private String commune;
 
117,7 → 119,15
this.date = date;
}
}
public String setPays(String pays) {
return this.pays = pays;
}
 
public String getPays() {
return pays;
}
public String getCommune() {
return commune;
}
235,6 → 245,7
chaine += estNonNull(commune) ? "&masque.commune=" + URL.encodeQueryString(commune) : "";
chaine += estNonNull(famille) ? "&masque.famille=" + URL.encodeQueryString(famille) : "";
chaine += estNonNull(auteur) ? "&masque.auteur=" + URL.encodeQueryString(auteur) : "";
chaine += estNonNull(pays) ? "&masque.pays=" + URL.encodeQueryString(pays) : "";
String urlCourante = Window.Location.getHref();
Config config = new Config();
/trunk/src/org/tela_botanica/del/client/i18n/Vocabulary.properties
208,6 → 208,7
mot_clef = Mot-clé
date = Date
formatDate = (jj/mm/aaaa ou aaaa)
pays = Pays
commune = Commune
famille = Famille (Latin)
tag = Tag
/trunk/src/org/tela_botanica/del/client/i18n/Vocabulary.java
232,6 → 232,15
String commentaires();
 
/**
* Translated "Pays".
*
* @return translated "Pays"
*/
@DefaultStringValue("Pays")
@Key("pays")
String pays();
/**
* Translated "Commune".
*
* @return translated "Commune"
/trunk/src/org/tela_botanica/del/client/utils/UtilitairesServiceResultat.java
4,7 → 4,9
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.config.Config;
707,4 → 709,15
}
return id;
}
 
public static Map<String, String> parserListePays(JSONValue retourJson) {
Map<String, String> listePays = new LinkedHashMap<String, String>();
JSONArray tableauPays = retourJson.isArray();
int nbPays = (int) tableauPays.size();
for (int i = 0; i < nbPays; i++) {
JSONObject pays = tableauPays.get(i).isObject();
listePays.put(pays.get("code_iso_3166_1").isString().stringValue(), pays.get("nom_fr").isString().stringValue());
}
return listePays;
}
}
/trunk/src/org/tela_botanica/del/client/cache/CacheClient.java
2,6 → 2,7
 
import java.util.Arrays;
import java.util.List;
import java.util.Map;
 
import org.tela_botanica.del.client.config.Config;
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
48,6 → 49,8
};
private ModeTri modeTri = ModeTri.TRI_ASCENDANT;
private Map<String, String> listePays;
public void supprimerFiltreStatut() {
this.statut = null;
}
98,6 → 101,7
String referentiel = Location.getParameter("masque.referentiel");
String protocole = Location.getParameter("protocole");
String statutParam = Location.getParameter("masque.type");
String paysParam = Location.getParameter("masque.pays");
String page = Location.getParameter("page");
Integer pageInt = null;
127,6 → 131,7
rechercheParArguments.setAuteur(auteur);
rechercheParArguments.setDate(date);
rechercheParArguments.setTag(tag);
rechercheParArguments.setPays(paysParam);
if (protocole != null && !protocole.equals("")) {
CacheClient.getInstance().setIdProtocoleEnAttente(protocole);
378,6 → 383,14
}
public void setListePays(Map<String, String> listePays) {
this.listePays = listePays;
}
public Map<String, String> getListePays() {
return listePays;
}
public String genererUrlCourante() {
String urlCourante = Window.Location.getHref();
Config config = new Config();
/trunk/src/org/tela_botanica/del/client/services/rest/PaysServiceConcret.java
New file
0,0 → 1,36
package org.tela_botanica.del.client.services.rest;
 
import java.util.Map;
 
import org.tela_botanica.del.client.config.Config;
import org.tela_botanica.del.client.services.RequestBuilderWithCredentials;
import org.tela_botanica.del.client.services.rest.async.PaysCallback;
import org.tela_botanica.del.client.services.rest.async.PHPCallback.ModeRequete;
 
public class PaysServiceConcret implements PaysService {
private String baseUrl;
private Map<String, String> pays;
 
public PaysServiceConcret() {
Config config = new Config();
this.baseUrl = config.getServiceBaseUrl();
}
public PaysServiceConcret(Config config) {
this.baseUrl = config.getServiceBaseUrl();
}
 
@Override
public void getPays(PaysCallback callback) {
String urlService = baseUrl+"ontologie/pays/";
RequestBuilderWithCredentials rb = new RequestBuilderWithCredentials(RequestBuilderWithCredentials.GET, urlService);
callback.setMode(ModeRequete.LECTURE);
try {
rb.sendRequest(null, callback);
} catch (Exception e) {
//TODO: quoi faire si la requete est mal formée coté client avant d'être envoyée ?
}
}
}
/trunk/src/org/tela_botanica/del/client/services/rest/async/PaysCallback.java
New file
0,0 → 1,15
package org.tela_botanica.del.client.services.rest.async;
 
import java.util.Map;
 
import org.tela_botanica.del.client.utils.UtilitairesServiceResultat;
 
import com.google.gwt.json.client.JSONParser;
 
public abstract class PaysCallback extends PHPCallback<Map<String, String>> {
 
@Override
public Map<String, String> parserJSON(String retourService) {
return UtilitairesServiceResultat.parserListePays(JSONParser.parseStrict(retourService));
}
}
/trunk/src/org/tela_botanica/del/client/services/rest/PaysService.java
New file
0,0 → 1,7
package org.tela_botanica.del.client.services.rest;
 
import org.tela_botanica.del.client.services.rest.async.PaysCallback;
 
public interface PaysService {
public void getPays(PaysCallback callback);
}
/trunk/src/org/tela_botanica/del/client/services/ReferentielService.java
13,7 → 13,7
public static Map<String, String> getReferentiels() {
// le fonctionnement de l'i18n empeche de mettre les référentiels dans
// des fichiers de config car il est impossigble de charger les termes
// des fichiers de config car il est impossible de charger les termes
// de vocabulaires associés avec la réflexivité
if(referentiels == null) {
// attention l'utilisation de LinkedHashmap est importante pour conserver
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.ui.xml
17,69 → 17,81
<g:Button ui:field="boutonFermer" styleName="{style.boutonFermer}" text="Fermer"></g:Button>
<g:Button ui:field="boutonVider" styleName="{style.boutonVider}" text="Vider"></g:Button>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.contientMots}" styleName="petit"/>
<g:TextBox ui:field="contientMots" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.famille}" styleName="petit"/>
<g:TextBox ui:field="famille" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.referentiel}" styleName="petit"/>
<g:ListBox ui:field="referentiel" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.taxon}" styleName="petit"/>
<g:HTMLPanel ui:field="taxon" />
</g:HTMLPanel>
 
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.genre}" styleName="petit"/>
<g:TextBox ui:field="genre" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.commune}" styleName="petit"/>
<g:HTMLPanel ui:field="commune" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.departement}" styleName="petit"/>
<g:TextBox ui:field="departement" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.conteneurDeuxPanneaux}">
<g:HTMLPanel styleName="{style.panneauGauche}">
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.contientMots}" styleName="petit"/>
<g:TextBox ui:field="contientMots" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.referentiel}" styleName="petit"/>
<g:ListBox ui:field="referentiel" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.auteur}" styleName="petit"/>
<g:TextBox ui:field="auteur" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.date} {constants.formatDate}" styleName="petit"/>
<g:TextBox ui:field="date" />
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.famille}" styleName="petit"/>
<g:TextBox ui:field="famille" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.genre}" styleName="petit"/>
<g:TextBox ui:field="genre" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.taxon}" styleName="petit"/>
<g:HTMLPanel ui:field="taxon" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.date} {constants.formatDate}" styleName="petit"/>
<g:TextBox ui:field="date" />
</g:HTMLPanel>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.panneauDroite}">
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.pays}" styleName="petit"/>
<g:ListBox ui:field="pays" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.departement}" styleName="petit"/>
<g:TextBox ui:field="departement" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.commune}" styleName="petit"/>
<g:HTMLPanel ui:field="commune" />
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="{constants.auteur}" styleName="petit"/>
<g:TextBox ui:field="auteur" />
</g:HTMLPanel>
<g:HTMLPanel ui:field="conteneurMotCle" styleName="{style.champRecherche}">
<g:Label text="{constants.tag}" styleName="petit"/>
<g:TextBox ui:field="motCle" />
</g:HTMLPanel>
<g:HTMLPanel ui:field="conteneurMotCleCel" styleName="{style.champRecherche}">
<g:Label text="{constants.tagCel}" styleName="petit"/>
<g:TextBox ui:field="motCleCel" />
</g:HTMLPanel>
<g:HTMLPanel ui:field="conteneurMotCleDel" styleName="{style.champRecherche}">
<g:Label text="{constants.tagDel}" styleName="petit"/>
<g:TextBox ui:field="motCleDel" />
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
<g:HTMLPanel ui:field="conteneurMotCle" styleName="{style.champRecherche}">
<g:Label text="{constants.tag}" styleName="petit"/>
<g:TextBox ui:field="motCle" />
</g:HTMLPanel>
<g:HTMLPanel ui:field="conteneurMotCleCel" styleName="{style.champRecherche}">
<g:Label text="{constants.tagCel}" styleName="petit"/>
<g:TextBox ui:field="motCleCel" />
</g:HTMLPanel>
<g:HTMLPanel ui:field="conteneurMotCleDel" styleName="{style.champRecherche}">
<g:Label text="{constants.tagDel}" styleName="petit"/>
<g:TextBox ui:field="motCleDel" />
</g:HTMLPanel>
 
<g:Button styleName="{style.boutonRecherche} {style.rechercherAvance}" ui:field="boutonRechercheAvancee" text="{constants.rechercher}"></g:Button>
<g:HTMLPanel styleName="nettoyage" />
</g:HTMLPanel>
<g:HTMLPanel styleName="droite">
<g:HTMLPanel ui:field="zoneRss" styleName="{style.zoneRss}"></g:HTMLPanel>
</g:HTMLPanel>
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRecherchePresenteur.java
12,6 → 12,9
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.ModeRecherche;
import org.tela_botanica.del.client.services.ReferentielService;
import org.tela_botanica.del.client.services.rest.PaysService;
import org.tela_botanica.del.client.services.rest.PaysServiceConcret;
import org.tela_botanica.del.client.services.rest.async.PaysCallback;
import org.tela_botanica.del.client.utils.InfosNomPourAutocompletion;
import org.tela_botanica.del.client.utils.UtilitairesAutoCompletionService;
 
68,6 → 71,8
public String getAuteur();
 
public String getDate();
public String getPays();
 
public void setValeurRechercheSimple(String valeurRecherche);
 
114,6 → 119,8
public void cacherChampsTagsImage();
public void cacherChampsTagsObs();
 
void remplirListePays(Map<String, String> listePays);
 
}
 
private Vue vue;
160,6 → 167,19
vue.setReferentielLectureSeule(true);
}
if(CacheClient.getInstance().getListePays() != null) {
vue.remplirListePays(CacheClient.getInstance().getListePays());
} else {
PaysService paysService = new PaysServiceConcret();
paysService.getPays(new PaysCallback() {
@Override
public void surRetour(Map<String, String> listePays) {
CacheClient.getInstance().setListePays(listePays);
MoteurRecherchePresenteur.this.vue.remplirListePays(listePays);
}
});
}
if(estPourRechercheImages()) {
vue.cacherChampsTagsObs();
} else {
361,6 → 381,7
informationRecherche.setAuteur(vue.getAuteur());
informationRecherche.setDate(vue.getDate());
informationRecherche.setReferentiel(vue.getReferentiel());
informationRecherche.setPays(vue.getPays());
}
if(CacheClient.getInstance().getReferentielNonModifiable()) {
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.java
28,6 → 28,14
 
private static Binder uiBinder = GWT.create(Binder.class);
private String labelRecherche = "";
private Map<String,String> listePays;
private InformationsRecherche informationRecherche;
// Si l'on charge une recherche précédente et que la liste des pays n'est
// pas encore arrivée, on stocke le pays pour l'afficher quand la liste arrive
private String paysEnAttente;
 
@UiField
Panel rechercheAvancee, taxon, commune, zoneRss, conteneurMotCle, conteneurMotCleCel, conteneurMotCleDel ;
38,7 → 46,7
@UiField
TextBox recherchePrincipale, contientMots, departement, famille, genre, motCle, motCleCel, motCleDel, auteur, date;
@UiField
ListBox referentiel;
ListBox referentiel, pays;
 
public MoteurRechercheVue(String labelRecherche) {
initWidget(uiBinder.createAndBindUi(this));
55,6 → 63,29
}
referentiel.setItemSelected(1, true);
}
@Override
public void remplirListePays(Map<String, String> listePays) {
this.listePays = listePays;
pays.clear();
// Pour pouvoir annuler la selection de pays, on ajoute un item vide
pays.addItem("", "");
int index = 1;
for (Iterator<String> iterator = listePays.keySet().iterator(); iterator.hasNext();) {
String codePays = iterator.next();
pays.addItem(listePays.get(codePays), codePays);
if(paysEnAttente != null && codePays.equals(paysEnAttente)) {
pays.setItemSelected(index, true);
}
index++;
}
if(paysEnAttente != null) {
afficherLigneInfoRecherche(informationRecherche);
}
paysEnAttente = null;
}
 
public String getLabelRecherche() {
return labelRecherche;
103,6 → 134,10
public void setContientMots(String mots) {
contientMots.setText(mots);
}
public String getPays() {
return pays.getValue(pays.getSelectedIndex());
}
 
public String getDepartement() {
return departement.getText();
179,6 → 214,18
referentiel.setSelectedIndex(i);
}
}
// la liste des pays du champs de recherche est asynchrone
// donc elle peut ne pas avoir encore été chargée
if(listePays != null) {
for(int i = 0; i < pays.getItemCount(); i++) {
if(pays.getValue(i).equals(paysEnAttente)) {
pays.setSelectedIndex(i);
}
}
} else {
paysEnAttente = informationsRecherche.getPays();
}
 
afficherLigneInfoRecherche(informationsRecherche);
}
190,6 → 237,9
* @param informationRecherche
*/
private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
this.informationRecherche = informationRecherche;
// tax dep com fam gen ta mo au date
StringBuffer texteRecherchePrecedente = new StringBuffer();
 
202,6 → 252,9
if (informationRecherche.getDepartement() != null && !informationRecherche.getDepartement().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
}
if (listePays != null && informationRecherche.getPays() != null && !informationRecherche.getPays().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().pays() + ":" + listePays.get(informationRecherche.getPays()) + " ");
}
if (informationRecherche.getCommune() != null && !informationRecherche.getCommune().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
}
232,7 → 285,7
if (informationRecherche.getReferentiel() != null && !informationRecherche.getReferentiel().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().referentiel() + ":" + informationRecherche.getReferentiel() + " ");
}
 
recherchePrecedente.setText(texteRecherchePrecedente.toString());
}
 
/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRecherche.css
33,9 → 33,22
z-index: 2000
}
 
.conteneurDeuxPanneaux {
width: 700px;
}
 
.panneauGauche {
float: left;
width: 300px;
}
 
.panneauDroite {
float: left;
width: 300px;
}
 
.champRecherche {
float: left;
width: 40%;
width: 90%;
padding-bottom: 5px
}
 
57,7 → 70,8
padding: 0 0 0 16px;
color: blue;
text-decoration: underline;
cursor: pointer
cursor: pointer;
height: 19px;
}
 
.boutonVider {
67,12 → 81,16
padding: 0 0 0 16px;
color: blue;
text-decoration: underline;
cursor: pointer
cursor: pointer;
height: 19px
}
 
.rechercherAvance {
margin-top:10px;
margin-top: 0px;
margin-left:0px;
top: 195px;
position: relative;
left: 25px;
}
 
.zoneRecherche {
83,4 → 101,9
}
.zoneRss a {
border:none;
}
 
.nettoyage {
visibility: hidden;
clear: both;
}