Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 1933 → Rev 1934

/trunk/src/org/tela_botanica/del/client/cache/CacheClient.java
1,444 → 1,446
package org.tela_botanica.del.client.cache;
 
import java.util.Arrays;
import java.util.List;
 
import org.tela_botanica.del.client.config.Config;
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.ModeTri;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.Utilisateur;
import org.tela_botanica.del.client.utils.URLUtils;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.Location;
 
public class CacheClient {
 
private List<Protocole> listeProtocoles;
private Observation observationCourante;
private Image imageCourante;
private String taxonPourRechercheEflore;
private String idProtocoleEnAttente = null;
private Protocole protocoleCourant;
private String referentielCourant;
private int numPageRechercheImage = 0;
private int nbTotalImagesRecherchees = 0;
private boolean referentielNonModifiable = false;
 
private int pasPagination = 12;
private int pageCouranteRechercheImage = 1;
private int pageCouranteRechercheObservations = 1;
private InformationsRecherche informationsRechercheImage;
private InformationsRecherche informationsRechercheObservation;
private Utilisateur utilisateur;
private String pageCourante = "";
private String statut;
private String[] statutsPossibles = {
ConstantesNavigation.PARAM_TYPE_TOUS,
ConstantesNavigation.PARAM_TYPE_A_DETERMINER,
ConstantesNavigation.PARAM_TYPE_EN_DISCUSSION,
ConstantesNavigation.PARAM_TYPE_VALIDEES
};
private ModeTri modeTri = ModeTri.TRI_ASCENDANT;
public void supprimerFiltreStatut() {
this.statut = null;
}
public void setFiltreStatut(String statut) {
this.statut = statut;
}
public String getFiltreStatut() {
return this.statut;
}
public String getPageCourante() {
return pageCourante;
}
 
public void setPageCourante(String pageCourante) {
pageCourante = pageCourante.replaceAll("#", "");
pageCourante = pageCourante.replaceAll("page_validation", ConstantesNavigation.PAGE_DETAIL_OBS);
pageCourante = pageCourante.replaceAll("page_validation_pictoflora", ConstantesNavigation.PAGE_DETAIL_IMG);
this.pageCourante = pageCourante;
}
 
private static CacheClient instance;
 
private CacheClient() {
instance = this;
}
 
public void initialiserAvecParametres() {
String urlCourante = Window.Location.getHref();
Config config = new Config();
String urlAppliImg = config.getUrl("pictoflora");
setPageCourante(Location.getHash());
String rechercheLibre = Location.getParameter("masque");
String famille = Location.getParameter("masque.famille");
String taxon = Location.getParameter("masque.ns");
String genre = Location.getParameter("masque.genre");
String commune = Location.getParameter("masque.commune");
String dept = Location.getParameter("masque.departement");
String auteur = Location.getParameter("masque.auteur");
String date = Location.getParameter("masque.date");
String tag = Location.getParameter("masque.tag");
String tagCel = Location.getParameter("masque.tag_cel");
String tagDel = Location.getParameter("masque.tag_pictoflora");
String referentiel = Location.getParameter("masque.referentiel");
String protocole = Location.getParameter("protocole");
String statutParam = Location.getParameter("masque.type");
String page = Location.getParameter("page");
Integer pageInt = null;
try {
pageInt = Integer.parseInt(page);
} catch (Exception e) {
pageInt = null;
}
String pas = Location.getParameter("pas");
Integer pasInt = null;
if (pas != null) {
try {
pasInt = Integer.parseInt(pas);
} catch (Exception e) {
pasInt = null;
}
}
InformationsRecherche rechercheParArguments = new InformationsRecherche();
rechercheParArguments.setRechercheLibre(rechercheLibre);
rechercheParArguments.setFamille(famille);
rechercheParArguments.setTaxon(taxon);
rechercheParArguments.setGenre(genre);
rechercheParArguments.setCommune(commune);
rechercheParArguments.setDepartement(dept);
rechercheParArguments.setAuteur(auteur);
rechercheParArguments.setDate(date);
rechercheParArguments.setTag(tag);
if (protocole != null && !protocole.equals("")) {
CacheClient.getInstance().setIdProtocoleEnAttente(protocole);
rechercheParArguments.setIdProtocoleSelectionne(protocole);
} else if (URLUtils.getURLSpecialParameterValue() != null) {
CacheClient.getInstance().setIdProtocoleEnAttente(URLUtils.getURLSpecialParameterValue());
rechercheParArguments.setIdProtocoleSelectionne(URLUtils.getURLSpecialParameterValue());
}
if (pasInt != null) {
setPasPagination(pasInt);
}
if (urlCourante.contains(urlAppliImg)) {
rechercheParArguments.setMotClefCel(tagCel);
rechercheParArguments.setMotClefDel(tagDel);
if (pageInt != null) {
setPageCouranteRechercheImages(pageInt);
}
} else {
if (pageInt != null) {
setPageCouranteRechercheObservations(pageInt);
}
}
definirOrdreTriCourantParUrl();
String tri = Location.getParameter("tri");
if (urlCourante.contains(urlAppliImg)) {
if (tri != null) {
// Pour PictoFlora
if (tri.equals("moyenne-arithmetique")) {
rechercheParArguments.setTriParMoyenneArithmetique(modeTri);
} else if (tri.equals("points")) {
rechercheParArguments.setTriParNbPoints(modeTri);
} else if (tri.equals("tags")) {
rechercheParArguments.setTriParNbTags(modeTri);
} else {
rechercheParArguments.setTriParDate(modeTri);
}
} else {
// Tri par défaut pour PictoFlora
rechercheParArguments.setTriParDate(ModeTri.TRI_DESCENDANT);
}
} else {
// Pour IdentiPlante
if (tri != null && tri.equals("date_observation")) {
rechercheParArguments.setTriParDate(modeTri);
} else {
// Tri par défaut pour IdentiPlante
rechercheParArguments.setTriParDate(ModeTri.TRI_DESCENDANT);
}
}
rechercheParArguments.setMotClef(tag);
// si le référentiel est passé dans l'url alors il ne doit pas être modifiable
if (referentiel != null && !referentiel.equals("")) {
setReferentielCourant(referentiel);
rechercheParArguments.setReferentiel(referentiel);
referentielNonModifiable = true;
}
if (Location.getParameterMap().size() == 0) {
// par défaut l'application s'ouvre sur l'onglet à déterminer
statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
} else {
if (Arrays.asList(statutsPossibles).contains(statutParam)) {
statut = statutParam;
} else {
statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
}
}
informationsRechercheImage = rechercheParArguments;
informationsRechercheObservation = rechercheParArguments;
mettreAjourUrlCourante();
}
private void definirOrdreTriCourantParUrl() {
String ordre = Location.getParameter("ordre");
if (ordre != null) {
if (ordre.equals("asc")) {
this.modeTri = ModeTri.TRI_ASCENDANT;
} else if (ordre.equals("desc")) {
this.modeTri = ModeTri.TRI_DESCENDANT;
}
}
}
public void setIdProtocoleEnAttente(String idProtocole) {
idProtocoleEnAttente = idProtocole;
}
public String getIdProtocoleEnAttente() {
return idProtocoleEnAttente;
}
 
public Utilisateur getUtilisateur() {
if (this.utilisateur == null) {
this.utilisateur = new Utilisateur(null, null);
}
return this.utilisateur;
}
public void setUtilisateur(Utilisateur utilisateur) {
this.utilisateur = utilisateur;
}
public void setHome(String home) {
setPageCourante(home);
}
public String getHome() {
return "";
}
public Observation getObservationCourante() {
return observationCourante;
}
 
public void setObservationCourante(Observation observationCourante) {
this.observationCourante = observationCourante;
}
 
public static CacheClient getInstance() {
if (instance == null) {
instance = new CacheClient();
}
return instance;
}
 
public String getTaxonPourRechercheEflore() {
return taxonPourRechercheEflore;
}
 
public void setTaxonPourRechercheEflore(String taxonPourRechercheEflore) {
this.taxonPourRechercheEflore = taxonPourRechercheEflore;
}
 
public int getNumPageRechercheImage() {
return numPageRechercheImage;
}
 
// Pour la recherche :
public int getPasPagination() {
return pasPagination;
}
 
public void setPasPagination(int pasPagination) {
this.pasPagination = pasPagination;
}
 
public void setPageCouranteRechercheImages(int pageCouranteRecherche) {
this.pageCouranteRechercheImage = pageCouranteRecherche;
}
 
public int getPageCouranteRechercheImage() {
return this.pageCouranteRechercheImage;
}
 
public void setNbTotalImagesRecherchees(int nbTotalImagesRecherchees) {
this.nbTotalImagesRecherchees = nbTotalImagesRecherchees;
}
 
public int getNbTotalImagesRecherchees() {
return this.nbTotalImagesRecherchees;
}
 
public Image getImageCourante() {
return imageCourante;
}
 
public void setImageCourante(Image imageCourante) {
this.imageCourante = imageCourante;
}
public void setListeProtocoles(List<Protocole> listeProtocole) {
this.listeProtocoles = listeProtocole;
}
public List<Protocole> getListeProtocoles() {
return this.listeProtocoles;
}
 
public Protocole getProtocoleCourant() {
return protocoleCourant;
}
 
public void setProtocoleCourant(Protocole protocoleCourant) {
this.protocoleCourant = protocoleCourant;
}
 
public InformationsRecherche getInformationsRechercheImage() {
if (informationsRechercheImage == null) {
informationsRechercheImage = new InformationsRecherche();
}
return informationsRechercheImage;
}
 
public InformationsRecherche getInformationsRechercheObservation() {
if (informationsRechercheObservation == null) {
informationsRechercheObservation = new InformationsRecherche();
}
return informationsRechercheObservation;
}
 
public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
this.informationsRechercheImage = informationsRechercheImage;
}
 
public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
this.informationsRechercheObservation = informationsRechercheObservation;
}
 
public int getPageCouranteRechercheObservations() {
return pageCouranteRechercheObservations;
}
 
public void setPageCouranteRechercheObservations(int pageCouranteRechercheObservations) {
this.pageCouranteRechercheObservations = pageCouranteRechercheObservations;
}
public void setReferentielCourant(String referentielCourant) {
this.referentielCourant = referentielCourant;
}
public String getReferentielCourant() {
return referentielCourant;
}
public void setReferentielNonModifiable(boolean referentielNonModifiable) {
this.referentielNonModifiable = referentielNonModifiable;
}
public boolean getReferentielNonModifiable() {
return referentielNonModifiable;
}
public String getUrlPageSignalerMauvaiseId(String id) {
Config config = new Config();
String urlSignalerMauvaiseId = config.getUrl("identiplante");
if (!GWT.isScript()) {
urlSignalerMauvaiseId += "?gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
}
return urlSignalerMauvaiseId+"#"+ConstantesNavigation.PAGE_DETAIL_OBS+"~"+id;
}
public String genererUrlCourante() {
String urlCourante = Window.Location.getHref();
Config config = new Config();
String urlAppliObs = config.getUrl("identiplante");
String urlAppliImg = config.getUrl("pictoflora");
String url = urlCourante;
String arguments = "";
if (urlCourante.contains(urlAppliImg)) {
InformationsRecherche infoRecherche;
infoRecherche = getInformationsRechercheImage();
if (CacheClient.getInstance().getProtocoleCourant() != null) {
infoRecherche.setIdProtocoleSelectionne("" + CacheClient.getInstance().getProtocoleCourant().getId());
}
arguments = infoRecherche.versChaineRequete();
arguments += (arguments.isEmpty()) ? "" : "&";
arguments += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination();
 
url = config.getUrl("pictoflora");
} else if (urlCourante.contains(urlAppliObs)) {
InformationsRecherche infoRecherche;
infoRecherche = getInformationsRechercheObservation();
arguments = "masque.type="+statut;
arguments += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination();
arguments += "&"+infoRecherche.versChaineRequete();
url = config.getUrl("identiplante");
}
if (!GWT.isScript()) {
arguments += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
}
arguments = (arguments.isEmpty()) ? "" : "?" + arguments;
String signet = getPageCourante().equals("") ? "" : "#" + getPageCourante();
url += arguments + signet;
// remplacements batards pour corriger l'url
// TODO: factoriser toute la fonction
url = url.replaceAll("&#", "#");
url = url.replaceAll("&&", "&");
url = url.replaceAll("\\?&", "?");
if (url.endsWith("&")) {
url = url.substring(0, url.length()-1);
}
return url;
}
public void mettreAjourUrlCourante() {
mettreAJourUrlCouranteSansRecharger(genererUrlCourante());
}
private static native void mettreAJourUrlCouranteSansRecharger(String nouvelleUrl) /*-{
// javascript double negative trick
// pour plus d'info http://stackoverflow.com/questions/4686583/can-someone-explain-this-double-negative-trick
if (!!($wnd.history && $wnd.history.pushState)) {
var currentState = $wnd.history.state;
if (currentState != nouvelleUrl) {
$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl);
}
}
}-*/;
}
package org.tela_botanica.del.client.cache;
 
