Subversion Repositories eFlore/Applications.del

Rev

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

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