Subversion Repositories eFlore/Applications.del

Rev

Rev 1501 | Rev 1549 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1501 Rev 1517
1
package org.tela_botanica.del.client.cache;
1
package org.tela_botanica.del.client.cache;
2
 
2
 
3
import java.util.Arrays;
3
import java.util.Arrays;
4
import java.util.List;
4
import java.util.List;
5
 
5
 
6
import org.tela_botanica.del.client.config.Config;
6
import org.tela_botanica.del.client.config.Config;
7
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
7
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
8
import org.tela_botanica.del.client.modeles.Image;
8
import org.tela_botanica.del.client.modeles.Image;
9
import org.tela_botanica.del.client.modeles.InformationsRecherche;
9
import org.tela_botanica.del.client.modeles.InformationsRecherche;
10
import org.tela_botanica.del.client.modeles.ModeTri;
10
import org.tela_botanica.del.client.modeles.ModeTri;
11
import org.tela_botanica.del.client.modeles.Observation;
11
import org.tela_botanica.del.client.modeles.Observation;
12
import org.tela_botanica.del.client.modeles.Protocole;
12
import org.tela_botanica.del.client.modeles.Protocole;
13
import org.tela_botanica.del.client.modeles.Utilisateur;
13
import org.tela_botanica.del.client.modeles.Utilisateur;
14
import org.tela_botanica.del.client.utils.URLUtils;
14
import org.tela_botanica.del.client.utils.URLUtils;
15
 
15
 
16
import com.google.gwt.core.client.GWT;
16
import com.google.gwt.core.client.GWT;
17
import com.google.gwt.user.client.Window;
17
import com.google.gwt.user.client.Window;
18
import com.google.gwt.user.client.Window.Location;
18
import com.google.gwt.user.client.Window.Location;
19
 
19
 