import java.util.Arrays;
import java.util.List;
 
import org.tela_botanica.del.client.config.Config;
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.ModeTri;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.Utilisateur;
import org.tela_botanica.del.client.utils.URLUtils;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.Location;
 
public class CacheClient {
 
private List<Protocole> listeProtocoles;
private Observation observationCourante;
private Image imageCourante;
private String taxonPourRechercheEflore;
private String idProtocoleEnAttente = null;
private Protocole protocoleCourant;
private String referentielCourant;
private int numPageRechercheImage = 0;
private int nbTotalImagesRecherchees = 0;
private boolean referentielNonModifiable = false;
 
private int pasPagination = 12;
private int pageCouranteRechercheImage = 1;
private int pageCouranteRechercheObservations = 1;
private InformationsRecherche informationsRechercheImage;
private InformationsRecherche informationsRechercheObservation;
private Utilisateur utilisateur;
private String pageCourante = "";
private String statut;
private String[] statutsPossibles = {
ConstantesNavigation.PARAM_TYPE_TOUS,
ConstantesNavigation.PARAM_TYPE_A_DETERMINER,
ConstantesNavigation.PARAM_TYPE_EN_DISCUSSION,
ConstantesNavigation.PARAM_TYPE_VALIDEES
};
private ModeTri modeTri = ModeTri.TRI_ASCENDANT;
public void supprimerFiltreStatut() {
this.statut = null;
}
public void setFiltreStatut(String statut) {
this.statut = statut;
}
public String getFiltreStatut() {
return this.statut;
}
public String getPageCourante() {
return pageCourante;
}
 
public void setPageCourante(String pageCourante) {
pageCourante = pageCourante.replaceAll("#", "");
pageCourante = pageCourante.replaceAll("page_validation", ConstantesNavigation.PAGE_DETAIL_OBS);
pageCourante = pageCourante.replaceAll("page_validation_pictoflora", ConstantesNavigation.PAGE_DETAIL_IMG);
this.pageCourante = pageCourante;
}
 
private static CacheClient instance;
 
private CacheClient() {
instance = this;
}
 
public void initialiserAvecParametres() {
String urlCourante = Window.Location.getHref();
Config config = new Config();
String urlAppliImg = config.getUrl("pictoflora");
setPageCourante(Location.getHash());
String rechercheLibre = Location.getParameter("masque");
String famille = Location.getParameter("masque.famille");
String taxon = Location.getParameter("masque.ns");
String genre = Location.getParameter("masque.genre");
String commune = Location.getParameter("masque.commune");
String dept = Location.getParameter("masque.departement");
String auteur = Location.getParameter("masque.auteur");
String date = Location.getParameter("masque.date");
String tag = Location.getParameter("masque.tag");
String tagCel = Location.getParameter("masque.tag_cel");
String tagDel = Location.getParameter("masque.tag_pictoflora");
String referentiel = Location.getParameter("masque.referentiel");
String protocole = Location.getParameter("protocole");
String statutParam = Location.getParameter("masque.type");
String page = Location.getParameter("page");
Integer pageInt = null;
try {
pageInt = Integer.parseInt(page);
} catch (Exception e) {
pageInt = null;
}
String pas = Location.getParameter("pas");
Integer pasInt = null;
if (pas != null) {
try {
pasInt = Integer.parseInt(pas);
} catch (Exception e) {
pasInt = null;
}
}
InformationsRecherche rechercheParArguments = new InformationsRecherche();
rechercheParArguments.setRechercheLibre(rechercheLibre);
rechercheParArguments.setFamille(famille);
rechercheParArguments.setTaxon(taxon);
rechercheParArguments.setGenre(genre);
rechercheParArguments.setCommune(commune);
rechercheParArguments.setDepartement(dept);
rechercheParArguments.setAuteur(auteur);
rechercheParArguments.setDate(date);
rechercheParArguments.setTag(tag);
if (protocole != null && !protocole.equals("")) {
CacheClient.getInstance().setIdProtocoleEnAttente(protocole);
rechercheParArguments.setIdProtocoleSelectionne(protocole);
} else if (URLUtils.getURLSpecialParameterValue() != null) {
CacheClient.getInstance().setIdProtocoleEnAttente(URLUtils.getURLSpecialParameterValue());
rechercheParArguments.setIdProtocoleSelectionne(URLUtils.getURLSpecialParameterValue());
}
if (pasInt != null) {
setPasPagination(pasInt);
}
if (urlCourante.contains(urlAppliImg)) {
rechercheParArguments.setMotClefCel(tagCel);
rechercheParArguments.setMotClefDel(tagDel);
if (pageInt != null) {
setPageCouranteRechercheImages(pageInt);
}
} else {
if (pageInt != null) {
setPageCouranteRechercheObservations(pageInt);
}
}
definirOrdreTriCourantParUrl();
String tri = Location.getParameter("tri");
if (urlCourante.contains(urlAppliImg)) {
if (tri != null) {
// Pour PictoFlora
if (tri.equals("moyenne-arithmetique")) {
rechercheParArguments.setTriParMoyenneArithmetique(modeTri);
} else if (tri.equals("points")) {
rechercheParArguments.setTriParNbPoints(modeTri);
} else if (tri.equals("tags")) {
rechercheParArguments.setTriParNbTags(modeTri);
} else {
rechercheParArguments.setTriParDatePublication(modeTri);
}
} else {
// Tri par défaut pour PictoFlora
rechercheParArguments.setTriParDatePublication(ModeTri.TRI_DESCENDANT);
}
} else {
// Pour IdentiPlante
if (tri != null && tri.equals("date_observation")) {
rechercheParArguments.setTriParDateObservation(modeTri);
} else if(tri != null && tri.equals("nb_commentaires")) {
rechercheParArguments.setTriParNbCommentaires(modeTri);
} else {
// Tri par défaut pour IdentiPlante
rechercheParArguments.setTriParDatePublication(ModeTri.TRI_DESCENDANT);
}
}
rechercheParArguments.setMotClef(tag);
// si le référentiel est passé dans l'url alors il ne doit pas être modifiable
if (referentiel != null && !referentiel.equals("")) {
setReferentielCourant(referentiel);
rechercheParArguments.setReferentiel(referentiel);
referentielNonModifiable = true;
}
if (Location.getParameterMap().size() == 0) {
// par défaut l'application s'ouvre sur l'onglet à déterminer
statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
} else {
if (Arrays.asList(statutsPossibles).contains(statutParam)) {
statut = statutParam;
} else {
statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
}
}
informationsRechercheImage = rechercheParArguments;
informationsRechercheObservation = rechercheParArguments;
mettreAjourUrlCourante();
}
private void definirOrdreTriCourantParUrl() {
String ordre = Location.getParameter("ordre");
if (ordre != null) {
if (ordre.equals("asc")) {
this.modeTri = ModeTri.TRI_ASCENDANT;
} else if (ordre.equals("desc")) {
this.modeTri = ModeTri.TRI_DESCENDANT;
}
}
}
public void setIdProtocoleEnAttente(String idProtocole) {
idProtocoleEnAttente = idProtocole;
}
public String getIdProtocoleEnAttente() {
return idProtocoleEnAttente;
}
 
public Utilisateur getUtilisateur() {
if (this.utilisateur == null) {
this.utilisateur = new Utilisateur(null, null);
}
return this.utilisateur;
}
public void setUtilisateur(Utilisateur utilisateur) {
this.utilisateur = utilisateur;
}
public void setHome(String home) {
setPageCourante(home);
}
public String getHome() {
return "";
}
public Observation getObservationCourante() {
return observationCourante;
}
 
public void setObservationCourante(Observation observationCourante) {
this.observationCourante = observationCourante;
}
 
public static CacheClient getInstance() {
if (instance == null) {
instance = new CacheClient();
}
return instance;
}
 
public String getTaxonPourRechercheEflore() {
return taxonPourRechercheEflore;
}
 
public void setTaxonPourRechercheEflore(String taxonPourRechercheEflore) {
this.taxonPourRechercheEflore = taxonPourRechercheEflore;
}
 
public int getNumPageRechercheImage() {
return numPageRechercheImage;
}
 
// Pour la recherche :
public int getPasPagination() {
return pasPagination;
}
 
public void setPasPagination(int pasPagination) {
this.pasPagination = pasPagination;
}
 
public void setPageCouranteRechercheImages(int pageCouranteRecherche) {
this.pageCouranteRechercheImage = pageCouranteRecherche;
}
 
public int getPageCouranteRechercheImage() {
return this.pageCouranteRechercheImage;
}
 
public void setNbTotalImagesRecherchees(int nbTotalImagesRecherchees) {
this.nbTotalImagesRecherchees = nbTotalImagesRecherchees;
}
 
public int getNbTotalImagesRecherchees() {
return this.nbTotalImagesRecherchees;
}
 
public Image getImageCourante() {
return imageCourante;
}
 
public void setImageCourante(Image imageCourante) {
this.imageCourante = imageCourante;
}
public void setListeProtocoles(List<Protocole> listeProtocole) {
this.listeProtocoles = listeProtocole;
}
public List<Protocole> getListeProtocoles() {
return this.listeProtocoles;
}
 
public Protocole getProtocoleCourant() {
return protocoleCourant;
}
 
public void setProtocoleCourant(Protocole protocoleCourant) {
this.protocoleCourant = protocoleCourant;
}
 
public InformationsRecherche getInformationsRechercheImage() {
if (informationsRechercheImage == null) {
informationsRechercheImage = new InformationsRecherche();
}
return informationsRechercheImage;
}
 
public InformationsRecherche getInformationsRechercheObservation() {
if (informationsRechercheObservation == null) {
informationsRechercheObservation = new InformationsRecherche();
}
return informationsRechercheObservation;
}
 
public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
this.informationsRechercheImage = informationsRechercheImage;
}
 
public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
this.informationsRechercheObservation = informationsRechercheObservation;
}
 
public int getPageCouranteRechercheObservations() {
return pageCouranteRechercheObservations;
}
 
