Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 329 → Rev 330

/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservationsVue.ui.xml
5,62 → 5,13
 
<ui:style src="RechercheObservations.css" />
<g:HTMLPanel>
<g:Label text="Vue Recherche Observations" styleName="titre"/>
<g:HTMLPanel><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 ui:field="zoneRecherche"/>
</g:HTMLPanel>
<g:Label ui:field="recherchePrecedente" styleName="{style.recherchePrecedente}"></g:Label>
<g:HTMLPanel ui:field="zoneObservations" styleName="{style.zoneObservation}"/>
<g:HTMLPanel ui:field="zonePagination" />
<g:HTMLPanel>
<g:HTMLPanel ui:field="zoneObservations" styleName="{style.zoneObservation}"/>
<g:HTMLPanel ui:field="zonePagination" />
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservationsPresenteur.java
4,6 → 4,8
import java.util.Iterator;
import java.util.List;
 
import org.tela_botanica.del.client.composants.moteurrecherche.MoteurRecherchePresenteur;
import org.tela_botanica.del.client.composants.moteurrecherche.MoteurRechercheVue;
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.utils.MockDatasource;
28,24 → 30,7
public class RechercheObservationsPresenteur extends Presenteur {
 
public abstract interface Vue extends IsWidget {
public HasClickHandlers getRecherchePrincipaleHasClickHandler();
public HasKeyPressHandlers getRecherchePrincipaleHasKeyPressHandlers();
public HasText getRecherchePrincipaleHasText();
public HasText getDepartement();
public HasText getCommune();
public HasText getTaxon();
public HasText getFamille();
public HasText getGenre();
public HasText getTag();
public HasText getMotCle();
public HasText getAuteur();
public HasText getDate();
public HasClickHandlers getBoutonRecherche();
public HasClickHandlers getBoutonRechercheAvancee();
public HasClickHandlers getLienRechercheAvancee();
public HasText getRecherchePrecedente();
public HasWidgets getRechercheAvanceeHasWidget();
public HasVisibility getRechercheAvanceeHasVisibility();
public HasWidgets getZoneRecherche();
public HasWidgets getZoneObservations();
public HasWidgets getZonePagination();
}
62,6 → 47,7
composite = RootPanel.get();
}
composite.add(vue.asWidget());
ajouterMoteurRechercheAvancee();
gererEvenements();
 
// On commence par afficher la totalité des observations
68,104 → 54,26
chercherObservations(null);
afficherObservations();
}
 
protected void gererEvenements() {
 
// Gestion du clic dans la zone de saisie
vue.getRecherchePrincipaleHasClickHandler().addClickHandler(new ClickHandler() {
 
public void onClick(ClickEvent event) {
HasText recherchePrincipale = (HasText) event.getSource();
if (recherchePrincipale.getText().equals("Recherche libre")) {
recherchePrincipale.setText("");
}
}
});
 
// Gestion de l'affichage de la recherche Avancée
vue.getLienRechercheAvancee().addClickHandler(new ClickHandler() {
 
public void onClick(ClickEvent event) {
HasVisibility rechercheAvancee = vue.getRechercheAvanceeHasVisibility();
rechercheAvancee.setVisible(!rechercheAvancee.isVisible());
}
});
 
// Gestion de l'évènement recherche sur le clic ou sur l'appui de la
// touche Entrée
vue.getBoutonRecherche().addClickHandler(new ClickHandler() {
 
public void onClick(ClickEvent event) {
chercherObservations(collecterFormulaire());
protected void ajouterMoteurRechercheAvancee() {
MoteurRecherchePresenteur presenteur = new MoteurRecherchePresenteur(new MoteurRechercheVue("Rechercher une observation"){}) {
@Override
public void lancerRecherche(String termeRecherche) {
chercherObservations(null);
afficherObservations();
}
});
 
vue.getBoutonRechercheAvancee().addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
chercherObservations(collecterFormulaire());
afficherObservations();
}
});
 
vue.getRecherchePrincipaleHasKeyPressHandlers().addKeyPressHandler(new KeyPressHandler() {
 
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
chercherObservations(collecterFormulaire());
afficherObservations();
}
}
});
};
presenteur.go(vue.getZoneRecherche());
}
 