20
public class CacheClient {
20
public class CacheClient {
21
 
21
 
22
	private List<Protocole> listeProtocoles;
22
	private List<Protocole> listeProtocoles;
23
	
23
	
24
	private String home = ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
24
	private String home = ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
25
	private Observation observationCourante;
25
	private Observation observationCourante;
26
	private Image imageCourante;
26
	private Image imageCourante;
27
	private String taxonPourRechercheEflore;
27
	private String taxonPourRechercheEflore;
28
	private String idProtocoleEnAttente = null;
28
	private String idProtocoleEnAttente = null;
29
	private Protocole protocoleCourant;
29
	private Protocole protocoleCourant;
30
	private String referentielCourant;
30
	private String referentielCourant;
31
	private int numPageRechercheImage = 0;
31
	private int numPageRechercheImage = 0;
32
	private int nbTotalImagesRecherchees = 0;
32
	private int nbTotalImagesRecherchees = 0;
33
	
33
	
34
	private boolean referentielNonModifiable = false;
34
	private boolean referentielNonModifiable = false;
35
 
35
 
36
	private int pasPagination = 12;
36
	private int pasPagination = 12;
37
	private int pageCouranteRechercheImage = 1;
37
	private int pageCouranteRechercheImage = 1;
38
	private int pageCouranteRechercheObservations = 1;
38
	private int pageCouranteRechercheObservations = 1;
39
	private InformationsRecherche informationsRechercheImage;
39
	private InformationsRecherche informationsRechercheImage;
40
	private InformationsRecherche informationsRechercheObservation;
40
	private InformationsRecherche informationsRechercheObservation;
41
	private Utilisateur utilisateur;
41
	private Utilisateur utilisateur;
42
	private String pageCourante = home;
42
	private String pageCourante = home;
43
	private String statut;
43
	private String statut;
44
	private String[] statutsPossibles = {ConstantesNavigation.PARAM_TYPE_TOUS, 
44
	private String[] statutsPossibles = {ConstantesNavigation.PARAM_TYPE_TOUS, 
45
										ConstantesNavigation.PARAM_TYPE_A_DETERMINER,
45
										ConstantesNavigation.PARAM_TYPE_A_DETERMINER,
46
										ConstantesNavigation.PARAM_TYPE_EN_DISCUSSION,
46
										ConstantesNavigation.PARAM_TYPE_EN_DISCUSSION,
47
										ConstantesNavigation.PARAM_TYPE_VALIDEES};
47
										ConstantesNavigation.PARAM_TYPE_VALIDEES};
48
	
48
	
49
	public void supprimerFiltreStatut() {
49
	public void supprimerFiltreStatut() {
50
		this.statut = null;
50
		this.statut = null;
51
	}
51
	}
52
	
52
	
53
	public void setFiltreStatut(String statut) {
53
	public void setFiltreStatut(String statut) {
54
		this.statut = statut;
54
		this.statut = statut;
55
	}
55
	}
56
	
56
	
57
	public String getFiltreStatut() {
57
	public String getFiltreStatut() {
58
		return this.statut;
58
		return this.statut;
59
	}
59
	}
60
	
60
	
61
	public String getPageCourante() {
61
	public String getPageCourante() {
62
		return pageCourante;
62
		return pageCourante;
63
	}
63
	}
64
 
64
 
65
	public void setPageCourante(String pageCourante) {
65
	public void setPageCourante(String pageCourante) {
66
		this.pageCourante = pageCourante;
66
		this.pageCourante = pageCourante;
67
	}
67
	}
68
 
68
 
69
	private static CacheClient instance;
69
	private static CacheClient instance;
70
 
70
 
71
	private CacheClient() {
71
	private CacheClient() {
72
		instance = this;
72
		instance = this;
73
	}
73
	}
74
 
74
 
75
	public void initialiserAvecParametres() {
75
	public void initialiserAvecParametres() {
-
 
76
		
-
 
77
		if(Location.getPath().contains("identiplante")) {
-
 
78
			if(Location.getHash().contains(ConstantesNavigation.PAGE_VALIDATION)) {
-
 
79
				setPageCourante(ConstantesNavigation.PAGE_VALIDATION+"~"+URLUtils.getURLSpecialParameterValue());
-
 
80
			} else {
-
 
81
				setPageCourante(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS);
-
 
82
			}
-
 
83
		} else if(Location.getPath().contains("pictoflora")) {
-
 
84
			if(Location.getHash().contains(ConstantesNavigation.PAGE_VALIDATION_PICTOFLORA)) {
-
 
85
				setPageCourante(ConstantesNavigation.PAGE_VALIDATION+URLUtils.getURLSpecialParameterValue());
-
 
86
			} else {
-
 
87
				setPageCourante(ConstantesNavigation.PAGE_RECHERCHE_IMAGES);
-
 
88
			}
-
 
89
		}
-
 
90
		
76
		String rechercheLibre = Location.getParameter("masque");
91
		String rechercheLibre = Location.getParameter("masque");
77
		String famille = Location.getParameter("masque.famille");
92
		String famille = Location.getParameter("masque.famille");
78
		String taxon = Location.getParameter("masque.ns");
93
		String taxon = Location.getParameter("masque.ns");
79
		String genre = Location.getParameter("masque.genre");
94
		String genre = Location.getParameter("masque.genre");
80
		String commune = Location.getParameter("masque.commune");
95
		String commune = Location.getParameter("masque.commune");
81
		String dept = Location.getParameter("masque.departement");
96
		String dept = Location.getParameter("masque.departement");
82
		String auteur = Location.getParameter("masque.auteur");
97
		String auteur = Location.getParameter("masque.auteur");
83
		String date = Location.getParameter("masque.date");
98
		String date = Location.getParameter("masque.date");
84
		String tag = Location.getParameter("masque.tag");
99
		String tag = Location.getParameter("masque.tag");
85
		String tagCel = Location.getParameter("masque.tag_cel");
100
		String tagCel = Location.getParameter("masque.tag_cel");
86
		String tagDel = Location.getParameter("masque.tag_pictoflora");
101
		String tagDel = Location.getParameter("masque.tag_pictoflora");
87
		String referentiel = Location.getParameter("masque.referentiel");
102
		String referentiel = Location.getParameter("masque.referentiel");
88
		String protocole = Location.getParameter("protocole");
103
		String protocole = Location.getParameter("protocole");
89
		String statutParam = Location.getParameter("masque.type");
104
		String statutParam = Location.getParameter("masque.type");
90
		
105
		
91
		String page = Location.getParameter("page");
106
		String page = Location.getParameter("page");
92
		Integer pageInt = null;
107
		Integer pageInt = null;
93
		try {
108
		try {
94
			pageInt =  Integer.parseInt(page);
109
			pageInt =  Integer.parseInt(page);
95
		} catch (Exception e) {
110
		} catch (Exception e) {
96
			pageInt = null;
111
			pageInt = null;
97
		}
112
		}
98
		
113
		
99
		String pas = Location.getParameter("pas");	
114
		String pas = Location.getParameter("pas");	
100
		Integer pasInt = null;
115
		Integer pasInt = null;
101
		if(pas != null) {
116
		if(pas != null) {
102
			try {
117
			try {
103
				pasInt =  Integer.parseInt(pas);
118
				pasInt =  Integer.parseInt(pas);
104
			} catch (Exception e) {
119
			} catch (Exception e) {
105
				pasInt = null;
120
				pasInt = null;
106
			}
121
			}
107
		}
122
		}
108
		
123
		
109
		InformationsRecherche rechercheParArguments = new InformationsRecherche();
124
		InformationsRecherche rechercheParArguments = new InformationsRecherche();
110
		rechercheParArguments.setRechercheLibre(rechercheLibre);
125
		rechercheParArguments.setRechercheLibre(rechercheLibre);
111
		rechercheParArguments.setFamille(famille);
126
		rechercheParArguments.setFamille(famille);
112
		rechercheParArguments.setTaxon(taxon);
127
		rechercheParArguments.setTaxon(taxon);
113
		rechercheParArguments.setGenre(genre);
128
		rechercheParArguments.setGenre(genre);
114
		rechercheParArguments.setCommune(commune);
129
		rechercheParArguments.setCommune(commune);
115
		rechercheParArguments.setDepartement(dept);
130
		rechercheParArguments.setDepartement(dept);
116
		rechercheParArguments.setAuteur(auteur);
131
		rechercheParArguments.setAuteur(auteur);
117
		rechercheParArguments.setDate(date);
132
		rechercheParArguments.setDate(date);
118
		rechercheParArguments.setTag(tag);
133
		rechercheParArguments.setTag(tag);
119
		
134
		
120
		if(protocole != null && !protocole.equals("")) {
135
		if(protocole != null && !protocole.equals("")) {
121
			CacheClient.getInstance().setIdProtocoleEnAttente(protocole);
136
			CacheClient.getInstance().setIdProtocoleEnAttente(protocole);
122
			rechercheParArguments.setIdProtocoleSelectionne(protocole);
137
			rechercheParArguments.setIdProtocoleSelectionne(protocole);
123
		} else if(URLUtils.getURLSpecialParameterValue() != null) {
138
		} else if(URLUtils.getURLSpecialParameterValue() != null) {
124
			CacheClient.getInstance().setIdProtocoleEnAttente(URLUtils.getURLSpecialParameterValue());
139
			CacheClient.getInstance().setIdProtocoleEnAttente(URLUtils.getURLSpecialParameterValue());
125
			rechercheParArguments.setIdProtocoleSelectionne(URLUtils.getURLSpecialParameterValue());
140
			rechercheParArguments.setIdProtocoleSelectionne(URLUtils.getURLSpecialParameterValue());
126
		}
141
		}
127
		
142
		
128
		if(pasInt != null) setPasPagination(pasInt);
143
		if(pasInt != null) setPasPagination(pasInt);
129
				
144
				
130
		if(pageCourante.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
145
		if(pageCourante.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
131
			rechercheParArguments.setMotClefCel(tagCel);
146
			rechercheParArguments.setMotClefCel(tagCel);
132
			rechercheParArguments.setMotClefDel(tagDel);
147
			rechercheParArguments.setMotClefDel(tagDel);
133
			if(pageInt != null) setPageCouranteRechercheImages(pageInt);
148
			if(pageInt != null) setPageCouranteRechercheImages(pageInt);
134
		} else {
149
		} else {
135
			if(pageInt != null)	setPageCouranteRechercheObservations(pageInt);			
150
			if(pageInt != null)	setPageCouranteRechercheObservations(pageInt);			
136
		}
151
		}
137
		
-
 
138
		
152
		
139
		String tri = Location.getParameter("tri");		
153
		String tri = Location.getParameter("tri");		
140
		String ordre = Location.getParameter("ordre");
154
		String ordre = Location.getParameter("ordre");
141
		
155
		
142
		if(tri != null) {
156
		if(tri != null) {
143
			ModeTri modeTri = ModeTri.TRI_ASCENDANT;
157
			ModeTri modeTri = ModeTri.TRI_ASCENDANT;
144
			if(ordre != null && ordre.equals("asc")) {
158
			if(ordre != null && ordre.equals("asc")) {
145
				modeTri = ModeTri.TRI_ASCENDANT;
159
				modeTri = ModeTri.TRI_ASCENDANT;
146
			}
160
			}
147
			
161
			
148
			if(ordre != null && ordre.equals("desc")) {
162
			if(ordre != null && ordre.equals("desc")) {
149
				modeTri = ModeTri.TRI_DESCENDANT;
163
				modeTri = ModeTri.TRI_DESCENDANT;
150
			}
164
			}
151
			
165
			
152
			if(tri.equals("votes")) {
166
			if(tri.equals("votes")) {
153
				rechercheParArguments.setTriParNbVotes(modeTri);
167
				rechercheParArguments.setTriParNbVotes(modeTri);
154
			}
168
			}
155
			
169
			
156
			if(tri.equals("tags")) {
170
			if(tri.equals("tags")) {
157
				rechercheParArguments.setTriParNbTags(modeTri);
171
				rechercheParArguments.setTriParNbTags(modeTri);
158
			}
172
			}
159
			
173
			
160
			if(tri.equals("date_observation")) {
174
			if(tri.equals("date_observation")) {
161
				rechercheParArguments.setTriParDate(modeTri);
175
				rechercheParArguments.setTriParDate(modeTri);
162
			}			
176
			}			
163
		}
177
		}
164
		
178
		
165
		rechercheParArguments.setMotClef(tag);
179
		rechercheParArguments.setMotClef(tag);
166
		
180
		
167
		// si le référentiel est passé dans l'url alors il ne doit pas être modifiable
181
		// si le référentiel est passé dans l'url alors il ne doit pas être modifiable
168
		if(referentiel != null && !referentiel.equals("")) {
182
		if(referentiel != null && !referentiel.equals("")) {
169
			setReferentielCourant(referentiel);
183
			setReferentielCourant(referentiel);
170
			rechercheParArguments.setReferentiel(referentiel);
184
			rechercheParArguments.setReferentiel(referentiel);
171
			referentielNonModifiable = true;
185
			referentielNonModifiable = true;
172
		}
186
		}
173
		
187
		
174
		if(Location.getParameterMap().size() == 0) {
188
		if(Location.getParameterMap().size() == 0) {
175
			// par défaut l'application s'ouvre sur l'onglet à déterminer
189
			// par défaut l'application s'ouvre sur l'onglet à déterminer
176
			statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
190
			statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
177
		} else {
191
		} else {
178
			if(Arrays.asList(statutsPossibles).contains(statutParam)) {
192
			if(Arrays.asList(statutsPossibles).contains(statutParam)) {
179
				statut = statutParam;
193
				statut = statutParam;
180
			} else {
194
			} else {
181
				statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
195
				statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
182
			}
196
			}
183
		}
197
		}
184
		
198
		
185
		informationsRechercheImage = rechercheParArguments;
199
		informationsRechercheImage = rechercheParArguments;
186
		informationsRechercheObservation = rechercheParArguments;
200
		informationsRechercheObservation = rechercheParArguments;
-
 
201
		
-
 
202
		mettreAjourUrlCourante();
187
	}
203
	}
188
	
204
	
189
	public void setIdProtocoleEnAttente(String idProtocole) {
205
	public void setIdProtocoleEnAttente(String idProtocole) {
190
		idProtocoleEnAttente = idProtocole;
206
		idProtocoleEnAttente = idProtocole;
191
	}
207
	}
192
	
208
	
193
	public String getIdProtocoleEnAttente() {
209
	public String getIdProtocoleEnAttente() {
194
		return idProtocoleEnAttente;
210
		return idProtocoleEnAttente;
195
	}
211
	}
196
 
212
 
197
	public Utilisateur getUtilisateur() {
213
	public Utilisateur getUtilisateur() {
198
		if (this.utilisateur == null) {
214
		if (this.utilisateur == null) {
199
			this.utilisateur = new Utilisateur(null, null);
215
			this.utilisateur = new Utilisateur(null, null);
200
		}
216
		}
201
		return this.utilisateur;
217
		return this.utilisateur;
202
	}
218
	}
203
	
219
	
204
	public void setUtilisateur(Utilisateur utilisateur) {
220
	public void setUtilisateur(Utilisateur utilisateur) {
205
		this.utilisateur = utilisateur; 
221
		this.utilisateur = utilisateur; 
206
	}
222
	}
207
	
223
	
208
	public void setHome(String home) {
224
	public void setHome(String home) {
209
		this.home = home;
225
		this.home = home;
210
		setPageCourante(home);
226
		setPageCourante(home);
211
	}
227
	}
212
	
228
	
213
	public String getHome() {
229
	public String getHome() {
214
		return home;
230
		return home;
215
	}
231
	}
216
	
232
	
217
	public Observation getObservationCourante() {
233
	public Observation getObservationCourante() {
218
		return observationCourante;
234
		return observationCourante;
219
	}
235
	}
220
 
236
 
221
	public void setObservationCourante(Observation observationCourante) {
237
	public void setObservationCourante(Observation observationCourante) {
222
		this.observationCourante = observationCourante;
238
		this.observationCourante = observationCourante;
223
	}
239
	}
224
 
240
 
225
	public static CacheClient getInstance() {
241
	public static CacheClient getInstance() {
226
		if (instance == null) {
242
		if (instance == null) {
227
			instance = new CacheClient();
243
			instance = new CacheClient();
228
		}
244
		}
229
		return instance;
245
		return instance;
230
	}
246
	}
231
 
247
 
232
	public String getTaxonPourRechercheEflore() {
248
	public String getTaxonPourRechercheEflore() {
233
		return taxonPourRechercheEflore;
249
		return taxonPourRechercheEflore;
234
	}
250
	}
235
 
251
 
236
	public void setTaxonPourRechercheEflore(String taxonPourRechercheEflore) {
252
	public void setTaxonPourRechercheEflore(String taxonPourRechercheEflore) {
237
		this.taxonPourRechercheEflore = taxonPourRechercheEflore;
253
		this.taxonPourRechercheEflore = taxonPourRechercheEflore;
238
	}
254
	}
239
 
255
 
240
	public int getNumPageRechercheImage() {
256
	public int getNumPageRechercheImage() {
241
		return numPageRechercheImage;
257
		return numPageRechercheImage;
242
	}
258
	}
243
 
259
 
244
	// Pour la recherche :
260
	// Pour la recherche :
245
	public int getPasPagination() {
261
	public int getPasPagination() {
246
		return pasPagination;
262
		return pasPagination;
247
	}
263
	}
248
 
264
 
249
	public void setPasPagination(int pasPagination) {
265
	public void setPasPagination(int pasPagination) {
250
		this.pasPagination = pasPagination;
266
		this.pasPagination = pasPagination;
251
	}
267
	}
252
 
268
 
253
	public void setPageCouranteRechercheImages(int pageCouranteRecherche) {
269
	public void setPageCouranteRechercheImages(int pageCouranteRecherche) {
254
		this.pageCouranteRechercheImage = pageCouranteRecherche;
270
		this.pageCouranteRechercheImage = pageCouranteRecherche;
255
	}
271
	}
256
 
272
 
257
	public int getPageCouranteRechercheImage() {
273
	public int getPageCouranteRechercheImage() {
258
		return this.pageCouranteRechercheImage;
274
		return this.pageCouranteRechercheImage;
259
	}
275
	}
260
 
276
 
261
	public void setNbTotalImagesRecherchees(int nbTotalImagesRecherchees) {
277
	public void setNbTotalImagesRecherchees(int nbTotalImagesRecherchees) {
262
		this.nbTotalImagesRecherchees = nbTotalImagesRecherchees;
278
		this.nbTotalImagesRecherchees = nbTotalImagesRecherchees;
263
	}
279
	}
264
 
280
 
265
	public int getNbTotalImagesRecherchees() {
281
	public int getNbTotalImagesRecherchees() {
266
		return this.nbTotalImagesRecherchees;
282
		return this.nbTotalImagesRecherchees;
267
	}
283
	}
268
 
284
 
269
	public Image getImageCourante() {
285
	public Image getImageCourante() {
270
		return imageCourante;
286
		return imageCourante;
271
	}
287
	}
272
 
288
 
273
	public void setImageCourante(Image imageCourante) {
289
	public void setImageCourante(Image imageCourante) {
274
		this.imageCourante = imageCourante;
290
		this.imageCourante = imageCourante;
275
	}
291
	}
276
	
292
	
277
	public void setListeProtocoles(List<Protocole> listeProtocole) {
293
	public void setListeProtocoles(List<Protocole> listeProtocole) {
278
		this.listeProtocoles = listeProtocole;
294
		this.listeProtocoles = listeProtocole;
279
	}
295
	}
280
	
296
	
281
	public List<Protocole> getListeProtocoles() {
297
	public List<Protocole> getListeProtocoles() {
282
		return this.listeProtocoles;
298
		return this.listeProtocoles;
283
	}
299
	}
284
 
300
 
285
	public Protocole getProtocoleCourant() {
301
	public Protocole getProtocoleCourant() {
286
		return protocoleCourant;
302
		return protocoleCourant;
287
	}
303
	}
288
 
304
 
289
	public void setProtocoleCourant(Protocole protocoleCourant) {
305
	public void setProtocoleCourant(Protocole protocoleCourant) {
290
		this.protocoleCourant = protocoleCourant;
306
		this.protocoleCourant = protocoleCourant;
291
	}
307
	}
292
 
308
 
293
	public InformationsRecherche getInformationsRechercheImage() {
309
	public InformationsRecherche getInformationsRechercheImage() {
294
		if(informationsRechercheImage == null) {
310
		if(informationsRechercheImage == null) {
295
			informationsRechercheImage = new InformationsRecherche();
311
			informationsRechercheImage = new InformationsRecherche();
296
		}
312
		}
297
		return informationsRechercheImage;
313
		return informationsRechercheImage;
298
	}
314
	}
299
 
315
 
300
	public InformationsRecherche getInformationsRechercheObservation() {
316
	public InformationsRecherche getInformationsRechercheObservation() {
301
		if(informationsRechercheObservation == null) {
317
		if(informationsRechercheObservation == null) {
302
			informationsRechercheObservation = new InformationsRecherche();
318
			informationsRechercheObservation = new InformationsRecherche();
303
		}
319
		}
304
		return informationsRechercheObservation;
320
		return informationsRechercheObservation;
305
	}
321
	}
306
 
322
 
307
	public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
323
	public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
308
		this.informationsRechercheImage = informationsRechercheImage;
324
		this.informationsRechercheImage = informationsRechercheImage;
309
	}
325
	}