public void setPageCouranteRechercheObservations(int pageCouranteRechercheObservations) {
this.pageCouranteRechercheObservations = pageCouranteRechercheObservations;
}
public void setReferentielCourant(String referentielCourant) {
this.referentielCourant = referentielCourant;
}
public String getReferentielCourant() {
return referentielCourant;
}
public void setReferentielNonModifiable(boolean referentielNonModifiable) {
this.referentielNonModifiable = referentielNonModifiable;
}
public boolean getReferentielNonModifiable() {
return referentielNonModifiable;
}
public String getUrlPageSignalerMauvaiseId(String id) {
Config config = new Config();
String urlSignalerMauvaiseId = config.getUrl("identiplante");
if (!GWT.isScript()) {
urlSignalerMauvaiseId += "?gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
}
return urlSignalerMauvaiseId+"#"+ConstantesNavigation.PAGE_DETAIL_OBS+"~"+id;
}
public String genererUrlCourante() {
String urlCourante = Window.Location.getHref();
Config config = new Config();
String urlAppliObs = config.getUrl("identiplante");
String urlAppliImg = config.getUrl("pictoflora");
String url = urlCourante;
String arguments = "";
if (urlCourante.contains(urlAppliImg)) {
InformationsRecherche infoRecherche;
infoRecherche = getInformationsRechercheImage();
if (CacheClient.getInstance().getProtocoleCourant() != null) {
infoRecherche.setIdProtocoleSelectionne("" + CacheClient.getInstance().getProtocoleCourant().getId());
}
arguments = infoRecherche.versChaineRequete();
arguments += (arguments.isEmpty()) ? "" : "&";
arguments += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination();
 
url = config.getUrl("pictoflora");
} else if (urlCourante.contains(urlAppliObs)) {
InformationsRecherche infoRecherche;
infoRecherche = getInformationsRechercheObservation();
arguments = "masque.type="+statut;
arguments += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination();
arguments += "&"+infoRecherche.versChaineRequete();
url = config.getUrl("identiplante");
}
if (!GWT.isScript()) {
arguments += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
}
arguments = (arguments.isEmpty()) ? "" : "?" + arguments;
String signet = getPageCourante().equals("") ? "" : "#" + getPageCourante();
url += arguments + signet;
// remplacements batards pour corriger l'url
// TODO: factoriser toute la fonction
url = url.replaceAll("&#", "#");
url = url.replaceAll("&&", "&");
url = url.replaceAll("\\?&", "?");
if (url.endsWith("&")) {
url = url.substring(0, url.length()-1);
}
return url;
}
public void mettreAjourUrlCourante() {
mettreAJourUrlCouranteSansRecharger(genererUrlCourante());
}
private static native void mettreAJourUrlCouranteSansRecharger(String nouvelleUrl) /*-{
// javascript double negative trick
// pour plus d'info http://stackoverflow.com/questions/4686583/can-someone-explain-this-double-negative-trick
if (!!($wnd.history && $wnd.history.pushState)) {
var currentState = $wnd.history.state;
if (currentState != nouvelleUrl) {
$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl);
}
}
}-*/;
}
/trunk/src/org/tela_botanica/del/client/composants/metadonnees/metadonnees.css
73,5 → 73,5
display: inline
}
.zoneDate {
display: none
display: inline;
}
/trunk/src/org/tela_botanica/del/client/composants/metadonnees/MetadonneesVue.ui.xml
76,7 → 76,7
 
<!-- Date de transmission -->
<g:HTMLPanel ui:field="zoneDate" styleName="{style.zoneDate}">
<g:InlineLabel styleName="petit gris" text="{constants.dateTransmission}" />
<g:InlineLabel styleName="petit gris" text="{constants.publiee}" />
<g:InlineLabel ui:field="dateTransmission" styleName="{style.donnee}"/>
</g:HTMLPanel>
 
