Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 334 → Rev 335

/trunk/src/org/tela_botanica/del/client/composants/moteurrecherche/MoteurRechercheVue.java
1,7 → 1,7
package org.tela_botanica.del.client.composants.moteurrecherche;
 
import java.util.HashMap;
import java.util.Iterator;
import org.tela_botanica.del.client.i18n.I18n;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
8,10 → 8,9
import com.google.gwt.event.dom.client.HasKeyPressHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;
19,15 → 18,21
 
public class MoteurRechercheVue extends Composite implements MoteurRecherchePresenteur.Vue {
 
interface Binder extends UiBinder<Widget, MoteurRechercheVue> {}
interface Binder extends UiBinder<Widget, MoteurRechercheVue> {
}
 
private static Binder uiBinder = GWT.create(Binder.class);
private String labelRecherche = "";
@UiField Panel rechercheAvancee;
@UiField Label lienRechercheAvancee, recherchePrecedente;
@UiField Button boutonRecherche, boutonRechercheAvancee;
@UiField TextBox recherchePrincipale, departement, commune, taxon, famille, genre, tag, motCle, auteur, date;
 
@UiField
Panel rechercheAvancee;
@UiField
Label lienRechercheAvancee, recherchePrecedente;
@UiField
Button boutonRecherche, boutonRechercheAvancee;
@UiField
TextBox recherchePrincipale, departement, commune, taxon, famille, genre, tag, motCle, auteur, date;
 
public MoteurRechercheVue(String labelRecherche) {
initWidget(uiBinder.createAndBindUi(this));
this.labelRecherche = labelRecherche;
38,7 → 43,7
public String getLabelRecherche() {
return labelRecherche;
}
 
@Override
public HasClickHandlers getLienRechercheAvancee() {
return lienRechercheAvancee;
53,7 → 58,7
public HasClickHandlers getBoutonRechercheSimple() {
return boutonRecherche;
}
 
@Override
public HasClickHandlers getBoutonRechercheAvancee() {
return boutonRechercheAvancee;
73,70 → 78,102
public HasClickHandlers getChampSaisieCliquable() {
return recherchePrincipale;
}
 
@Override
public void setValeurRechercheSimple(String valeurRecherche) {
recherchePrincipale.setText(valeurRecherche);
}
 
@Override
public HashMap<String, String> collecterFormulaire() {
public void chargerValeursRecherchePrecedente(InformationsRecherche informationsRecherche) {
getAuteur().setText(informationsRecherche.getAuteur());
getCommune().setText(informationsRecherche.getCommune());
getDate().setText(informationsRecherche.getDate());
getDepartement().setText(informationsRecherche.getDepartement());
getFamille().setText(informationsRecherche.getFamille());
getMotCle().setText(informationsRecherche.getMotClef());
 
HashMap<String, String> champsRecherche = new HashMap<String, String>();
if (!recherchePrincipale.getText().equals("")) {
champsRecherche.put("search", recherchePrincipale.getText());
}
if (!departement.getText().equals("")) {
champsRecherche.put("dept", departement.getText());
if (informationsRecherche.getRechercheLibre() != null && !informationsRecherche.getRechercheLibre().equals("")) {
getRecherchePrincipale().setText(informationsRecherche.getRechercheLibre());
}
if (!commune.getText().equals("")) {
champsRecherche.put("com", commune.getText());
 
afficherLigneInfoRecherche(informationsRecherche);
}
 
/**
* Affiche la ligne d'en tête montrant les elements de la requête à
* l'utilisateur
*
* @param informationRecherche
*/
private void afficherLigneInfoRecherche(InformationsRecherche informationRecherche) {
 
StringBuffer texteRecherchePrecedente = new StringBuffer();
if (informationRecherche.getRechercheLibre()!=null&&!informationRecherche.getRechercheLibre().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().rechercheLibre() + ":" + informationRecherche.getRechercheLibre() + " ");
}
if (!taxon.getText().equals("")) {
champsRecherche.put("taxon", taxon.getText());
if (!informationRecherche.getAuteur().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().auteur() + ":" + informationRecherche.getAuteur() + " ");
}
if (!famille.getText().equals("")) {
champsRecherche.put("fam", famille.getText());
if (!informationRecherche.getCommune().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().commune() + ":" + informationRecherche.getCommune() + " ");
}
if (!genre.getText().equals("")) {
champsRecherche.put("gen", genre.getText());
if (!informationRecherche.getDate().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().date() + ":" + informationRecherche.getDate() + " ");
}
if (!tag.getText().equals("")) {
champsRecherche.put("tag", tag.getText());
if (!informationRecherche.getDepartement().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().departement() + ":" + informationRecherche.getDepartement() + " ");
}
if (!motCle.getText().equals("")) {
champsRecherche.put("motCle", motCle.getText());
if (!informationRecherche.getFamille().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().famille() + ":" + informationRecherche.getFamille() + " ");
}
if (!auteur.getText().equals("")) {
champsRecherche.put("auteur", auteur.getText());
if (!informationRecherche.getGenre().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().genre() + ":" + informationRecherche.getGenre() + " ");
}
if (!date.getText().equals("")) {
champsRecherche.put("date", date.getText());
if (!informationRecherche.getMotClef().equals("")) {
texteRecherchePrecedente.append(I18n.getVocabulary().mot_clef() + ":" + informationRecherche.getMotClef() + " ");
}
return champsRecherche;
recherchePrecedente.setText(texteRecherchePrecedente.toString());
}
@Override
public String getChaineRecherche() {
HashMap<String, String> valeursRecherche = collecterFormulaire();
String chaineRecherche = "";
if (valeursRecherche != null) {
Iterator<String> itCles = valeursRecherche.keySet().iterator();
while (itCles.hasNext()) {
String cle = itCles.next();
String valeur = valeursRecherche.get(cle);
if (valeur != "") {
chaineRecherche += cle + ":=" + valeur + " ";
}
}
}
return chaineRecherche;
 
public HasText getRecherchePrincipale() {
return recherchePrincipale;
}
 
@Override
public void setRecherchePrecedente() {
recherchePrecedente.setText(getChaineRecherche());
public HasText getDepartement() {
return departement;
}
 
public HasText getCommune() {
return commune;
}
 
public HasText getTaxon() {
return taxon;
}
 
public HasText getFamille() {
return famille;
}
 
public HasText getGenre() {
return genre;
}
 
public HasText getTag() {
return tag;
}
 
public HasText getMotCle() {
return motCle;
}
 
public HasText getAuteur() {
return auteur;
}
 
public HasText getDate() {
return date;
}
 
}