310
 
326
 
311
	public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
327
	public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
312
		this.informationsRechercheObservation = informationsRechercheObservation;
328
		this.informationsRechercheObservation = informationsRechercheObservation;
313
	}
329
	}
314
 
330
 
315
	public int getPageCouranteRechercheObservations() {
331
	public int getPageCouranteRechercheObservations() {
316
		return pageCouranteRechercheObservations;
332
		return pageCouranteRechercheObservations;
317
	}
333
	}
318
 
334
 
319
	public void setPageCouranteRechercheObservations(int pageCouranteRechercheObservations) {
335
	public void setPageCouranteRechercheObservations(int pageCouranteRechercheObservations) {
320
		this.pageCouranteRechercheObservations = pageCouranteRechercheObservations;
336
		this.pageCouranteRechercheObservations = pageCouranteRechercheObservations;
321
	}
337
	}
322
	
338
	
323
	public void setReferentielCourant(String referentielCourant) {
339
	public void setReferentielCourant(String referentielCourant) {
324
		this.referentielCourant = referentielCourant;
340
		this.referentielCourant = referentielCourant;
325
	}
341
	}
326
	
342
	
327
	public String getReferentielCourant() {
343
	public String getReferentielCourant() {
328
		return referentielCourant;
344
		return referentielCourant;
329
	}
345
	}