/trunk/src/org/tela_botanica/del/client/composants/metadonnees/MetadonneesVue.java
46,7 → 46,6
public MetadonneesVue() {
initWidget(binder.createAndBindUi(this));
 
// Le lien ne doit être affiché que sur pictoflora
String urlCourante = Window.Location.getHref();
Config config = new Config();
166,7 → 165,7
HasText[] champs = {nomRetenu, nomCommun, famille, localite, auteur, motsClefs, commentaire, milieu, lieuDit, dateReleve, dateTransmission};
for (int i = 0; i < champs.length; i ++) {
HasText champ = champs[i];
if ("".equals(champ.getText())) {
if (champ.getText() == null || champ.getText().isEmpty()) {
Widget widget = (Widget) champ;
widget.getParent().setVisible(false);
}
/trunk/src/org/tela_botanica/del/client/modeles/Observation.java
18,6 → 18,7
// proposition de determinations, soit des commentaires
private List<InterventionForum> propositions = new ArrayList<InterventionForum>();
private List<Image> images = new ArrayList<Image>();
private String nbCommentaires;
 
public String getAuteur() {
return auteur;
290,5 → 291,12
}
return nomRetenuFmt;
}
public String getNbCommentaires() {
return nbCommentaires;
}
 
public void setNbCommentaires(String nbCommentaires) {
this.nbCommentaires = nbCommentaires;
}
}
/trunk/src/org/tela_botanica/del/client/modeles/InformationsRecherche.java
1,258 → 1,282
package org.tela_botanica.del.client.modeles;
 
import org.tela_botanica.del.client.config.Config;
 
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.Window;
 
public class InformationsRecherche {
 
private String rechercheLibre;
 
private String departement;
private String referentiel;
 
private String taxon;
 
private String genre;
 
// gardé pour ancienne comptabilité
private String motClef;
// mots clés publics de del
private String motClefDel;
// mots clés privés du cel
private String motClefCel;
 
private String date;
 
private String commune;
 
private String famille;
 
private String tag;
 
private String auteur;
 
private String idProtocoleSelectionne = null;
 
private ModeTri triParMoyenneArithmetique = ModeTri.PAS_DE_TRI;
 
private ModeTri triParDate = ModeTri.PAS_DE_TRI;
private ModeTri triParNbTag = ModeTri.PAS_DE_TRI;
private ModeTri triParNbPoints = ModeTri.PAS_DE_TRI;
 
public String getRechercheLibre() {
return rechercheLibre;
}
 
public void setRechercheLibre(String rechercheLibre) {
if (rechercheLibre != null) {
this.rechercheLibre = rechercheLibre;
}
}
 
public String getDepartement() {
return departement;
}
 
public void setDepartement(String departement) {
if (departement != null) {
this.departement = departement;
}
}
public String getReferentiel() {
return referentiel;
}
 
public void setReferentiel(String referentiel) {
this.referentiel = referentiel;
}
 
public String getTaxon() {
return taxon;
}
 
public void setTaxon(String taxon) {
if (taxon != null) {
this.taxon = taxon;
}
}
 
public String getGenre() {
return genre;
}
 
public void setGenre(String genre) {
if (genre != null) {
this.genre = genre;
}
}
 
public String getMotClef() {
return motClef;
}
 
public void setMotClef(String motClef) {
if (motClef != null) {
this.motClef = motClef;
}
}
 
public String getDate() {
return date;
}
 
public void setDate(String date) {
if (date != null) {
this.date = date;
}
}
 
public String getCommune() {
return commune;
}
 
public void setCommune(String commune) {
if (commune != null) {
String[] tableauCommuneDpt = commune.split(" ");
if (tableauCommuneDpt.length == 2) {
String dpt = tableauCommuneDpt[1].replaceAll("\\(", "").replaceAll("\\)", "");
setDepartement(dpt);
this.commune = tableauCommuneDpt[0];
} else {
this.commune = commune;
}
}
}
 
public String getFamille() {
return famille;
}
 
public void setFamille(String famille) {
if (famille != null) {
this.famille = famille;
}
}
 
public String getTag() {
return tag;
}
 
public void setTag(String tag) {
if (tag != null) {
this.tag = tag;
}
}
 
public String getAuteur() {
return auteur;
}
 
public void setAuteur(String auteur) {
if (auteur != null) {
this.auteur = auteur;
}
}
 
public ModeTri getTriParMoyenneArithmetique() {
return triParMoyenneArithmetique;
}
 
public void setTriParMoyenneArithmetique(ModeTri triParMoyenneArithmetique) {
this.triParMoyenneArithmetique = triParMoyenneArithmetique;
}
 
public void setIdProtocoleSelectionne(String idProtocoleSelectionne) {
this.idProtocoleSelectionne = idProtocoleSelectionne;
}
 
public String getIdProtocoleSelectionne() {
return idProtocoleSelectionne;
}
 
public ModeTri getTriParDate() {
return triParDate;
}
 
public void setTriParDate(ModeTri triParDate) {
this.triParDate = triParDate;
}
 
public void setTriParNbTags(ModeTri triParTag) {
this.triParNbTag = triParTag;
}
public ModeTri getTriParNbPoints() {
return this.triParNbPoints;
}
 
public void setTriParNbPoints(ModeTri triParPoints) {
this.triParNbPoints = triParPoints;
}
public ModeTri getTriParNbTags() {
return this.triParNbTag;
}
 
public String versChaineRequete() {
String chaine = "";
chaine += estNonNull(rechercheLibre) ? "&masque=" + URL.encodeQueryString(rechercheLibre) : "";
chaine += estNonNull(departement) ? "&masque.departement=" + URL.encodeQueryString(departement) : "";
chaine += estNonNull(referentiel) && !referentiel.equals("tous") ? "&masque.referentiel=" + URL.encodeQueryString(referentiel) : "";
chaine += estNonNull(taxon) ? "&masque.ns=" + URL.encodeQueryString(taxon) : "";
chaine += estNonNull(genre) ? "&masque.genre=" + URL.encodeQueryString(genre) : "";
chaine += estNonNull(motClef) ? "&masque.tag=" + URL.encodeQueryString(motClef) : "";
chaine += estNonNull(motClefCel) ? "&masque.tag_cel=" + URL.encodeQueryString(motClefCel) : "";
chaine += estNonNull(motClefDel) ? "&masque.tag_pictoflora=" + URL.encodeQueryString(motClefDel) : "";
chaine += estNonNull(date) ? "&masque.date=" + URL.encodeQueryString(date) : "";
chaine += estNonNull(commune) ? "&masque.commune=" + URL.encodeQueryString(commune) : "";
chaine += estNonNull(famille) ? "&masque.famille=" + URL.encodeQueryString(famille) : "";
chaine += estNonNull(auteur) ? "&masque.auteur=" + URL.encodeQueryString(auteur) : "";
String urlCourante = Window.Location.getHref();
Config config = new Config();
String urlAppliImg = config.getUrl("pictoflora");
if (urlCourante.contains(urlAppliImg)) {
chaine += triParDate != ModeTri.PAS_DE_TRI ? "&tri=date_transmission" : "";
chaine += triParDate != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDate : "";
chaine += triParMoyenneArithmetique != ModeTri.PAS_DE_TRI ? "&tri=moyenne-arithmetique" : "";
chaine += triParMoyenneArithmetique != ModeTri.PAS_DE_TRI ? "&ordre=" + triParMoyenneArithmetique : "";
chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&tri=tags" : "";
chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbTag : "";
chaine += triParNbPoints != ModeTri.PAS_DE_TRI ? "&tri=points" : "";
chaine += triParNbPoints != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbPoints : "";
chaine += estNonNull(idProtocoleSelectionne) ? "&protocole=" + idProtocoleSelectionne : "";
} else {
chaine += triParDate != ModeTri.PAS_DE_TRI ? "&tri=date_observation" : "";
chaine += triParDate != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDate : "";
}
return chaine;
}
 
private boolean estNonNull(String critere) {
return critere != null && !critere.trim().isEmpty();
}
 
public String getMotClefDel() {
return motClefDel;
}
 
public void setMotClefDel(String motClefDel) {
this.motClefDel = motClefDel;
}
 
public String getMotClefCel() {
return motClefCel;
}
 
public void setMotClefCel(String motClefCel) {
this.motClefCel = motClefCel;
}
}
package org.tela_botanica.del.client.modeles;
 
import org.tela_botanica.del.client.config.Config;
 
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.Window;
 
public class InformationsRecherche {
 
private String rechercheLibre;
 
private String departement;
private String referentiel;
 
private String taxon;
 
private String genre;
 
// gardé pour ancienne comptabilité
private String motClef;
// mots clés publics de del
private String motClefDel;
// mots clés privés du cel
private String motClefCel;
 
private String date;
 
private String commune;
 
private String famille;
 
private String tag;
 
private String auteur;
 
private String idProtocoleSelectionne = null;
 
private ModeTri triParMoyenneArithmetique = ModeTri.PAS_DE_TRI;
 
private ModeTri triParDatePublication = ModeTri.PAS_DE_TRI;
private ModeTri triParDateObservation = ModeTri.PAS_DE_TRI;
private ModeTri triParNbCommentaires = ModeTri.PAS_DE_TRI;
private ModeTri triParNbTag = ModeTri.PAS_DE_TRI;
private ModeTri triParNbPoints = ModeTri.PAS_DE_TRI;
 
public String getRechercheLibre() {
return rechercheLibre;
}
 
public void setRechercheLibre(String rechercheLibre) {
if (rechercheLibre != null) {
this.rechercheLibre = rechercheLibre;
}
}
 
public String getDepartement() {
return departement;
}
 
public void setDepartement(String departement) {
if (departement != null) {
this.departement = departement;
}
}
public String getReferentiel() {
return referentiel;
}
 
public void setReferentiel(String referentiel) {
this.referentiel = referentiel;
}
 
public String getTaxon() {
return taxon;
}
 
public void setTaxon(String taxon) {
if (taxon != null) {
this.taxon = taxon;
}
}
 
public String getGenre() {
return genre;
}
 
public void setGenre(String genre) {
if (genre != null) {
this.genre = genre;
}
}
 
public String getMotClef() {
return motClef;
}
 
public void setMotClef(String motClef) {
if (motClef != null) {
this.motClef = motClef;
}
}
 
public String getDate() {
return date;
}
 
public void setDate(String date) {
if (date != null) {
this.date = date;
}
}
 
public String getCommune() {
return commune;
}
 
public void setCommune(String commune) {
if (commune != null) {
String[] tableauCommuneDpt = commune.split(" ");
if (tableauCommuneDpt.length == 2) {
String dpt = tableauCommuneDpt[1].replaceAll("\\(", "").replaceAll("\\)", "");
setDepartement(dpt);
this.commune = tableauCommuneDpt[0];
} else {
this.commune = commune;
}
}
}
 
public String getFamille() {
return famille;
}
 
public void setFamille(String famille) {
if (famille != null) {
this.famille = famille;
}
}
 
public String getTag() {
return tag;
}
 
public void setTag(String tag) {
if (tag != null) {
this.tag = tag;
}
}
 
public String getAuteur() {
return auteur;
}
 
public void setAuteur(String auteur) {
if (auteur != null) {
this.auteur = auteur;
}
}
 
public ModeTri getTriParMoyenneArithmetique() {
return triParMoyenneArithmetique;
}
 
public void setTriParMoyenneArithmetique(ModeTri triParMoyenneArithmetique) {
this.triParMoyenneArithmetique = triParMoyenneArithmetique;
}
 
public void setIdProtocoleSelectionne(String idProtocoleSelectionne) {
this.idProtocoleSelectionne = idProtocoleSelectionne;
}
 
public String getIdProtocoleSelectionne() {
return idProtocoleSelectionne;
}
 
public ModeTri getTriParDatePublication() {
return triParDatePublication;
}
 
public void setTriParDatePublication(ModeTri triParDatePublication) {
this.triParDatePublication = triParDatePublication;
}
public ModeTri getTriParDateObservation() {
return triParDateObservation;
}
 
public void setTriParDateObservation(ModeTri triParDateObservation) {
this.triParDateObservation = triParDateObservation;
}
 
public void setTriParNbTags(ModeTri triParTag) {
this.triParNbTag = triParTag;
}
public ModeTri getTriParNbPoints() {
return this.triParNbPoints;
}
 
public void setTriParNbPoints(ModeTri triParPoints) {
this.triParNbPoints = triParPoints;
}
public ModeTri getTriParNbTags() {
return this.triParNbTag;
}
public void setTriParNbCommentaires(ModeTri triParNbCommentaires) {
this.triParNbCommentaires = triParNbCommentaires;
}
public ModeTri getTriParNbCommentaires() {
return triParNbCommentaires;
}
 
public String versChaineRequete() {
String chaine = "";
chaine += estNonNull(rechercheLibre) ? "&masque=" + URL.encodeQueryString(rechercheLibre) : "";
chaine += estNonNull(departement) ? "&masque.departement=" + URL.encodeQueryString(departement) : "";
chaine += estNonNull(referentiel) && !referentiel.equals("tous") ? "&masque.referentiel=" + URL.encodeQueryString(referentiel) : "";
chaine += estNonNull(taxon) ? "&masque.ns=" + URL.encodeQueryString(taxon) : "";
chaine += estNonNull(genre) ? "&masque.genre=" + URL.encodeQueryString(genre) : "";
chaine += estNonNull(motClef) ? "&masque.tag=" + URL.encodeQueryString(motClef) : "";
chaine += estNonNull(motClefCel) ? "&masque.tag_cel=" + URL.encodeQueryString(motClefCel) : "";
chaine += estNonNull(motClefDel) ? "&masque.tag_pictoflora=" + URL.encodeQueryString(motClefDel) : "";
chaine += estNonNull(date) ? "&masque.date=" + URL.encodeQueryString(date) : "";
chaine += estNonNull(commune) ? "&masque.commune=" + URL.encodeQueryString(commune) : "";
chaine += estNonNull(famille) ? "&masque.famille=" + URL.encodeQueryString(famille) : "";
chaine += estNonNull(auteur) ? "&masque.auteur=" + URL.encodeQueryString(auteur) : "";
String urlCourante = Window.Location.getHref();
Config config = new Config();
String urlAppliImg = config.getUrl("pictoflora");
if (urlCourante.contains(urlAppliImg)) {
chaine += triParMoyenneArithmetique != ModeTri.PAS_DE_TRI ? "&tri=moyenne-arithmetique" : "";
chaine += triParMoyenneArithmetique != ModeTri.PAS_DE_TRI ? "&ordre=" + triParMoyenneArithmetique : "";
chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&tri=tags" : "";
chaine += triParNbTag != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbTag : "";
chaine += triParNbPoints != ModeTri.PAS_DE_TRI ? "&tri=points" : "";
chaine += triParNbPoints != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbPoints : "";
chaine += estNonNull(idProtocoleSelectionne) ? "&protocole=" + idProtocoleSelectionne : "";
} else {
chaine += triParNbCommentaires != ModeTri.PAS_DE_TRI ? "&tri=nb_commentaires" : "";
chaine += triParNbCommentaires != ModeTri.PAS_DE_TRI ? "&ordre=" + triParNbCommentaires : "";
}
chaine += triParDateObservation != ModeTri.PAS_DE_TRI ? "&tri=date_observation" : "";
chaine += triParDateObservation != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDateObservation : "";
chaine += triParDatePublication != ModeTri.PAS_DE_TRI ? "&tri=date_transmission" : "";
chaine += triParDatePublication != ModeTri.PAS_DE_TRI ? "&ordre=" + triParDatePublication : "";
return chaine;
}
 
private boolean estNonNull(String critere) {
return critere != null && !critere.trim().isEmpty();
}
 
public String getMotClefDel() {
return motClefDel;
}
 
public void setMotClefDel(String motClefDel) {
this.motClefDel = motClefDel;
}
 
public String getMotClefCel() {
return motClefCel;
}
 
public void setMotClefCel(String motClefCel) {
this.motClefCel = motClefCel;
}
}
/trunk/src/org/tela_botanica/del/client/i18n/Vocabulary.properties
71,11 → 71,12
 
# Trie
tri = Tri :
triParDate = Date
triParDateTooltip = Trier par date de publication
triParDateAscendant = Tri actuel par date de publication de la plus ancienne à la plus récente
triParDateDescendant = Tri actuel par date de publication de la plus récente à la plus ancienne
triParDatePubli = Date de publication
triParDatePubliTooltip = Trier par date de publication
triParDatePubliAscendant = Tri actuel par date de publication de la plus ancienne à la plus récente
triParDatePubliDescendant = Tri actuel par date de publication de la plus récente à la plus ancienne
 
triParDateObs = Date d'observation
triParDateObsTooltip = Trier par date d'observation
triParDateObsAscendant = Tri actuel par date d'observation de la plus ancienne à la plus récente
triParDateObsDescendant = Tri actuel par date d'observation de la plus récente à la plus ancienne
95,6 → 96,11
triParNbTagsAscendant = Tri actuel par nombre de tags croissant
triParNbTagsDescendant = Tri actuel par nombre de tags décroissant
 
triParNbCommentaires = Nombre de commentaires
triParNbCommentairesTooltip = Trier par nombre de commentaires
triParNbCommentairesAscendant = Tri actuel par nombre de commentaires croissant
triParNbCommentairesDescendant = Tri actuel par nombre de commentaires décroissant
 
# Vue résultat images
introRechercheImages = Cette galerie vous permet de rechercher les illustrations des membres du réseau issues du Carnet en ligne... et de voter pour la qualité des images selon un protocole défini.
indicationActionClicImage = Cliquez sur l'image pour l'agrandir ou sur le bandeau contenant le nom pour accéder à la fiche de l'observation
118,6 → 124,11
voirDetailVotes = Voir le détail des utilisateurs qui ont voté
voirDetailCommentaires = Voir les commentaires liés à cette proposition
 
ongletTous = Tout
ongletADeterminer = A déterminer
ongletAConfirmer = A confirmer
ongletVerifiees = Vérifiées
 
# Vue determination
proposerSaDetermination = Proposer une détermination
infoProposerDetermination = Pour proposer une détermination, remplissez les champs ci-dessous et cliquez sur le bouton Proposer !
164,7 → 175,7
motsClefs = Mots-clés
validePar = Validé par
dateValidation = Date de dernière validation
transmisLe = Transmis le
publieLe = Publié le
 
# Vue votes protocoles
votes = Moyenne des votes
/trunk/src/org/tela_botanica/del/client/i18n/Vocabulary.java
1276,13 → 1276,13
String titreSeConnecter();
 
/**
* Translated "Transmis le".
* Translated "Publié le".
*
* @return translated "Transmis le"
* @return translated "Publié le"
*/
@DefaultStringValue("Transmis le")
@Key("transmisLe")
String transmisLe();
@DefaultStringValue("Publié le")
@Key("publieLe")
String publieLe();
 
/**
* Translated "Tri : ".
1294,13 → 1294,22
String tri();
 
/**
* Translated "Date de publication".
*
* @return translated "Date de publication"
*/
@DefaultStringValue("Date de publication")
@Key("triParDatePubli")
String triParDatePubli();
/**
* Translated "Date".
*
* @return translated "Date"
*/
@DefaultStringValue("Date")
@Key("triParDate")
String triParDate();
@DefaultStringValue("Date d'observation")
@Key("triParDateObs")
String triParDateObs();
/**
* Translated "Trier par date de publication".
1308,8 → 1317,8
* @return translated "Trier par date de publication"
*/
@DefaultStringValue("Trier par date de publication")
@Key("triParDateTooltip")
String triParDateTooltip();
@Key("triParDatePubliTooltip")
String triParDatePubliTooltip();
 
/**
* Translated "Tri actuel par date de publication de la plus ancienne à la plus récente".
1317,8 → 1326,8
* @return translated "Tri actuel par date de publication de la plus ancienne à la plus récente"
*/
@DefaultStringValue("Tri actuel par date de publication de la plus ancienne à la plus récente")
@Key("triParDateAscendant")
String triParDateAscendant();
@Key("triParDatePubliAscendant")
String triParDatePubliAscendant();
 
/**
* Translated "Tri actuel par date de publication de la plus récente à la plus ancienne".
1326,8 → 1335,8
* @return translated "Tri actuel par date de publication de la plus récente à la plus ancienne"
*/
@DefaultStringValue("Tri actuel par date de publication de la plus récente à la plus ancienne")
@Key("triParDateDescendant")
String triParDateDescendant();
@Key("triParDatePubliDescendant")
String triParDatePubliDescendant();
/**
* Translated "Trier par date d'observation".
1463,8 → 1472,45
@DefaultStringValue("Tri actuel par nombre de points décroissant")
@Key("triParNbPointsDescendant")
String triParNbPointsDescendant();
/**
* Translated "Nombre de commentaires".
*
* @return translated "Nombre de commentaires"
*/
@DefaultStringValue("Nombre de commentaires")
@Key("triParNbCommentaires")
String triParNbCommentaires();
/**
* Translated "Trier par nombre de commentaires".
*
* @return translated "Trier par nombre de commentaires"
*/
@DefaultStringValue("Trier par nombre de commentaires")
@Key("triParNbCommentairesTooltip")
String triParNbCommentairesTooltip();
 
/**
* Translated "Tri actuel par nombre de commentaires croissant".
*
* @return translated "Tri actuel par nombre de commentaires croissant"
*/
@DefaultStringValue("Tri actuel par nombre de commentaires croissant")
@Key("triParNbCommentairesAscendant")
String triParNbCommentairesAscendant();
 
/**
* Translated "Tri actuel par nombre de commentaires décroissant".
*
* @return translated "Tri actuel par nombre de commentaires décroissant"
*/
@DefaultStringValue("Tri actuel par nombre de commentaires décroissant")
@Key("triParNbCommentairesDescendant")
String triParNbCommentairesDescendant();
 
/**
* Translated "Vote".
*
* @return translated "Vote"
1508,6 → 1554,42
@DefaultStringValue("Voir les commentaires liés à cette proposition")
@Key("voirDetailCommentaires")
String voirDetailCommentaires();
/**
* Translated "Tout".
*
* @return translated "Tout"
*/
@DefaultStringValue("Tout")
@Key("ongletTous")
String ongletTous();
/**
* Translated "A déterminer".
*
* @return translated "A déterminer"
*/
@DefaultStringValue("A déterminer")
@Key("ongletADeterminer")
String ongletADeterminer();
/**
* Translated "A confirmer".
*
* @return translated "A confirmer"
*/
@DefaultStringValue("A confirmer")
@Key("ongletAConfirmer")
String ongletAConfirmer();
/**
* Translated "Vérifiées".
*
* @return translated "Vérifiées"
*/
@DefaultStringValue("Vérifiées")
@Key("ongletVerifiees")
String ongletVerifiees();
 
/**
* Translated "Voir le détail des utilisateurs qui ont voté".
/trunk/src/org/tela_botanica/del/client/utils/ModerationUtils.java
18,7 → 18,7
if(!utilisateur.etreAdmin()) {
Date dateCourante = new Date();
Date dateObs = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").parse(observation.getDateTransmission());
boolean estEnRetard = CalendarUtil.getDaysBetween(dateObs, dateCourante) > 60;
boolean estEnRetard = CalendarUtil.getDaysBetween(dateObs, dateCourante) > 30;
boolean observationAuteurAnonyme = !observation.getIdAuteur().equals(0);
if(utilisateur.etreValidateur() && observationAuteurAnonyme && estEnRetard) {
/trunk/src/org/tela_botanica/del/client/utils/UtilitairesServiceResultat.java
91,6 → 91,9
observation.setCommentaire(getValeurOuVide(observationJson, "commentaire"));
observation.setNumNomenclatural(getValeurOuVide(observationJson, "determination.nn"));
observation.setReferentiel(getValeurOuVide(observationJson, "determination.referentiel"));
String nbCom = getValeurOuVide(observationJson, "nb_commentaires");
nbCom = nbCom.equals("") ? "0" : nbCom;
observation.setNbCommentaires(nbCom);
observation.setMotsClefs(parserMotsCles(UtilitairesServiceResultat.getValeurOuVide(observationJson, "mots_cles_texte")));
JSONValue propositions = observationJson.get("commentaires");
 
626,12 → 629,11
// TODO ajouter vérifications plus précises
double total = retourJson.isObject().get("entete").isObject().get("total").isNumber().doubleValue();
nbTotalObservationsPourLaRecherche = (int) total;
JSONObject tableauObs = retourJson.isObject().get("resultats").isObject();
JSONArray tableauObs = retourJson.isObject().get("resultats").isArray();
 
if (tableauObs != null) {
java.util.Iterator<String> it = tableauObs.keySet().iterator();
while (it.hasNext()) {
JSONObject observationJson = tableauObs.get(it.next()).isObject();
for(int i = 0; i < tableauObs.size(); i++) {
JSONObject observationJson = tableauObs.get(i).isObject();
Observation observation = analyserObservation(observationJson);
observations.add(observation);
}
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/observations/ObservationVue.ui.xml
30,7 → 30,7
text="{constants.proposerSaDetermination}" />
<g:Button ui:field="boutonAjoutCommentaire" styleName="bouton-petit"
text="{constants.ajouterCommentaire}" />
<g:Button ui:field="boutonPlusDeDetails" styleName="bouton-petit {style.ajouterProposition}"
<g:Button ui:field="boutonPlusDeDetails" styleName="bouton-petit {style.ajouterProposition} {style.plusDeDetails}"
text="Voir tous les commentaires" />
</g:HTMLPanel>
</g:HTMLPanel>
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/observations/ObservationPresenteur.java
33,6 → 33,7
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
 
51,6 → 52,8
 
public void setNomEspece(String nomEspece);
public void setNbCommentaires(String nbCommentaires);
public HasClickHandlers getBoutonAjoutCommentaire();
public HasClickHandlers getBoutonPlusDeDetails();
}
78,6 → 81,7
observationDeterminationPresenteur = new ObservationDeterminationPresenteur(new ObservationDeterminationVue(), observation.getPropositionDeterminations());
observationDeterminationPresenteur.go(vue.getDeterminationsPanel());
vue.setNomEspece(observation.getNomRetenu());
vue.setNbCommentaires(observation.getNbCommentaires());
gererEvenements();
}
 
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/observations/ObservationVue.java
73,4 → 73,9
this.nomEspece.setText(nomEspece);
}
 
@Override
public void setNbCommentaires(String nbCommentaires) {
boutonPlusDeDetails.setText(boutonPlusDeDetails.getText()+" ("+nbCommentaires+")");
}
 
}
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/observations/observation.css
95,4 → 95,7
}
.ajouterProposition {
margin-top:10px;
}
.plusDeDetails {
width: 130px;
}
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/ResultatsIdentiplanteVue.ui.xml
13,9 → 13,15
<g:HTMLPanel ui:field="zoneTri" styleName="droite {style.zoneTri} petit">
<g:Label text="{constants.tri}" styleName="gauche"/>
<g:HTMLPanel ui:field="triParDate" styleName="gauche">
<g:Label text="{constants.triParDate}" title="{constants.triParDateObsTooltip}" styleName="gauche {style.date}" ui:field="labelDate"/>
<g:Button title="{constants.triParDateObsAscendant}" ui:field="triParDateAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDateObsDescendant}" ui:field="triParDateDescendant" styleName="{style.boutonTriDesc} gauche" />
<g:Label text="{constants.triParDateObs}" title="{constants.triParDateObsTooltip}" styleName="gauche {style.date}" ui:field="labelDateObservation"/>
<g:Button title="{constants.triParDateObsAscendant}" ui:field="triParDateObservationAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDateObsDescendant}" ui:field="triParDateObservationDescendant" styleName="{style.boutonTriDesc} gauche" />
<g:Label text="{constants.triParDatePubli}" title="{constants.triParDatePubliTooltip}" styleName="gauche {style.date}" ui:field="labelDatePublication"/>
<g:Button title="{constants.triParDatePubliAscendant}" ui:field="triParDatePublicationAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDatePubliDescendant}" ui:field="triParDatePublicationDescendant" styleName="{style.boutonTriDesc} gauche" />
<g:Label text="{constants.triParNbCommentaires}" title="{constants.triParDatePubliTooltip}" styleName="gauche {style.date}" ui:field="labelNbCommentaires"/>
<g:Button title="{constants.triParDatePubliAscendant}" ui:field="triParNbCommentairesAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDatePubliDescendant}" ui:field="triParNbCommentairesDescendant" styleName="{style.boutonTriDesc} gauche" />
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/ResultatsIdentiplantePresenteur.java
22,6 → 22,7
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Label;
 
public class ResultatsIdentiplantePresenteur extends Presenteur {
 
41,22 → 42,40
 
public void nettoyer();
 
public HasClickHandlers getTriParDateAscendant();
public HasClickHandlers getTriParDateObservationAscendant();
 
public HasClickHandlers getTriParDateDescendant();
public HasClickHandlers getTriParDateObservationDescendant();
public HasClickHandlers getTriParDatePublicationAscendant();
 
public HasClickHandlers getTriParDatePublicationDescendant();
public HasClickHandlers getTriParNbCommentairesAscendant();
 
public HasClickHandlers getTriParNbCommentairesDescendant();
 
public void afficherElementsAucunResultatTrouve();
 
public void afficherElementsResultatsTrouves();
 
public HasClickHandlers getLabelDate();
public HasClickHandlers getLabelDateObservation();
public HasClickHandlers getLabelDatePublication();
public HasClickHandlers getLabelNbCommentaires();
 
public void setModeTri(ModeTri mode);
void setModeTriPublication(ModeTri mode);
 
void setModeTriObservation(ModeTri mode);
 
void setModeTriNbCommentaires(ModeTri mode);
}
 
private Vue vue;
private ObservationService serviceObs;
private ModeTri triCourantDate = ModeTri.TRI_DESCENDANT;
private ModeTri triCourantDatePublication = ModeTri.TRI_DESCENDANT;
private ModeTri triCourantDateObservation = ModeTri.PAS_DE_TRI;
private ModeTri triCourantNbCommentaires = ModeTri.PAS_DE_TRI;
private CacheClient cache = CacheClient.getInstance();
private String statut;
 
70,10 → 89,23
public ResultatsIdentiplantePresenteur(ObservationService serviceObs, Vue vue) {
String statut = CacheClient.getInstance().getFiltreStatut();
this.vue = vue;
ModeTri initTriCourantDate = CacheClient.getInstance().getInformationsRechercheObservation().getTriParDate();
initTriCourantDate = (initTriCourantDate == null) ? triCourantDate : initTriCourantDate;
triCourantDate = initTriCourantDate;
vue.setModeTri(triCourantDate);
InformationsRecherche infos = CacheClient.getInstance().getInformationsRechercheObservation();
if (infos.getTriParDatePublication() != ModeTri.PAS_DE_TRI) {
triCourantDatePublication = infos.getTriParDatePublication();
vue.setModeTriPublication(triCourantDatePublication);
}
if (infos.getTriParDateObservation() != ModeTri.PAS_DE_TRI) {
triCourantDateObservation = infos.getTriParDateObservation();
vue.setModeTriObservation(triCourantDatePublication);
}
if (infos.getTriParNbCommentaires() != ModeTri.PAS_DE_TRI) {
triCourantNbCommentaires = infos.getTriParNbCommentaires();
vue.setModeTriNbCommentaires(triCourantNbCommentaires);
}
this.serviceObs = serviceObs;
this.statut = statut;
}
162,39 → 194,118
* */
protected void gererEvenements() {
 
ClickHandler surClicDate = new ClickHandler() {
ClickHandler surClicDateObservation = new ClickHandler() {
/**
* Gestion du clic sur l'option de tri par date d'observation Masque
* les éléments de tri qui sont en cours et affiche les autres
* */
public void onClick(ClickEvent event) {
toggleModeTri();
toggleModeTriObservation();
 
InformationsRecherche informationsRechercheObservations = cache.getInformationsRechercheObservation();
informationsRechercheObservations.setTriParDate(triCourantDate);
informationsRechercheObservations.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParNbCommentaires(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParDateObservation(triCourantDateObservation);
chercherEtAfficherObservationsPageEnCours();
}
};
ClickHandler surClicDatePublication = new ClickHandler() {
/**
* Gestion du clic sur l'option de tri par date d'observation Masque
* les éléments de tri qui sont en cours et affiche les autres
* */
public void onClick(ClickEvent event) {
toggleModeTriPublication();
 
vue.getLabelDate().addClickHandler(surClicDate);
vue.getTriParDateAscendant().addClickHandler(surClicDate);
vue.getTriParDateDescendant().addClickHandler(surClicDate);
InformationsRecherche informationsRechercheObservations = cache.getInformationsRechercheObservation();
informationsRechercheObservations.setTriParDateObservation(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParNbCommentaires(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParDatePublication(triCourantDatePublication);
 
chercherEtAfficherObservationsPageEnCours();
}
};
ClickHandler surClicNbCommentaires = new ClickHandler() {
/**
* Même comportement qu'au dessus mais pour le tri par nb de commentaires
*/
public void onClick(ClickEvent event) {
toggleModeTriNbCommentaires();
 
InformationsRecherche informationsRechercheObservations = cache.getInformationsRechercheObservation();
informationsRechercheObservations.setTriParDateObservation(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParNbCommentaires(triCourantNbCommentaires);
chercherEtAfficherObservationsPageEnCours();
}
};
 
vue.getLabelDateObservation().addClickHandler(surClicDateObservation);
vue.getTriParDateObservationAscendant().addClickHandler(surClicDateObservation);
vue.getTriParDateObservationDescendant().addClickHandler(surClicDateObservation);
vue.getLabelDatePublication().addClickHandler(surClicDatePublication);
vue.getTriParDatePublicationAscendant().addClickHandler(surClicDatePublication);
vue.getTriParDatePublicationDescendant().addClickHandler(surClicDatePublication);
vue.getLabelNbCommentaires().addClickHandler(surClicNbCommentaires);
vue.getTriParNbCommentairesAscendant().addClickHandler(surClicNbCommentaires);
vue.getTriParNbCommentairesDescendant().addClickHandler(surClicNbCommentaires);
}
 
/**
* Inverser le mode de tri en fonction du précédent
* */
public void toggleModeTri() {
if (triCourantDate == ModeTri.TRI_ASCENDANT) {
triCourantDate = ModeTri.TRI_DESCENDANT;
public void toggleModeTriPublication() {
if (triCourantDatePublication == ModeTri.TRI_ASCENDANT) {
triCourantDatePublication = ModeTri.TRI_DESCENDANT;
} else {
triCourantDate = ModeTri.TRI_ASCENDANT;
triCourantDatePublication = ModeTri.TRI_ASCENDANT;
}
triCourantDateObservation = ModeTri.PAS_DE_TRI;
triCourantNbCommentaires = ModeTri.PAS_DE_TRI;
 
vue.setModeTri(triCourantDate);
vue.setModeTriPublication(triCourantDatePublication);
}
/**
* Inverser le mode de tri en fonction du précédent
* */
public void toggleModeTriObservation() {
if (triCourantDateObservation == ModeTri.TRI_ASCENDANT) {
triCourantDateObservation = ModeTri.TRI_DESCENDANT;
} else {
triCourantDateObservation = ModeTri.TRI_ASCENDANT;
}
triCourantDatePublication = ModeTri.PAS_DE_TRI;
triCourantNbCommentaires = ModeTri.PAS_DE_TRI;
 
vue.setModeTriObservation(triCourantDateObservation);
}
/**
* Inverser le mode de tri en fonction du précédent
* */
public void toggleModeTriNbCommentaires() {
if (triCourantNbCommentaires == ModeTri.TRI_ASCENDANT) {
triCourantNbCommentaires = ModeTri.TRI_DESCENDANT;
} else {
triCourantNbCommentaires = ModeTri.TRI_ASCENDANT;
}
System.out.println(triCourantNbCommentaires);
triCourantDateObservation = ModeTri.PAS_DE_TRI;
triCourantDatePublication = ModeTri.PAS_DE_TRI;
 
vue.setModeTriNbCommentaires(triCourantNbCommentaires);
}
 
/**
* Initialiser les variable de début et fin et lancer le chargement des
* observations
* */
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/ResultatsIdentiplanteVue.java
3,6 → 3,7
import org.tela_botanica.del.client.modeles.ModeTri;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
27,10 → 28,12
Panel zoneObservations, zonePaginationHaut, zonePaginationBas, zoneTri;
 
@UiField
Button triParDateAscendant, triParDateDescendant;
Button triParDateObservationAscendant, triParDateObservationDescendant,
triParDatePublicationAscendant, triParDatePublicationDescendant,
triParNbCommentairesAscendant, triParNbCommentairesDescendant;
 
@UiField
Label aucunResultat, labelDate;
Label aucunResultat, labelDateObservation, labelDatePublication, labelNbCommentaires;
 
// Constructeur de la vue
87,32 → 90,102
zoneTri.setVisible(true);
}
 
public Button getTriParDateAscendant() {
return triParDateAscendant;
public Button getTriParDateObservationAscendant() {
return triParDateObservationAscendant;
}
 
public Button getTriParDateDescendant() {
return triParDateDescendant;
public Button getTriParDateObservationDescendant() {
return triParDateObservationDescendant;
}
public Button getTriParDatePublicationAscendant() {
return triParDatePublicationAscendant;
}
 
public Button getTriParDatePublicationDescendant() {
return triParDatePublicationDescendant;
}
@Override
public Label getLabelDate() {
return labelDate;
public Label getLabelDateObservation() {
return labelDateObservation;
}
@Override
public Label getLabelDatePublication() {
return labelDatePublication;
}
@Override
public Label getLabelNbCommentaires() {
return labelNbCommentaires;
}
@Override
public HasClickHandlers getTriParNbCommentairesAscendant() {
return triParNbCommentairesAscendant;
}
 
@Override
public HasClickHandlers getTriParNbCommentairesDescendant() {
return triParNbCommentairesDescendant;
}
private void cacherTris() {
triParDateObservationAscendant.setVisible(false);
triParDateObservationDescendant.setVisible(false);
triParDatePublicationDescendant.setVisible(false);
triParDatePublicationAscendant.setVisible(false);
triParNbCommentairesAscendant.setVisible(false);
triParNbCommentairesDescendant.setVisible(false);
}
/**
* En fonction du sens du tri (ascendant ou descendant), on change l'affichage des
* boutons de tri pour masquer que celui qui doit être cliquable.
* @param ModeTri le mode Ascendant ou Descendant
* */
public void setModeTri(ModeTri mode) {
@Override
public void setModeTriPublication(ModeTri mode) {
cacherTris();
if (mode == ModeTri.TRI_ASCENDANT) {
triParDateAscendant.setVisible(true);
triParDateDescendant.setVisible(false);
triParDatePublicationAscendant.setVisible(true);
triParDatePublicationDescendant.setVisible(false);
} else {
triParDateDescendant.setVisible(true);
triParDateAscendant.setVisible(false);
triParDatePublicationDescendant.setVisible(true);
triParDatePublicationAscendant.setVisible(false);
}
}
/**
* En fonction du sens du tri (ascendant ou descendant), on change l'affichage des
* boutons de tri pour masquer que celui qui doit être cliquable.
* @param ModeTri le mode Ascendant ou Descendant
* */
@Override
public void setModeTriObservation(ModeTri mode) {
cacherTris();
if (mode == ModeTri.TRI_ASCENDANT) {
triParDateObservationAscendant.setVisible(true);
triParDateObservationDescendant.setVisible(false);
} else {
triParDateObservationDescendant.setVisible(true);
triParDateObservationAscendant.setVisible(false);
}
}
 
@Override
public void setModeTriNbCommentaires(ModeTri mode) {
cacherTris();
if (mode == ModeTri.TRI_ASCENDANT) {
triParNbCommentairesAscendant.setVisible(true);
triParNbCommentairesDescendant.setVisible(false);
} else {
triParNbCommentairesDescendant.setVisible(true);
triParNbCommentairesAscendant.setVisible(false);
}
}
}
/trunk/src/org/tela_botanica/del/client/vues/identiplante/moteur/MoteurIdentiplanteVue.java
24,7 → 24,7
Panel zoneRecherche, zoneResultats;
 
@UiField
Label ongletTout, ongletADeterminer, ongletEnDiscussion, ongletValidees;
Label ongletTout, ongletADeterminer, ongletAConfirmer, ongletValidees;
 
public HasWidgets getZoneRecherche() {
return zoneRecherche;
41,8 → 41,8
}
@Override
public HasClickHandlers getOngletEnDiscussion() {
return ongletEnDiscussion;
public HasClickHandlers getOngletAConfirmer() {
return ongletAConfirmer;
}
 
@Override
73,9 → 73,9
}
 
@Override
public void setOngletEnDiscussionActif() {
public void setOngletAConfirmerActif() {
nettoyerOngletsActifs();
ongletEnDiscussion.addStyleName("onglet-actif");
ongletAConfirmer.addStyleName("onglet-actif");
}
 
@Override
87,7 → 87,7
public void nettoyerOngletsActifs() {
ongletTout.removeStyleName("onglet-actif");
ongletADeterminer.removeStyleName("onglet-actif");
ongletEnDiscussion.removeStyleName("onglet-actif");
ongletAConfirmer.removeStyleName("onglet-actif");
ongletValidees.removeStyleName("onglet-actif");
}
97,8 → 97,8
setOngletToutActif();
} else if (statut.equals("adeterminer")) {
setOngletADeterminerActif();
} else if (statut.equals("endiscussion")) {
setOngletEnDiscussionActif();
} else if (statut.equals("aconfirmer")) {
setOngletAConfirmerActif();
} else if (statut.equals("validees")) {
setOngletValideesActif();
}
/trunk/src/org/tela_botanica/del/client/vues/identiplante/moteur/MoteurIdentiplanteVue.ui.xml
14,11 → 14,11
<g:HTMLPanel ui:field="zoneRecherche" />
</g:HTMLPanel>
<g:HTMLPanel styleName="zone-onglets">
<g:Label styleName="onglet onglet-actif" text="Tout" ui:field="ongletTout"></g:Label>
<g:Label styleName="onglet" text="A déterminer" ui:field="ongletADeterminer"></g:Label>
<g:Label styleName="onglet" text="En discussion" ui:field="ongletEnDiscussion"></g:Label>
<g:Label styleName="onglet onglet-actif" text="{constants.ongletTous}" ui:field="ongletTout"></g:Label>
<g:Label styleName="onglet" text="{constants.ongletADeterminer}" ui:field="ongletADeterminer"></g:Label>
<g:Label styleName="onglet" text="{constants.ongletAConfirmer}" ui:field="ongletAConfirmer"></g:Label>
<!-- terme Validées/Vérifiées sujet à changement, "Vérifiées" en texte, "Validées" partout ailleurs dans le code -->
<g:Label styleName="onglet" text="Vérifiées" ui:field="ongletValidees"></g:Label>
<g:Label styleName="onglet" text="{constants.ongletVerifiees}" ui:field="ongletValidees"></g:Label>
</g:HTMLPanel>
<g:HTMLPanel>
<g:HTMLPanel ui:field="zoneResultats" />
/trunk/src/org/tela_botanica/del/client/vues/identiplante/moteur/MoteurIdentiplantePresenteur.java
28,7 → 28,7
 
public HasWidgets getZoneResultats();
 
public HasClickHandlers getOngletEnDiscussion();
public HasClickHandlers getOngletAConfirmer();
public HasClickHandlers getOngletADeterminer();
40,7 → 40,7
public void setOngletToutActif();
public void setOngletEnDiscussionActif();
public void setOngletAConfirmerActif();
 
public void setOngletValideesActif();
102,14 → 102,14
}
});
vue.getOngletEnDiscussion().addClickHandler(new ClickHandler() {
vue.getOngletAConfirmer().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
CacheClient.getInstance().setFiltreStatut("endiscussion");
CacheClient.getInstance().setFiltreStatut("aconfirmer");
CacheClient.getInstance().setPageCouranteRechercheObservations(1);
chercherObservations();
vue.setOngletEnDiscussionActif();
vue.setOngletAConfirmerActif();
}
});
 
/trunk/src/org/tela_botanica/del/client/vues/pictoflora/resultats/ResultatPictofloraVue.ui.xml
15,9 → 15,9
<g:HTMLPanel ui:field="zoneTri" styleName="gauche {style.zoneTri} petit">
<g:Label text="{constants.tri}" styleName="gauche {style.labeltri}"/>
<g:HTMLPanel ui:field="triParDate" styleName="gauche">
<g:Label text="{constants.triParDate}" title="{constants.triParDateTooltip}" styleName="gauche {style.date}" ui:field="labelDate"/>
<g:Button title="{constants.triParDateAscendant}" ui:field="triParDateAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDateDescendant}" ui:field="triParDateDescendant" styleName="{style.boutonTriDesc} gauche" />
<g:Label text="{constants.triParDatePubli}" title="{constants.triParDatePubliTooltip}" styleName="gauche {style.date}" ui:field="labelDate"/>
<g:Button title="{constants.triParDatePubliAscendant}" ui:field="triParDateAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDatePubliDescendant}" ui:field="triParDateDescendant" styleName="{style.boutonTriDesc} gauche" />
</g:HTMLPanel>
<g:HTMLPanel ui:field="triParMoyenneArithmetique" styleName="gauche">
<g:Label text="{constants.triParMoyenneArithmetique}" title="{constants.triParMoyenneArithmetiqueTooltip}" styleName="gauche {style.moyenneArithmetique}" ui:field="labelMoyenneArithmetique"/>
/trunk/src/org/tela_botanica/del/client/vues/pictoflora/resultats/ResultatPictofloraPresenteur.java
1,436 → 1,436
package org.tela_botanica.del.client.vues.pictoflora.resultats;
 
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.composants.pagination.PaginationPresenteur;
import org.tela_botanica.del.client.composants.pagination.PaginationVue;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.ModeTri;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.ProtocoleServiceResultat;
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.GestionnaireEvenementChangementProtocole;
import org.tela_botanica.del.client.services.rest.ImageService;
import org.tela_botanica.del.client.services.rest.ProtocoleService;
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImagePresenteur;
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImageVue;
 
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.OptionElement;
import com.google.gwt.dom.client.SelectElement;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.ListBox;
 
public class ResultatPictofloraPresenteur {
public interface Vue extends IsWidget {
public void startChargement();
 
public void nettoyer();
 
public void creerPanneauxObservations(int size);
 
public void stopChargement();
 
public List<HasWidgets> getPanneauxImages();
 
public HasWidgets getPanneauPagination();
 
public HasWidgets getPanneauPaginationHaut();
 
public HasClickHandlers getTriParMoyenneArithmetiqueAscendant();
 
public HasClickHandlers getTriParMoyenneArithmetiqueDescendant();
 
public HasClickHandlers getTriParPointsAscendant();
 
public HasClickHandlers getTriParPointsDescendant();
 
public HasClickHandlers getTriParDateAscendant();
 
public HasClickHandlers getTriParDateDescendant();
public HasClickHandlers getTriParNbTagsAscendant();
 
public HasClickHandlers getTriParNbTagsDescendant();
 
public void afficherElementsAucunResultatTrouve();
 
public void afficherElementsResultatsTrouve();
 
public HTMLPanel getImageTable();
 
public HasClickHandlers getLabelMoyenneArithmetique();
 
public void masquerMoyenneArithmetiqueAscendant();
 
public void masquerMoyenneArithmetiqueDescendant();
 
public void afficherMoyenneArithmetiqueAscendant();
 
public void afficherMoyenneArithmetiqueDescendant();
 
public HasClickHandlers getLabelDate();
 
public void masquerDateAscendant();
 
public void masquerDateDescendant();
 
public void afficherDateAscendant();
 
public void afficherDateDescendant();
public HasClickHandlers getLabelTag();
 
public void masquerTagAscendant();
 
public void afficherTagDescendant();
 
public void masquerTagDescendant();
 
public void afficherTagAscendant();
 
public HasClickHandlers getLabelPoints();
 
public void afficherPointsAscendant();
 
public void afficherPointsDescendant();
 
public void masquerPointsAscendant();
 
public void masquerPointsDescendant();
 
}
 
private Vue vue;
private ImageService imageService;
private final ProtocoleService protocoleService;
private ModeTri triCourantMoyenneArithmetique = ModeTri.TRI_ASCENDANT;
private ModeTri triCourantPoints = ModeTri.TRI_ASCENDANT;
private ModeTri triCourantDate = ModeTri.TRI_DESCENDANT;
private ModeTri triCourantTag = ModeTri.TRI_DESCENDANT;
 
public ResultatPictofloraPresenteur(ImageService imageService, ProtocoleService protocoleService, Vue vue) {
this.vue = vue;
this.imageService = imageService;
this.protocoleService=protocoleService;
}
 
public void go(HasWidgets composite) {
composite.add(vue.asWidget());
vue.startChargement();
rechercherImagesEtCreerWidgetPagination();
gererEvenements();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
initialiserAPartirInfosCache();
}
private void initialiserAPartirInfosCache() {
InformationsRecherche infos = CacheClient.getInstance().getInformationsRechercheImage();
if (infos.getTriParDate() != ModeTri.PAS_DE_TRI) {
triCourantDate = infos.getTriParDate();
mettreAJourAffichageTriDate();
}
if (infos.getTriParMoyenneArithmetique() != ModeTri.PAS_DE_TRI) {
triCourantMoyenneArithmetique = infos.getTriParMoyenneArithmetique();
mettreAJourAffichageTriMoyenneArithmetique();
}
if (infos.getTriParNbPoints() != ModeTri.PAS_DE_TRI) {
triCourantPoints = infos.getTriParNbPoints();
mettreAJourAffichageTriPoints();
}
if (infos.getTriParNbTags() != ModeTri.PAS_DE_TRI) {
triCourantTag = infos.getTriParNbTags();
mettreAjourAffichageTriTag();
}
}
 
public void gererEvenements() {
ClickHandler surClicTriMoyenneArithmetique = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriMoyenneArithmetique();
}
};
 
vue.getLabelMoyenneArithmetique().addClickHandler(surClicTriMoyenneArithmetique);
vue.getTriParMoyenneArithmetiqueAscendant().addClickHandler(surClicTriMoyenneArithmetique);
vue.getTriParMoyenneArithmetiqueDescendant().addClickHandler(surClicTriMoyenneArithmetique);
 
ClickHandler surClicTriPoints = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriPoints();
}
};
 
vue.getLabelPoints().addClickHandler(surClicTriPoints);
vue.getTriParPointsAscendant().addClickHandler(surClicTriPoints);
vue.getTriParPointsDescendant().addClickHandler(surClicTriPoints);
 
ClickHandler surClicTriDate = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriDate();
}
};
 
vue.getLabelDate().addClickHandler(surClicTriDate);
vue.getTriParDateAscendant().addClickHandler(surClicTriDate);
vue.getTriParDateDescendant().addClickHandler(surClicTriDate);
ClickHandler surClicTriTag = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriTag();
}
};
vue.getLabelTag().addClickHandler(surClicTriTag);
vue.getTriParNbTagsAscendant().addClickHandler(surClicTriTag);
vue.getTriParNbTagsDescendant().addClickHandler(surClicTriTag);
 
