Subversion Repositories eFlore/Applications.del

Rev

Rev 1314 | Rev 1426 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9 benjamin 1
package org.tela_botanica.del.client.cache;
2
 
814 aurelien 3
import java.util.List;
4
 
1092 gduche 5
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
147 benjamin 6
import org.tela_botanica.del.client.modeles.Image;
335 benjamin 7
import org.tela_botanica.del.client.modeles.InformationsRecherche;
9 benjamin 8
import org.tela_botanica.del.client.modeles.Observation;
178 benjamin 9
import org.tela_botanica.del.client.modeles.Protocole;
537 gduche 10
import org.tela_botanica.del.client.modeles.Utilisateur;
9 benjamin 11
 
1118 gduche 12
import com.google.gwt.user.client.Window.Location;
13
 
14 benjamin 14
public class CacheClient {
9 benjamin 15
 
814 aurelien 16
	private List<Protocole> listeProtocoles;
17
 
1092 gduche 18
	private String home = ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
230 gduche 19
	private Observation observationCourante;
147 benjamin 20
	private Image imageCourante;
73 benjamin 21
	private String taxonPourRechercheEflore;
178 benjamin 22
	private Protocole protocoleCourant;
1367 aurelien 23
	private String referentielCourant;
147 benjamin 24
	private int numPageRechercheImage = 0;
349 aurelien 25
	private int nbTotalImagesRecherchees = 0;
1367 aurelien 26
 
27
	private boolean referentielNonModifiable = false;
335 benjamin 28
 
579 gduche 29
	private int pasPagination = 12;
445 benjamin 30
	private int pageCouranteRechercheImage = 1;
31
	private int pageCouranteRechercheObservations = 1;
335 benjamin 32
	private InformationsRecherche informationsRechercheImage;
33
	private InformationsRecherche informationsRechercheObservation;
537 gduche 34
	private Utilisateur utilisateur;
1129 gduche 35
	private String pageCourante = home;
1234 gduche 36
	private String statut;
1129 gduche 37
 
1234 gduche 38
	public void supprimerFiltreStatut() {
39
		this.statut = null;
40
	}
41
 
42
	public void setFiltreStatut(String statut) {
43
		this.statut = statut;
44
	}
45
 
46
	public String getFiltreStatut() {
47
		return this.statut;
48
	}
49
 
1129 gduche 50
	public String getPageCourante() {
51
		return pageCourante;
52
	}
335 benjamin 53
 
1129 gduche 54
	public void setPageCourante(String pageCourante) {
55
		this.pageCourante = pageCourante;
56
	}
57
 
14 benjamin 58
	private static CacheClient instance;
9 benjamin 59
 
14 benjamin 60
	private CacheClient() {
9 benjamin 61
		instance = this;
62
	}
63
 
1118 gduche 64
	public void initialiserAvecParametres() {
1129 gduche 65
		String rechercheLibre = Location.getParameter("masque");
66
		String famille = Location.getParameter("masque.famille");
67
		String taxon = Location.getParameter("masque.ns");
68
		String genre = Location.getParameter("masque.genre");
69
		String commune = Location.getParameter("masque.commune");
70
		String dept = Location.getParameter("masque.departement");
71
		String auteur = Location.getParameter("masque.auteur");
72
		String date = Location.getParameter("masque.date");
73
		String tag = Location.getParameter("masque.tag");
1367 aurelien 74
		String referentiel = Location.getParameter("masque.referentiel");
1118 gduche 75
 
76
		InformationsRecherche rechercheParArguments = new InformationsRecherche();
77
		rechercheParArguments.setRechercheLibre(rechercheLibre);
78
		rechercheParArguments.setFamille(famille);
79
		rechercheParArguments.setTaxon(taxon);
80
		rechercheParArguments.setGenre(genre);
81
		rechercheParArguments.setCommune(commune);
82
		rechercheParArguments.setDepartement(dept);
83
		rechercheParArguments.setAuteur(auteur);
84
		rechercheParArguments.setDate(date);
85
		rechercheParArguments.setTag(tag);
86
		rechercheParArguments.setMotClef(tag);
87
 
1367 aurelien 88
		// si le référentiel est passé dans l'url alors il ne doit pas être modifiable
89
		if(referentiel != null && !referentiel.equals("")) {
90
			setReferentielCourant(referentiel);
91
			rechercheParArguments.setReferentiel(referentiel);
92
			referentielNonModifiable = true;
93
		}
94
 
1118 gduche 95
		informationsRechercheImage = rechercheParArguments;
96
		informationsRechercheObservation = rechercheParArguments;
97
	}
98
 
537 gduche 99
	public Utilisateur getUtilisateur() {
100
		if (this.utilisateur == null) {
101
			this.utilisateur = new Utilisateur(null);
102
		}
103
		return this.utilisateur;
104
	}
105
 
106
	public void setUtilisateur(Utilisateur utilisateur) {
107
		this.utilisateur = utilisateur;
108
	}
109
 
1092 gduche 110
	public void setHome(String home) {
111
		this.home = home;
1129 gduche 112
		setPageCourante(home);
1092 gduche 113
	}
114
 
115
	public String getHome() {
116
		return home;
117
	}
118
 
230 gduche 119
	public Observation getObservationCourante() {
120
		return observationCourante;
9 benjamin 121
	}
122
 
230 gduche 123
	public void setObservationCourante(Observation observationCourante) {
124
		this.observationCourante = observationCourante;
9 benjamin 125
	}
126
 
14 benjamin 127
	public static CacheClient getInstance() {
9 benjamin 128
		if (instance == null) {
14 benjamin 129
			instance = new CacheClient();
9 benjamin 130
		}
131
		return instance;
132
	}
133
 
73 benjamin 134
	public String getTaxonPourRechercheEflore() {
135
		return taxonPourRechercheEflore;
136
	}
137
 
138
	public void setTaxonPourRechercheEflore(String taxonPourRechercheEflore) {
139
		this.taxonPourRechercheEflore = taxonPourRechercheEflore;
140
	}
141
 
147 benjamin 142
	public int getNumPageRechercheImage() {
143
		return numPageRechercheImage;
144
	}
145
 
335 benjamin 146
	// Pour la recherche :
311 gduche 147
	public int getPasPagination() {
148
		return pasPagination;
147 benjamin 149
	}
335 benjamin 150
 
311 gduche 151
	public void setPasPagination(int pasPagination) {
152
		this.pasPagination = pasPagination;
147 benjamin 153
	}
335 benjamin 154
 
358 benjamin 155
	public void setPageCouranteRechercheImages(int pageCouranteRecherche) {
156
		this.pageCouranteRechercheImage = pageCouranteRecherche;
311 gduche 157
	}
335 benjamin 158
 
358 benjamin 159
	public int getPageCouranteRechercheImage() {
160
		return this.pageCouranteRechercheImage;
311 gduche 161
	}
147 benjamin 162
 
349 aurelien 163
	public void setNbTotalImagesRecherchees(int nbTotalImagesRecherchees) {
164
		this.nbTotalImagesRecherchees = nbTotalImagesRecherchees;
165
	}
361 benjamin 166
 
349 aurelien 167
	public int getNbTotalImagesRecherchees() {
168
		return this.nbTotalImagesRecherchees;
169
	}
147 benjamin 170
 
171
	public Image getImageCourante() {
172
		return imageCourante;
173
	}
174
 
175
	public void setImageCourante(Image imageCourante) {
176
		this.imageCourante = imageCourante;
177
	}
814 aurelien 178
 
179
	public void setListeProtocoles(List<Protocole> listeProtocole) {
180
		this.listeProtocoles = listeProtocole;
181
	}
182
 
183
	public List<Protocole> getListeProtocoles() {
184
		return this.listeProtocoles;
185
	}
147 benjamin 186
 
178 benjamin 187
	public Protocole getProtocoleCourant() {
188
		return protocoleCourant;
189
	}
190
 
191
	public void setProtocoleCourant(Protocole protocoleCourant) {
192
		this.protocoleCourant = protocoleCourant;
193
	}
194
 
335 benjamin 195
	public InformationsRecherche getInformationsRechercheImage() {
467 aurelien 196
		if(informationsRechercheImage == null) {
197
			informationsRechercheImage = new InformationsRecherche();
198
		}
335 benjamin 199
		return informationsRechercheImage;
200
	}
201
 
202
	public InformationsRecherche getInformationsRechercheObservation() {
467 aurelien 203
		if(informationsRechercheObservation == null) {
204
			informationsRechercheObservation = new InformationsRecherche();
205
		}
335 benjamin 206
		return informationsRechercheObservation;
207
	}
208
 
209
	public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
210
		this.informationsRechercheImage = informationsRechercheImage;
211
	}
212
 
213
	public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
214
		this.informationsRechercheObservation = informationsRechercheObservation;
215
	}
216
 
358 benjamin 217
	public int getPageCouranteRechercheObservations() {
218
		return pageCouranteRechercheObservations;
219
	}
220
 
221
	public void setPageCouranteRechercheObservations(int pageCouranteRechercheObservations) {
222
		this.pageCouranteRechercheObservations = pageCouranteRechercheObservations;
223
	}
1367 aurelien 224
 
225
	public void setReferentielCourant(String referentielCourant) {
226
		this.referentielCourant = referentielCourant;
227
	}
228
 
229
	public String getReferentielCourant() {
230
		return referentielCourant;
231
	}
232
 
233
	public void setReferentielNonModifiable(boolean referentielNonModifiable) {
234
		this.referentielNonModifiable = referentielNonModifiable;
235
	}
236
 
237
	public boolean getReferentielNonModifiable() {
238
		return referentielNonModifiable;
239
	}
9 benjamin 240
}