330
	
346
	
331
	public void setReferentielNonModifiable(boolean referentielNonModifiable) {
347
	public void setReferentielNonModifiable(boolean referentielNonModifiable) {
332
		this.referentielNonModifiable = referentielNonModifiable;
348
		this.referentielNonModifiable = referentielNonModifiable;
333
	}
349
	}
334
	
350
	
335
	public boolean getReferentielNonModifiable() {
351
	public boolean getReferentielNonModifiable() {
336
		return referentielNonModifiable;
352
		return referentielNonModifiable;
337
	}
353
	}
338
	
354
	
339
	public String genererUrlCourante() {
355
	public String genererUrlCourante() {
340
		String url = Window.Location.getHref();
356
		String url = Window.Location.getHref();
341
		CacheClient cache = CacheClient.getInstance();
-
 
342
		
-
 
343
		String arguments = "";
357
		String arguments = "";
344
		String argumentsRecherche = "";
358
		String argumentsRecherche = "";
-
 
359
		
345
		if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
360
		if (getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
346
			
361
			
347
			InformationsRecherche infoRecherche;
362
			InformationsRecherche infoRecherche;
348
			infoRecherche = cache.getInformationsRechercheImage();
363
			infoRecherche = getInformationsRechercheImage();
349
			if (CacheClient.getInstance().getProtocoleCourant() != null) {
364
			if (CacheClient.getInstance().getProtocoleCourant() != null) {
350
				infoRecherche.setIdProtocoleSelectionne(""+CacheClient.getInstance().getProtocoleCourant().getId());
365
				infoRecherche.setIdProtocoleSelectionne(""+CacheClient.getInstance().getProtocoleCourant().getId());
351
			}
366
			}
352
			argumentsRecherche = infoRecherche.versChaineRequete();
367
			argumentsRecherche = infoRecherche.versChaineRequete();
353
			
368
			
354
			if(!GWT.isScript()) {
369
			if(!GWT.isScript()) {
355
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
370
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
356
			}
371
			}
357
			
372
			
358
			argumentsRecherche += (argumentsRecherche.isEmpty()) ? "" : "&";
373
			argumentsRecherche += (argumentsRecherche.isEmpty()) ? "" : "&";
359
			argumentsRecherche += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination();
374
			argumentsRecherche += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination();
360
			
375
			
361
			argumentsRecherche = (argumentsRecherche.isEmpty()) ? argumentsRecherche : "?" + argumentsRecherche;
376
			argumentsRecherche = (argumentsRecherche.isEmpty()) ? argumentsRecherche : "?" + argumentsRecherche;
362
			arguments = argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_IMAGES;
377
			arguments = argumentsRecherche;
363
			url = new Config().getUrl("del") + arguments;
378
			url = new Config().getUrl("pictoflora") + arguments;
364
 
-
 
-
 
379
			url += "#"+ConstantesNavigation.PAGE_RECHERCHE_IMAGES;
365
		} else if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || cache.getPageCourante().equals("")) {
380
		} else if (getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || getPageCourante().equals("")) {
366
			
381
			
367
			InformationsRecherche infoRecherche;
382
			InformationsRecherche infoRecherche;
368
			infoRecherche = cache.getInformationsRechercheObservation();
383
			infoRecherche = getInformationsRechercheObservation();
369
			argumentsRecherche = "masque.type="+statut;
384
			argumentsRecherche = "masque.type="+statut;
370
			argumentsRecherche += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination();
385
			argumentsRecherche += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination();
371
			argumentsRecherche += "&"+infoRecherche.versChaineRequete();
386
			argumentsRecherche += "&"+infoRecherche.versChaineRequete();
372
			
387
			
373
			if(!GWT.isScript()) {
388
			if(!GWT.isScript()) {
374
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
389
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
375
			}
390
			}
376
			
391
			
377
			arguments = "?"+argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
392
			arguments = "?"+argumentsRecherche;
-
 
393
			url = new Config().getUrl("identiplante") + arguments;
378
			url = new Config().getUrl("del") + arguments;
394
			url += "#"+ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
379
		} else if (cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION) || cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION_PICTOFLORA)) {
395
		} else if (getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION) || getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION_PICTOFLORA)) {
-
 
396
			url = new Config().getUrl("del");
-
 
397
			if(getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION)) {
-
 
398
				url = new Config().getUrl("identiplante");
-
 
399
			} else {
-
 
400
				url = new Config().getUrl("pictoflora");
380
			url = new Config().getUrl("del");
401
			}