BusEvenementiel.getInstance().addHandler(EvenementChangementProtocole.TYPE, new GestionnaireEvenementChangementProtocole() {
@Override
public void onChangementProtocole(EvenementChangementProtocole event) {
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
if (informationsRechercheImages.getTriParMoyenneArithmetique() != ModeTri.PAS_DE_TRI) {
informationsRechercheImages.setIdProtocoleSelectionne(event.getProtocole().getId() + "");
chargerEtAfficherImagesPageEnCours();
}
}
});
}
 
protected void surClicTriTag() {
triCourantTag = (triCourantTag == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAjourAffichageTriTag();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
informationsRechercheImages.setTriParNbTags(triCourantTag);
informationsRechercheImages.setTriParDate(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAjourAffichageTriTag() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantTag == ModeTri.TRI_ASCENDANT) {
vue.masquerTagDescendant();
vue.afficherTagAscendant();
} else {
vue.masquerTagAscendant();
vue.afficherTagDescendant();
}
}
 
public void surClicTriMoyenneArithmetique() {
triCourantMoyenneArithmetique = (triCourantMoyenneArithmetique == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriMoyenneArithmetique();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
informationsRechercheImages.setTriParMoyenneArithmetique(triCourantMoyenneArithmetique);
informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
informationsRechercheImages.setTriParDate(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriMoyenneArithmetique() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantMoyenneArithmetique == ModeTri.TRI_ASCENDANT) {
vue.masquerMoyenneArithmetiqueDescendant();
vue.afficherMoyenneArithmetiqueAscendant();
} else {
vue.masquerMoyenneArithmetiqueAscendant();
vue.afficherMoyenneArithmetiqueDescendant();
}
}
 
public void surClicTriPoints() {
triCourantPoints = (triCourantPoints == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriPoints();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
informationsRechercheImages.setTriParNbPoints(triCourantPoints);
informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
informationsRechercheImages.setTriParDate(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriPoints() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerMoyenneArithmetiqueDescendant();
if (triCourantPoints == ModeTri.TRI_ASCENDANT) {
vue.masquerPointsDescendant();
vue.afficherPointsAscendant();
} else {
vue.masquerPointsAscendant();
vue.afficherPointsDescendant();
}
}
 
public void surClicTriDate() {
triCourantDate = (triCourantDate == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriDate();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
informationsRechercheImages.setTriParDate(triCourantDate);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriDate() {
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantDate == ModeTri.TRI_ASCENDANT) {
vue.masquerDateDescendant();
vue.afficherDateAscendant();
} else {
vue.masquerDateAscendant();
vue.afficherDateDescendant();
}
}
 
public void rechercherImagesEtCreerWidgetPagination() {
// appel du service d'image pour avoir le nb total d'elements pour la
// pagination
ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
 
@Override
public void surRetour(ImageServiceResultat imagesRecues) {
creerWidgetPagination(imagesRecues.getNbTotalImagesPourLaRecherche());
afficherImages(imagesRecues);
 
}
 
@Override
public void surErreur(String messageErreur) {
Window.alert(messageErreur);
 
}
};
final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), debut, fin, callback);
}
 
private void chargerEtAfficherImages(final int premier, final int dernier) {
vue.startChargement();
vue.nettoyer();
ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
 
@Override
public void surRetour(ImageServiceResultat imagesRecues) {
afficherImages(imagesRecues);
}
 
@Override
public void surErreur(String messageErreur) {
Window.alert(messageErreur);
}
 
};
imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), premier, dernier, callback);
}
 
