/trunk/src/org/tela_botanica/del/client/utils/URLUtils.java |
---|
1,6 → 1,7 |
package org.tela_botanica.del.client.utils; |
import com.google.gwt.user.client.History; |
import com.google.gwt.user.client.Window; |
public class URLUtils { |
12,7 → 13,11 |
public static String getURLSpecialParameterValue() { |
String historyToken = History.getToken(); |
int debutParam = historyToken.indexOf("~"); |
return historyToken.substring(debutParam + 1); |
String specialParam = null; |
if(debutParam != -1) { |
specialParam = historyToken.substring(debutParam + 1); |
} |
return specialParam; |
} |
} |
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/ResultatsIdentiplantePresenteur.java |
---|
70,6 → 70,9 |
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); |
this.serviceObs = serviceObs; |
this.statut = statut; |
254,6 → 257,7 |
presenteur.go(vue.getZoneObservations()); |
} |
} |
CacheClient.getInstance().mettreAjourUrlCourante(); |
vue.stopChargement(); |
} |
} |
/trunk/src/org/tela_botanica/del/client/vues/pictoflora/resultats/ResultatPictofloraPresenteur.java |
---|
324,6 → 324,7 |
imagePresenteur.go(vue.getImageTable()); |
} |
} |
CacheClient.getInstance().mettreAjourUrlCourante(); |
vue.stopChargement(); |
} |
356,7 → 357,6 |
final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination(); |
final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination(); |
chargerEtAfficherImages(debut, fin); |
CacheClient.getInstance().mettreAjourUrlCourante(); |
} |
public Vue getVue() { |
/trunk/src/org/tela_botanica/del/client/vues/pictoflora/moteur/MoteurPictofloraPresenteur.java |
---|
2,14 → 2,9 |
import java.util.List; |
import javax.validation.Configuration; |
import org.tela_botanica.del.client.cache.CacheClient; |
import org.tela_botanica.del.client.composants.moteurrecherche.MoteurRecherchePresenteur; |
import org.tela_botanica.del.client.composants.moteurrecherche.MoteurRechercheVue; |
import org.tela_botanica.del.client.composants.partageurl.PartageUrlPresenteur; |
import org.tela_botanica.del.client.composants.partageurl.PartageUrlVue; |
import org.tela_botanica.del.client.config.Config; |
import org.tela_botanica.del.client.modeles.ModeRecherche; |
import org.tela_botanica.del.client.modeles.Protocole; |
import org.tela_botanica.del.client.modeles.ProtocoleServiceResultat; |
19,21 → 14,15 |
import org.tela_botanica.del.client.services.rest.ProtocoleService; |
import org.tela_botanica.del.client.services.rest.ProtocoleServiceConcret; |
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback; |
import org.tela_botanica.del.client.utils.URLUtils; |
import org.tela_botanica.del.client.vues.pictoflora.resultats.ResultatPictofloraPresenteur; |
import org.tela_botanica.del.client.vues.pictoflora.resultats.ResultatPictofloraVue; |
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.HasWidgets; |
import com.google.gwt.user.client.ui.IsWidget; |
import com.google.gwt.user.client.ui.ListBox; |
import com.google.gwt.user.client.ui.Panel; |
public class MoteurPictofloraPresenteur { |
91,7 → 80,7 |
protocoles = protocolesRecus.getProtocoles(); |
} |
//Vérifier qu'on n'a pas demandé un protocole particulier en paramètre |
String parametre = URLUtils.getURLSpecialParameterValue(); |
String parametre = CacheClient.getInstance().getIdProtocoleEnAttente(); |
if (parametre != null) { |
for (Protocole protocoleCourant : protocoles) { |
if (parametre.equals(String.valueOf(protocoleCourant.getId()))) { |
98,6 → 87,7 |
CacheClient.getInstance().setProtocoleCourant(protocoleCourant); |
} |
} |
CacheClient.getInstance().setIdProtocoleEnAttente(null); |
} else { |
CacheClient.getInstance().setProtocoleCourant(protocolesRecus.getProtocoles().get(0)); |
} |
153,22 → 143,22 |
} |
vue.mettreAJourDescriptionProtocoleCourant(protocoleCourant); |
CacheClient.getInstance().setProtocoleCourant(protocoleCourant); |
CacheClient.getInstance().mettreAjourUrlCourante(); |
EvenementChangementProtocole evenement = new EvenementChangementProtocole(protocoleCourant); |
BusEvenementiel.getInstance().fireEvent(evenement); |
CacheClient.getInstance().mettreAjourUrlCourante(); |
} |
private void remplirListeProtocole(List<Protocole> protocoles) { |
//si un paramètre est passé dans l'url, on sélectionne un protocole |
String parametre = URLUtils.getURLSpecialParameterValue(); |
String parametre = CacheClient.getInstance().getIdProtocoleEnAttente(); |
if (parametre != null) { |
for (Protocole protocoleCourant : protocoles) { |
if (parametre.equals(String.valueOf(protocoleCourant.getId()))) { |
CacheClient.getInstance().mettreAjourUrlCourante(); |
CacheClient.getInstance().setProtocoleCourant(protocoleCourant); |
} |
} |
} |
vue.ajouterProtocoles(protocoles); |
if (CacheClient.getInstance().getProtocoleCourant() == null) { |
vue.selectionnerProtocole(0); |
177,6 → 167,7 |
vue.selectionnerProtocoleParProtocole(CacheClient.getInstance().getProtocoleCourant()); |
vue.mettreAJourDescriptionProtocoleCourant(CacheClient.getInstance().getProtocoleCourant()); |
} |
CacheClient.getInstance().mettreAjourUrlCourante(); |
} |
public void go(HasWidgets composite) { |
/trunk/src/org/tela_botanica/del/client/cache/CacheClient.java |
---|
11,6 → 11,7 |
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; |
24,6 → 25,7 |
private Observation observationCourante; |
private Image imageCourante; |
private String taxonPourRechercheEflore; |
private String idProtocoleEnAttente = null; |
private Protocole protocoleCourant; |
private String referentielCourant; |
private int numPageRechercheImage = 0; |
83,9 → 85,27 |
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); |
96,9 → 116,23 |
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(pageCourante.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) { |
rechercheParArguments.setMotClefCel(tagCel); |
rechercheParArguments.setMotClefDel(tagDel); |
if(pageInt != null) setPageCouranteRechercheImages(pageInt); |
} else { |
if(pageInt != null) setPageCouranteRechercheObservations(pageInt); |
} |
107,11 → 141,11 |
if(tri != null) { |
ModeTri modeTri = ModeTri.TRI_ASCENDANT; |
if(ordre.equals("asc")) { |
if(ordre != null && ordre.equals("asc")) { |
modeTri = ModeTri.TRI_ASCENDANT; |
} |
if(ordre.equals("desc")) { |
if(ordre != null && ordre.equals("desc")) { |
modeTri = ModeTri.TRI_DESCENDANT; |
} |
126,7 → 160,6 |
if(tri.equals("date_observation")) { |
rechercheParArguments.setTriParDate(modeTri); |
} |
} |
rechercheParArguments.setMotClef(tag); |
153,6 → 186,14 |
informationsRechercheObservation = rechercheParArguments; |
} |
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); |
305,6 → 346,9 |
InformationsRecherche infoRecherche; |
infoRecherche = cache.getInformationsRechercheImage(); |
if (CacheClient.getInstance().getProtocoleCourant() != null) { |
infoRecherche.setIdProtocoleSelectionne(""+CacheClient.getInstance().getProtocoleCourant().getId()); |
} |
argumentsRecherche = infoRecherche.versChaineRequete(); |
if(!GWT.isScript()) { |
311,23 → 355,25 |
argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+""; |
} |
argumentsRecherche += (argumentsRecherche.isEmpty()) ? "" : "&"; |
argumentsRecherche += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination(); |
argumentsRecherche = (argumentsRecherche.isEmpty()) ? argumentsRecherche : "?" + argumentsRecherche; |
arguments = argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_IMAGES; |
url = new Config().getUrl("del") + arguments; |
if (CacheClient.getInstance().getProtocoleCourant() != null) { |
url += "~"+String.valueOf(CacheClient.getInstance().getProtocoleCourant().getId()); |
} |
} else if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || cache.getPageCourante().equals("")) { |
InformationsRecherche infoRecherche; |
infoRecherche = cache.getInformationsRechercheObservation(); |
argumentsRecherche = "masque.type="+statut; |
argumentsRecherche += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination(); |
argumentsRecherche += "&"+infoRecherche.versChaineRequete(); |
if(!GWT.isScript()) { |
argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+""; |
} |
arguments = "?"+argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS; |
url = new Config().getUrl("del") + arguments; |
} else if (cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION) || cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION_PICTOFLORA)) { |
352,7 → 398,11 |
} |
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)) { |
$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl); |
} |
}-*/; |
} |
/trunk/src/org/tela_botanica/del/client/Del.java |
---|
34,7 → 34,7 |
History.fireCurrentHistoryState(); |
} |
private String buildStackTrace(Throwable t, String log) { |
/*private String buildStackTrace(Throwable t, String log) { |
if (t != null) { |
log += t.getClass().toString(); |
log += t.getMessage(); |
57,5 → 57,5 |
} |
} |
return log; |
}*/ |
} |
} |