381
			if(!GWT.isScript()) {
402
			if(!GWT.isScript()) {
382
				url += "?gwt.codesvr="+Location.getParameter("gwt.codesvr");
403
				url += "?gwt.codesvr="+Location.getParameter("gwt.codesvr");
383
			}
404
			}
384
			url += "#"+cache.getPageCourante();
405
			url += "#"+getPageCourante();
385
		}
406
		}
386
		// remplacements batards pour corriger l'url
407
		// remplacements batards pour corriger l'url
387
		// TODO: factoriser toute la fonction 
408
		// TODO: factoriser toute la fonction 
388
		url = url.replaceAll("&#", "#");
409
		url = url.replaceAll("&#", "#");
389
		url = url.replaceAll("&&", "&");
410
		url = url.replaceAll("&&", "&");
390
		url = url.replaceAll("\\?&", "?");
411
		url = url.replaceAll("\\?&", "?");
391
		
412
		
392
		return url;
413
		return url;
393
	}
414
	}
394
	
415
	
395
	
416
	
396
	public void mettreAjourUrlCourante() {
417
	public void mettreAjourUrlCourante() {
397
		mettreAJourUrlCouranteSansRecharger(genererUrlCourante());
418
		mettreAJourUrlCouranteSansRecharger(genererUrlCourante());
398
	}
419
	}
399
	
420
	
400
	private static native void mettreAJourUrlCouranteSansRecharger(String nouvelleUrl) /*-{
421
	private static native void mettreAJourUrlCouranteSansRecharger(String nouvelleUrl) /*-{
401
		// javascript double negative trick
422
		// javascript double negative trick
402
		// pour plus d'info http://stackoverflow.com/questions/4686583/can-someone-explain-this-double-negative-trick
423
		// pour plus d'info http://stackoverflow.com/questions/4686583/can-someone-explain-this-double-negative-trick
403
		if(!!($wnd.history && $wnd.history.pushState)) {
424
		if(!!($wnd.history && $wnd.history.pushState)) {
404
    		$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl);
425
    		$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl);
405
    	}
426
    	}
406
	}-*/;
427
	}-*/;	
407
	
-
 
408
}
428
}