public void afficherImages(ImageServiceResultat imageServiceResult) {
List<Image> images = imageServiceResult.getImages();
if (images == null || images.size() == 0) {
vue.afficherElementsAucunResultatTrouve();
} else {
vue.afficherElementsResultatsTrouve();
for (Image image : images) {
ImagePresenteur imagePresenteur = new ImagePresenteur(image, imageService, CacheClient.getInstance().getProtocoleCourant(), new ImageVue());
imagePresenteur.go(vue.getImageTable());
}
}
CacheClient.getInstance().mettreAjourUrlCourante();
vue.stopChargement();
}
 
private void creerWidgetPagination(int nbImages) {
PaginationPresenteur imagesPaginationPresenteurHaut = creerPresenteurPagination(nbImages);
PaginationPresenteur imagesPaginationPresenteurBas = creerPresenteurPagination(nbImages);
imagesPaginationPresenteurHaut.setGroupePagination("pagination_images");
imagesPaginationPresenteurBas.setGroupePagination("pagination_images");
imagesPaginationPresenteurHaut.go(vue.getPanneauPaginationHaut());
imagesPaginationPresenteurBas.go(vue.getPanneauPagination());
}
 
public PaginationPresenteur creerPresenteurPagination(int nbImages) {
PaginationPresenteur imagesPaginationPresenteur = new PaginationPresenteur(new PaginationVue(), nbImages, CacheClient.getInstance().getPasPagination(), CacheClient.getInstance().getPageCouranteRechercheImage()) {
@Override
public void chargerElements(int debut, int fin) {
chargerEtAfficherImages(debut, fin);
CacheClient.getInstance().setPageCouranteRechercheImages(getPageCourante());
}
 
@Override
public void actualiserPasCache(int pas) {
CacheClient.getInstance().setPasPagination(pas);
}
};
return imagesPaginationPresenteur;
}
 
