/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/DetailImageVue.java |
---|
New file |
0,0 → 1,30 |
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.Composite; |
import com.google.gwt.user.client.ui.Image; |
import com.google.gwt.user.client.ui.Label; |
import com.google.gwt.user.client.ui.Widget; |
public class DetailImageVue extends Composite { |
// Gestion d'UiBinder |
interface Binder extends UiBinder<Widget, DetailImageVue> { |
} |
private static Binder binder = GWT.create(Binder.class); |
@UiField |
protected Image photoPrincipale; |
@UiField |
protected Label texteAlternatif; |
public DetailImageVue(String urlImage, String texteAlternatif) { |
initWidget(binder.createAndBindUi(this)); |
photoPrincipale.setUrl(urlImage); |
this.texteAlternatif.setText(texteAlternatif); |
} |
} |
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/ObservationVue.ui.xml |
---|
New file |
0,0 → 1,27 |
<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="observation.css" /> |
<g:HTMLPanel styleName="{style.ligneObservation}"> |
<g:HTMLPanel styleName="{style.description}"> |
<g:Label ui:field="nomRetenu" styleName="sousTitre"/> |
<g:Label ui:field="famille" /> |
<g:Label ui:field="auteur" /> - <g:Label ui:field="date" /> |
<g:Label ui:field="localite" /> |
<g:Label ui:field="motsClefs" /> |
<g:Label ui:field="numNomenclatural" /> |
</g:HTMLPanel> |
<g:HorizontalPanel styleName="{style.photos}"> |
<g:Image ui:field="photoPrincipale" styleName="{style.photoPrincipale}"/> |
<g:HTMLPanel ui:field="photos"></g:HTMLPanel> |
</g:HorizontalPanel> |
<g:FlexTable styleName="{style.determination}" ui:field="tableauPropositions" /> |
<g:HTMLPanel styleName="nettoyage" /> |
</g:HTMLPanel> |
</ui:UiBinder> |
/trunk/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, zoneObservations, zonePagination; |
// Constructeur de la vue |
public RechercheObservationsVue() { |
initWidget(binder.createAndBindUi(this)); |
rechercheAvancee.setVisible(false); |
} |
} |
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/ObservationPresenteur.java |
---|
New file |
0,0 → 1,112 |
package org.tela_botanica.del.client.vues.rechercheobservations; |
import java.util.Iterator; |
import java.util.List; |
import org.tela_botanica.del.client.composants.presenteur.Presenteur; |
import org.tela_botanica.del.client.modeles.Observation; |
import org.tela_botanica.del.client.modeles.PropositionDetermination; |
import com.google.gwt.event.dom.client.ClickEvent; |
import com.google.gwt.event.dom.client.ClickHandler; |
import com.google.gwt.user.client.ui.HasWidgets; |
import com.google.gwt.user.client.ui.Image; |
public class ObservationPresenteur extends Presenteur { |
private Observation observation; |
public ObservationPresenteur(Observation observation) { |
super(new ObservationVue()); |
this.observation = observation; |
chargerObservation(); |
} |
public void chargerObservation() { |
ObservationVue vue = (ObservationVue) this.getVue(); |
vue.auteur.setText(observation.getAuteur()); |
vue.date.setText(observation.getDate()); |
vue.famille.setText(observation.getFamille()); |
vue.localite.setText(observation.getLocalite()); |
List<String> motsCles = observation.getMotsClefs(); |
Iterator<String> itMotsCles = motsCles.iterator(); |
String motsClesChaine = ""; |
while (itMotsCles.hasNext()) { |
String motCle = itMotsCles.next(); |
motsClesChaine += motCle; |
if (itMotsCles.hasNext()) { |
motsClesChaine += ", "; |
} |
} |
vue.motsClefs.setText(motsClesChaine); |
vue.nomRetenu.setText(observation.getNomRetenu()); |
vue.numNomenclatural.setText(observation.getNumNomenclatural()); |
List<org.tela_botanica.del.client.modeles.Image> images = observation.getImages(); |
org.tela_botanica.del.client.modeles.Image imagePrincipale = images.get(0); |
vue.photoPrincipale.setUrl(imagePrincipale.getUrl()); |
vue.photoPrincipale.setTitle(imagePrincipale.getUrlFormat("L")); |
vue.photoPrincipale.setAltText(observation.getAuteur() + " - " + observation.getNomRetenu()); |
images.remove(0); |
int nbImagesAffichees = 0; |
for (org.tela_botanica.del.client.modeles.Image imageCourante : images) { |
nbImagesAffichees++; |
if (nbImagesAffichees < 5) { |
Image photo = new Image(); |
photo.setUrl(imageCourante.getUrlFormat("CRX2S")); |
photo.setTitle(imageCourante.getUrlFormat("L")); |
photo.setAltText(observation.getAuteur() + " - " + observation.getNomRetenu()); |
photo.addClickHandler(new ClickHandler() { |
public void onClick(ClickEvent event) { |
Image photo = (Image) event.getSource(); |
ouvrirFenetreModale(new DetailImagePresenteur(photo.getTitle(), photo.getAltText())); |
} |
}); |
vue.photos.add(photo); |
} |
} |
List<PropositionDetermination> propositions = observation.getPropositionsDetermination(); |
vue.tableauPropositions.setText(0, 0, "Certitude"); |
vue.tableauPropositions.setText(0, 1, "Commentaires"); |
vue.tableauPropositions.setText(0, 2, "Nom"); |
vue.tableauPropositions.setText(0, 3, "Votez"); |
int i = 0; |
for (PropositionDetermination proposition : propositions) { |
i++; |
vue.tableauPropositions.setText(i, 0, String.valueOf(proposition.getVotesDeterminations().size())); |
/* |
* List<VoteDetermination> votes = |
* proposition.getVotesDeterminations(); for (VoteDetermination vote |
* : votes) { vote.getVote(); } |
*/ |
vue.tableauPropositions.setText(i, 1, String.valueOf(proposition.getCommentaires().size())); |
vue.tableauPropositions.setText(i, 2, proposition.getEspece()); |
} |
handleEvents(); |
// vue.propositions.setText(ch); |
} |
public void go(HasWidgets composite) { |
composite.add(this.getVue()); |
} |
protected void handleEvents() { |
ObservationVue vue = (ObservationVue) this.getVue(); |
vue.photoPrincipale.addClickHandler(new ClickHandler() { |
public void onClick(ClickEvent event) { |
Image photoPrincipale = (Image) event.getSource(); |
ouvrirFenetreModale(new DetailImagePresenteur(photoPrincipale.getTitle(), photoPrincipale.getAltText())); |
} |
}); |
} |
} |
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/ObservationVue.java |
---|
New file |
0,0 → 1,36 |
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.Composite; |
import com.google.gwt.user.client.ui.FlexTable; |
import com.google.gwt.user.client.ui.Image; |
import com.google.gwt.user.client.ui.Label; |
import com.google.gwt.user.client.ui.Panel; |
import com.google.gwt.user.client.ui.Widget; |
public class ObservationVue extends Composite { |
// Gestion d'UiBinder |
interface Binder extends UiBinder<Widget, ObservationVue> { |
} |
private static Binder binder = GWT.create(Binder.class); |
@UiField |
protected Label auteur, date, famille, localite, motsClefs, nomRetenu, numNomenclatural; |
@UiField |
protected FlexTable tableauPropositions; |
@UiField |
protected Image photoPrincipale; |
@UiField |
protected Panel photos; |
public ObservationVue() { |
initWidget(binder.createAndBindUi(this)); |
} |
} |
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/detailImage.css |
---|
New file |
0,0 → 1,0 |
.detailImage {z-index:1500; padding:50px; background:white; width:50%; width:600px; margin:0 auto; margin-top:5%;} |
/trunk/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} |
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/DetailImageVue.ui.xml |
---|
New file |
0,0 → 1,11 |
<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="detailImage.css" /> |
<g:HTMLPanel styleName="{style.detailImage}"> |
<g:Image ui:field="photoPrincipale" /> |
<g:Label ui:field="texteAlternatif"/> |
</g:HTMLPanel> |
</ui:UiBinder> |
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/DetailImagePresenteur.java |
---|
New file |
0,0 → 1,24 |
package org.tela_botanica.del.client.vues.rechercheobservations; |
import org.tela_botanica.del.client.composants.presenteur.Presenteur; |
import com.google.gwt.user.client.ui.HasWidgets; |
public class DetailImagePresenteur extends Presenteur { |
public DetailImagePresenteur(String urlImage, String texteAlternatif) { |
super(new DetailImageVue(urlImage, texteAlternatif)); |
} |
@Override |
public void go(HasWidgets composite) { |
composite.add(this.getVue()); |
} |
@Override |
protected void handleEvents() { |
// TODO Auto-generated method stub |
} |
} |
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservationsVue.ui.xml |
---|
New file |
0,0 → 1,66 |
<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:field="zoneObservations" /> |
<g:HTMLPanel ui:field="zonePagination" /> |
</g:HTMLPanel> |
</ui:UiBinder> |
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/observation.css |
---|
New file |
0,0 → 1,6 |
.ligneObservation {-moz-box-shadow: 5px 0px 5px #DDD; -moz-border-radius:10px; margin-bottom:10px; border:solid 1px #DDD} |
.description {border:solid 1px #EEE; border-width:0 1px 0 0; width:25%; float:left;padding : 10px; margin:0 1px 5px 0; height:150px} |
.photos {border:solid 1px #EEE; border-width:0 1px 0 0; width:33%; float:left; -moz-border-radius: 0px; padding : 10px; margin:0 1px 5px 0; height:170px} |
.determination {width:37%; float:left; padding : 10px; margin:0 1px 5px 0; height:150px} |
.photos img {float:left; padding:2px; -moz-box-shadow:2px 2px 2px #DDD; cursor:pointer} |
.photoPrincipale {height:130px; width:140px; float:left; padding:5px; cursor:pointer} |
/trunk/src/org/tela_botanica/del/client/vues/rechercheobservations/RechercheObservationsPresenteur.java |
---|
New file |
0,0 → 1,164 |
package org.tela_botanica.del.client.vues.rechercheobservations; |
import java.util.HashMap; |
import java.util.Iterator; |
import java.util.List; |
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; |
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 { |
private List<Observation> observations; |
public RechercheObservationsPresenteur() { |
super(new RechercheObservationsVue()); |
} |
public void go(HasWidgets composite) { |
if (composite == null) { |
composite = RootPanel.get(); |
} |
composite.add(this.getVue()); |
handleEvents(); |
// On commence par afficher la totalité des observations |
chercherObservations(null); |
afficherObservations(); |
} |
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) { |
chercherObservations(collecterFormulaire()); |
afficherObservations(); |
} |
}); |
vue.boutonRechercheAvancee.addClickHandler(new ClickHandler() { |
public void onClick(ClickEvent event) { |
chercherObservations(collecterFormulaire()); |
afficherObservations(); |
} |
}); |
vue.recherchePrincipale.addKeyPressHandler(new KeyPressHandler() { |
public void onKeyPress(KeyPressEvent event) { |
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { |
chercherObservations(collecterFormulaire()); |
afficherObservations(); |
} |
} |
}); |
} |
// Gestion de la recherche d'observations : |
public HashMap<String, String> collecterFormulaire() { |
RechercheObservationsVue vue = (RechercheObservationsVue) getVue(); |
HashMap<String, String> champsRecherche = new HashMap<String, String>(); |
if (!vue.recherchePrincipale.getText().equals("")) { |
champsRecherche.put("search", vue.recherchePrincipale.getText()); |
} |
if (!vue.departement.getText().equals("")) { |
champsRecherche.put("dept", vue.departement.getText()); |
} |
if (!vue.commune.getText().equals("")) { |
champsRecherche.put("com", vue.commune.getText()); |
} |
if (!vue.taxon.getText().equals("")) { |
champsRecherche.put("taxon", vue.taxon.getText()); |
} |
if (!vue.famille.getText().equals("")) { |
champsRecherche.put("fam", vue.famille.getText()); |
} |
if (!vue.genre.getText().equals("")) { |
champsRecherche.put("gen", vue.genre.getText()); |
} |
if (!vue.tag.getText().equals("")) { |
champsRecherche.put("tag", vue.tag.getText()); |
} |
if (!vue.motCle.getText().equals("")) { |
champsRecherche.put("motCle", vue.motCle.getText()); |
} |
if (!vue.auteur.getText().equals("")) { |
champsRecherche.put("auteur", vue.auteur.getText()); |
} |
if (!vue.date.getText().equals("")) { |
champsRecherche.put("date", vue.date.getText()); |
} |
return champsRecherche; |
} |
public void chercherObservations(HashMap<String, String> champsRecherche) { |
RechercheObservationsVue vue = (RechercheObservationsVue) getVue(); |
vue.rechercheAvancee.setVisible(false); |
this.observations = MockDatasource.getInstance().getObservations(champsRecherche); |
vue.recherchePrecedente.setText(getChaineRecherche(champsRecherche)); |
} |
public void afficherObservations() { |
RechercheObservationsVue vue = (RechercheObservationsVue) getVue(); |
vue.zoneObservations.clear(); |
for (Observation observation : observations) { |
ObservationPresenteur presenteur = new ObservationPresenteur(observation); |
presenteur.go(vue.zoneObservations); |
} |
} |
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; |
} |
} |