// Gestion de la recherche d'observations :
public HashMap<String, String> collecterFormulaire() {
protected void gererEvenements() {}
 
HashMap<String, String> champsRecherche = new HashMap<String, String>();
 
if (!vue.getRecherchePrincipaleHasText().getText().equals("")) {
champsRecherche.put("search", vue.getRecherchePrincipaleHasText().getText());
}
if (!vue.getDepartement().getText().equals("")) {
champsRecherche.put("dept", vue.getDepartement().getText());
}
if (!vue.getCommune().getText().equals("")) {
champsRecherche.put("com", vue.getCommune().getText());
}
if (!vue.getTaxon().getText().equals("")) {
champsRecherche.put("taxon", vue.getTaxon().getText());
}
if (!vue.getFamille().getText().equals("")) {
champsRecherche.put("fam", vue.getFamille().getText());
}
if (!vue.getGenre().getText().equals("")) {
champsRecherche.put("gen", vue.getGenre().getText());
}
if (!vue.getTag().getText().equals("")) {
champsRecherche.put("tag", vue.getTag().getText());
}
if (!vue.getMotCle().getText().equals("")) {
champsRecherche.put("motCle", vue.getMotCle().getText());
}
if (!vue.getAuteur().getText().equals("")) {
champsRecherche.put("auteur", vue.getAuteur().getText());
}
if (!vue.getDate().getText().equals("")) {
champsRecherche.put("date", vue.getDate().getText());
}
return champsRecherche;
}
 
public void chercherObservations(HashMap<String, String> champsRecherche) {
 
vue.getRechercheAvanceeHasVisibility().setVisible(false);
this.observations = MockDatasource.getInstance().getObservations(champsRecherche);
vue.getRecherchePrecedente().setText(getChaineRecherche(champsRecherche));
}
 
public void afficherObservations() {
 
vue.getZoneObservations().clear();
for (Observation observation : observations) {
ObservationPresenteur presenteur = new ObservationPresenteur(new ObservationVue(), observation);
173,18 → 81,4
}
}
 
private String getChaineRecherche(HashMap<String, String> valeursRecherche) {
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;
}
}
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservationsVue.java
23,116 → 23,25
 
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 Panel zoneRecherche, zoneObservations, zonePagination;
 
@UiField
protected Button boutonRecherche, boutonRechercheAvancee;
 
public TextBox getRecherchePrincipale() {
return recherchePrincipale;
public HasWidgets getZoneRecherche() {
return zoneRecherche;
}
 
public TextBox getDepartement() {
return departement;
}
 
public TextBox getCommune() {
return commune;
}
 
public TextBox getTaxon() {
return taxon;
}
 
public TextBox getFamille() {
return famille;
}
 
public TextBox getGenre() {
return genre;
}
 
public TextBox getTag() {
return tag;
}
 
public TextBox getMotCle() {
return motCle;
}
 
public TextBox getAuteur() {
return auteur;
}
 
public TextBox getDate() {
return date;
}
 
public Button getBoutonRecherche() {
return boutonRecherche;
}
 
public Button getBoutonRechercheAvancee() {
return boutonRechercheAvancee;
}
 
public Label getLienRechercheAvancee() {
return lienRechercheAvancee;
}
 
public Label getRecherchePrecedente() {
return recherchePrecedente;
}
 
public Panel getRechercheAvancee() {
return rechercheAvancee;
}
 
public Panel getZoneObservations() {
return zoneObservations;
}
 
public Panel getZonePagination() {
return zonePagination;
}
 
@UiField
protected Label lienRechercheAvancee, recherchePrecedente;
 
@UiField
protected Panel rechercheAvancee, zoneObservations, zonePagination;
 
// Constructeur de la vue
public RechercheObservationsVue() {
initWidget(binder.createAndBindUi(this));
rechercheAvancee.setVisible(false);
}
 
@Override
public HasClickHandlers getRecherchePrincipaleHasClickHandler() {
return recherchePrincipale;
public HasWidgets getZoneObservations() {
return zoneObservations;
}
 
@Override
public HasKeyPressHandlers getRecherchePrincipaleHasKeyPressHandlers() {
return recherchePrincipale;
public HasWidgets getZonePagination() {
return zonePagination;
}
 
@Override
public HasText getRecherchePrincipaleHasText() {
return recherchePrincipale;
}
 
@Override
public HasWidgets getRechercheAvanceeHasWidget() {
return rechercheAvancee;
}
 
@Override
public HasVisibility getRechercheAvanceeHasVisibility() {
return rechercheAvancee;
}
 
}
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservations.css
4,4 → 4,4
.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}
.zoneObservation {width:100%;}
.zoneObservation {width:100%; clear:left; margin-top:50px}