public void chargerEtAfficherImagesPageEnCours() {
final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
chargerEtAfficherImages(debut, fin);
}
 
public Vue getVue() {
return vue;
}
}
package org.tela_botanica.del.client.vues.pictoflora.resultats;
 
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.composants.pagination.PaginationPresenteur;
import org.tela_botanica.del.client.composants.pagination.PaginationVue;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.ModeTri;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.ProtocoleServiceResultat;
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.GestionnaireEvenementChangementProtocole;
import org.tela_botanica.del.client.services.rest.ImageService;
import org.tela_botanica.del.client.services.rest.ProtocoleService;
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImagePresenteur;
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImageVue;
 
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.OptionElement;
import com.google.gwt.dom.client.SelectElement;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.ListBox;
 
public class ResultatPictofloraPresenteur {
public interface Vue extends IsWidget {
public void startChargement();
 
public void nettoyer();
 
public void creerPanneauxObservations(int size);
 
public void stopChargement();
 
public List<HasWidgets> getPanneauxImages();
 
public HasWidgets getPanneauPagination();
 
public HasWidgets getPanneauPaginationHaut();
 
public HasClickHandlers getTriParMoyenneArithmetiqueAscendant();
 
public HasClickHandlers getTriParMoyenneArithmetiqueDescendant();
 
public HasClickHandlers getTriParPointsAscendant();
 
public HasClickHandlers getTriParPointsDescendant();
 
public HasClickHandlers getTriParDateAscendant();
 
public HasClickHandlers getTriParDateDescendant();
public HasClickHandlers getTriParNbTagsAscendant();
 
public HasClickHandlers getTriParNbTagsDescendant();
 
public void afficherElementsAucunResultatTrouve();
 
public void afficherElementsResultatsTrouve();
 
public HTMLPanel getImageTable();
 
public HasClickHandlers getLabelMoyenneArithmetique();
 
public void masquerMoyenneArithmetiqueAscendant();
 
public void masquerMoyenneArithmetiqueDescendant();
 
public void afficherMoyenneArithmetiqueAscendant();
 
public void afficherMoyenneArithmetiqueDescendant();
 
public HasClickHandlers getLabelDate();
 
public void masquerDateAscendant();
 
public void masquerDateDescendant();
 
public void afficherDateAscendant();
 
public void afficherDateDescendant();
public HasClickHandlers getLabelTag();
 
public void masquerTagAscendant();
 
public void afficherTagDescendant();
 
public void masquerTagDescendant();
 
public void afficherTagAscendant();
 
public HasClickHandlers getLabelPoints();
 
public void afficherPointsAscendant();
 
public void afficherPointsDescendant();
 
public void masquerPointsAscendant();
 
public void masquerPointsDescendant();
 
}
 
private Vue vue;
private ImageService imageService;
private final ProtocoleService protocoleService;
private ModeTri triCourantMoyenneArithmetique = ModeTri.TRI_ASCENDANT;
private ModeTri triCourantPoints = ModeTri.TRI_ASCENDANT;
private ModeTri triCourantDate = ModeTri.TRI_DESCENDANT;
private ModeTri triCourantTag = ModeTri.TRI_DESCENDANT;
 
public ResultatPictofloraPresenteur(ImageService imageService, ProtocoleService protocoleService, Vue vue) {
this.vue = vue;
this.imageService = imageService;
this.protocoleService=protocoleService;
}
 
public void go(HasWidgets composite) {
composite.add(vue.asWidget());
vue.startChargement();
rechercherImagesEtCreerWidgetPagination();
gererEvenements();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
initialiserAPartirInfosCache();
}
private void initialiserAPartirInfosCache() {
InformationsRecherche infos = CacheClient.getInstance().getInformationsRechercheImage();
if (infos.getTriParDatePublication() != ModeTri.PAS_DE_TRI) {
triCourantDate = infos.getTriParDatePublication();
mettreAJourAffichageTriDate();
}
if (infos.getTriParMoyenneArithmetique() != ModeTri.PAS_DE_TRI) {
triCourantMoyenneArithmetique = infos.getTriParMoyenneArithmetique();
mettreAJourAffichageTriMoyenneArithmetique();
}
if (infos.getTriParNbPoints() != ModeTri.PAS_DE_TRI) {
triCourantPoints = infos.getTriParNbPoints();
mettreAJourAffichageTriPoints();
}
if (infos.getTriParNbTags() != ModeTri.PAS_DE_TRI) {
triCourantTag = infos.getTriParNbTags();
mettreAjourAffichageTriTag();
}
}
 
public void gererEvenements() {
ClickHandler surClicTriMoyenneArithmetique = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriMoyenneArithmetique();
}
};
 
