Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 160 → Rev 161

/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservations.css
New file
0,0 → 1,6
.recherchePrincipale {width: 50%; font-size:18px; padding:5px; -moz-border-radius:10px; border:solid 1px #AAA;}
.boutonRecherche {border:solid 1px #AAA; -moz-border-radius:10px; padding:5px; cursor:pointer}
.lienRechercheAvancee {cursor:pointer; text-decoration:underline; color:blue; float:right; margin-right:240px; margin-top:10px}
.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:5px; background:white}
.champRecherche {float:left; width:50%; padding-bottom:5px}
.recherchePrecedente {color:#555; padding:5px; font-style:italic}
/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservationsVue.ui.xml
New file
0,0 → 1,64
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'
ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat' ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator" ui:generateLocales="default">
<ui:with field='res' type='org.tela_botanica.del.client.Ressources'/>
<ui:with field="constants" type="org.tela_botanica.del.client.i18n.Vocabulary"/>
 
<ui:style src="RechercheObservations.css" />
<g:HTMLPanel styleName="contenu">
<g:Label text="Vue Recherche Observations" styleName="titre"/>
<g:Label text="la vue pour rechercher parmi les observations" styleName="petit"/>
<g:TextBox styleName="{style.recherchePrincipale}" ui:field="recherchePrincipale">Recherche libre</g:TextBox>
<g:Button styleName="{style.boutonRecherche}" ui:field="boutonRecherche">Rechercher</g:Button>
<g:Label styleName="{style.lienRechercheAvancee}" ui:field="lienRechercheAvancee">Recherche avancée</g:Label>
<g:HTMLPanel styleName="{style.rechercheAvancee}" ui:field="rechercheAvancee">
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Département"/>
<g:TextBox ui:field="departement"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Commune"/>
<g:TextBox ui:field="commune"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Taxon"/>
<g:TextBox ui:field="taxon"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Famille"/>
<g:TextBox ui:field="famille"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Genre"/>
<g:TextBox ui:field="genre"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Tag"/>
<g:TextBox ui:field="tag"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Mot-clé"/>
<g:TextBox ui:field="motCle"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Auteur"/>
<g:TextBox ui:field="auteur"/>
</g:HTMLPanel>
<g:HTMLPanel styleName="{style.champRecherche}">
<g:Label text="Date"/>
<g:TextBox ui:field="date"/>
</g:HTMLPanel>
<g:Button styleName="{style.boutonRecherche}" ui:field="boutonRechercheAvancee">Rechercher</g:Button>
<g:HTMLPanel styleName="nettoyage" />
</g:HTMLPanel>
<g:Label ui:field="recherchePrecedente" styleName="{style.recherchePrecedente}"></g:Label>
</g:HTMLPanel>
</ui:UiBinder>
/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservationsPresenteur.java
New file
0,0 → 1,117
package org.tela_botanica.del.client.vues.rechercheobservations;
 
import java.util.HashMap;
import java.util.Iterator;
 
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
 
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
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.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
 
public class RechercheObservationsPresenteur extends Presenteur {
 
public RechercheObservationsPresenteur() {
super(new RechercheObservationsVue());
}
 
public void go(HasWidgets composite) {
if (composite == null) {
composite = RootPanel.get();
}
composite.add(this.getVue());
handleEvents();
}
 
protected void handleEvents() {
 
RechercheObservationsVue vue = (RechercheObservationsVue) getVue();
 
// Gestion du clic dans la zone de saisie
vue.recherchePrincipale.addClickHandler(new ClickHandler() {
 
public void onClick(ClickEvent event) {
TextBox recherchePrincipale = (TextBox) event.getSource();
if (recherchePrincipale.getText().equals("Recherche libre")) {
recherchePrincipale.setText("");
}
}
});
 
// Gestion de l'affichage de la recherche Avancée
vue.lienRechercheAvancee.addClickHandler(new ClickHandler() {
 
public void onClick(ClickEvent event) {
Panel rechercheAvancee = ((RechercheObservationsVue) getVue()).rechercheAvancee;
rechercheAvancee.setVisible(!rechercheAvancee.isVisible());
}
});
 
// Gestion de l'évènement recherche sur le clic ou sur l'appui de la
// touche Entrée
vue.boutonRecherche.addClickHandler(new ClickHandler() {
 
public void onClick(ClickEvent event) {
lancerRecherche();
}
});
 
vue.boutonRechercheAvancee.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
lancerRecherche();
}
});
 
vue.recherchePrincipale.addKeyPressHandler(new KeyPressHandler() {
 
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
lancerRecherche();
}
}
});
}
 
// Lancer la recherche
public void lancerRecherche() {
 
RechercheObservationsVue vue = (RechercheObservationsVue) getVue();
 
// Masquer la recherche Avancée
vue.rechercheAvancee.setVisible(false);
 
// Collecter les valeurs du formulaire
HashMap<String, String> valeursRecherche = new HashMap<String, String>();
valeursRecherche.put("search", vue.recherchePrincipale.getText());
valeursRecherche.put("dept", vue.departement.getText());
valeursRecherche.put("com", vue.commune.getText());
valeursRecherche.put("taxon", vue.taxon.getText());
valeursRecherche.put("fam", vue.famille.getText());
valeursRecherche.put("gen", vue.genre.getText());
valeursRecherche.put("tag", vue.tag.getText());
valeursRecherche.put("motCle", vue.motCle.getText());
valeursRecherche.put("auteur", vue.auteur.getText());
valeursRecherche.put("date", vue.date.getText());
 
vue.recherchePrecedente.setText(getChaineRecherche(valeursRecherche));
}
 
private String getChaineRecherche(HashMap<String, String> valeursRecherche) {
Iterator<String> itCles = valeursRecherche.keySet().iterator();
String chaineRecherche = "";
while (itCles.hasNext()) {
String cle = itCles.next();
String valeur = valeursRecherche.get(cle);
if (valeur != "") {
chaineRecherche += cle + ":=" + valeur + " ";
}
}
return chaineRecherche;
}
}
/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservationsVue.java
New file
0,0 → 1,40
package org.tela_botanica.del.client.vues.rechercheobservations;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
 
public class RechercheObservationsVue extends Composite {
 
// Gestion d'UiBinder
interface Binder extends UiBinder<Widget, RechercheObservationsVue> {
}
 
private static Binder binder = GWT.create(Binder.class);
 
// Définir ici les champs de la vue à afficher en protected
@UiField
protected TextBox recherchePrincipale, departement, commune, taxon, famille, genre, tag, motCle, auteur, date;
 
@UiField
protected Button boutonRecherche, boutonRechercheAvancee;
 
@UiField
protected Label lienRechercheAvancee, recherchePrecedente;
 
@UiField
protected Panel rechercheAvancee;
 
// Constructeur de la vue
public RechercheObservationsVue() {
initWidget(binder.createAndBindUi(this));
rechercheAvancee.setVisible(false);
}
 
}