vue.getLabelMoyenneArithmetique().addClickHandler(surClicTriMoyenneArithmetique);
vue.getTriParMoyenneArithmetiqueAscendant().addClickHandler(surClicTriMoyenneArithmetique);
vue.getTriParMoyenneArithmetiqueDescendant().addClickHandler(surClicTriMoyenneArithmetique);
 
ClickHandler surClicTriPoints = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriPoints();
}
};
 
vue.getLabelPoints().addClickHandler(surClicTriPoints);
vue.getTriParPointsAscendant().addClickHandler(surClicTriPoints);
vue.getTriParPointsDescendant().addClickHandler(surClicTriPoints);
 
ClickHandler surClicTriDate = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriDate();
}
};
 
vue.getLabelDate().addClickHandler(surClicTriDate);
vue.getTriParDateAscendant().addClickHandler(surClicTriDate);
vue.getTriParDateDescendant().addClickHandler(surClicTriDate);
ClickHandler surClicTriTag = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriTag();
}
};
vue.getLabelTag().addClickHandler(surClicTriTag);
vue.getTriParNbTagsAscendant().addClickHandler(surClicTriTag);
vue.getTriParNbTagsDescendant().addClickHandler(surClicTriTag);
 
BusEvenementiel.getInstance().addHandler(EvenementChangementProtocole.TYPE, new GestionnaireEvenementChangementProtocole() {
@Override
public void onChangementProtocole(EvenementChangementProtocole event) {
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
if (informationsRechercheImages.getTriParMoyenneArithmetique() != ModeTri.PAS_DE_TRI) {
informationsRechercheImages.setIdProtocoleSelectionne(event.getProtocole().getId() + "");
chargerEtAfficherImagesPageEnCours();
}
}
});
}
 
protected void surClicTriTag() {
triCourantTag = (triCourantTag == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAjourAffichageTriTag();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
informationsRechercheImages.setTriParNbTags(triCourantTag);
informationsRechercheImages.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAjourAffichageTriTag() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantTag == ModeTri.TRI_ASCENDANT) {
vue.masquerTagDescendant();
vue.afficherTagAscendant();
} else {
vue.masquerTagAscendant();
vue.afficherTagDescendant();
}
}
 
public void surClicTriMoyenneArithmetique() {
triCourantMoyenneArithmetique = (triCourantMoyenneArithmetique == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriMoyenneArithmetique();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
informationsRechercheImages.setTriParMoyenneArithmetique(triCourantMoyenneArithmetique);
informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
informationsRechercheImages.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriMoyenneArithmetique() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantMoyenneArithmetique == ModeTri.TRI_ASCENDANT) {
vue.masquerMoyenneArithmetiqueDescendant();
vue.afficherMoyenneArithmetiqueAscendant();
} else {
vue.masquerMoyenneArithmetiqueAscendant();
vue.afficherMoyenneArithmetiqueDescendant();
}
}
 
public void surClicTriPoints() {
triCourantPoints = (triCourantPoints == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriPoints();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
informationsRechercheImages.setTriParNbPoints(triCourantPoints);
informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
informationsRechercheImages.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriPoints() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerMoyenneArithmetiqueDescendant();
if (triCourantPoints == ModeTri.TRI_ASCENDANT) {
vue.masquerPointsDescendant();
vue.afficherPointsAscendant();
} else {
vue.masquerPointsAscendant();
vue.afficherPointsDescendant();
}
}
 
public void surClicTriDate() {
triCourantDate = (triCourantDate == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriDate();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
informationsRechercheImages.setTriParDatePublication(triCourantDate);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriDate() {
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantDate == ModeTri.TRI_ASCENDANT) {
vue.masquerDateDescendant();
vue.afficherDateAscendant();
} else {
vue.masquerDateAscendant();
vue.afficherDateDescendant();
}
}
 
public void rechercherImagesEtCreerWidgetPagination() {
// appel du service d'image pour avoir le nb total d'elements pour la
// pagination
ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
 
@Override
public void surRetour(ImageServiceResultat imagesRecues) {
creerWidgetPagination(imagesRecues.getNbTotalImagesPourLaRecherche());
afficherImages(imagesRecues);
 
}
 
@Override
public void surErreur(String messageErreur) {
Window.alert(messageErreur);
 
}
};
final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), debut, fin, callback);
}
 
private void chargerEtAfficherImages(final int premier, final int dernier) {
vue.startChargement();
vue.nettoyer();
ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
 
@Override
public void surRetour(ImageServiceResultat imagesRecues) {
afficherImages(imagesRecues);
}
 
@Override
public void surErreur(String messageErreur) {
Window.alert(messageErreur);
}
 
};
imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), premier, dernier, callback);
}
 
public void afficherImages(ImageServiceResultat imageServiceResult) {
List<Image> images = imageServiceResult.getImages();
if (images == null || images.size() == 0) {
vue.afficherElementsAucunResultatTrouve();
} else {
vue.afficherElementsResultatsTrouve();
for (Image image : images) {
ImagePresenteur imagePresenteur = new ImagePresenteur(image, imageService, CacheClient.getInstance().getProtocoleCourant(), new ImageVue());
imagePresenteur.go(vue.getImageTable());
}
}
CacheClient.getInstance().mettreAjourUrlCourante();
vue.stopChargement();
}
 
private void creerWidgetPagination(int nbImages) {
PaginationPresenteur imagesPaginationPresenteurHaut = creerPresenteurPagination(nbImages);
PaginationPresenteur imagesPaginationPresenteurBas = creerPresenteurPagination(nbImages);
imagesPaginationPresenteurHaut.setGroupePagination("pagination_images");
imagesPaginationPresenteurBas.setGroupePagination("pagination_images");
imagesPaginationPresenteurHaut.go(vue.getPanneauPaginationHaut());
imagesPaginationPresenteurBas.go(vue.getPanneauPagination());
}
 
public PaginationPresenteur creerPresenteurPagination(int nbImages) {
PaginationPresenteur imagesPaginationPresenteur = new PaginationPresenteur(new PaginationVue(), nbImages, CacheClient.getInstance().getPasPagination(), CacheClient.getInstance().getPageCouranteRechercheImage()) {
@Override
public void chargerElements(int debut, int fin) {
chargerEtAfficherImages(debut, fin);
CacheClient.getInstance().setPageCouranteRechercheImages(getPageCourante());
}
 
@Override
public void actualiserPasCache(int pas) {
CacheClient.getInstance().setPasPagination(pas);
}
};
return imagesPaginationPresenteur;
}
 
public void chargerEtAfficherImagesPageEnCours() {
final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
chargerEtAfficherImages(debut, fin);
}
 
public Vue getVue() {
return vue;
}
}
/trunk/src/org/tela_botanica/del/client/vues/comparaisoneflore/ComparaisonEfloreVue.ui.xml
68,7 → 68,7
<g:Label text="{constants.auteur}" styleName="petit" />
<g:Label ui:field="nomAuteurEflore" />
 
<g:Label text="{constants.transmisLe}" styleName="petit" />
<g:Label text="{constants.publieLe}" styleName="petit" />
<g:Label ui:field="dateObservationEflore" />
</g:HTMLPanel>
</g:VerticalPanel>