Subversion Repositories eFlore/Applications.del

Rev

Rev 491 | Rev 566 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 491 Rev 564
Line 64... Line 64...
64
		public int getPasSelectionne();
64
		public int getPasSelectionne();
Line 65... Line 65...
65
 
65
 
Line 66... Line 66...
66
		public void afficherPas(int pas);
66
		public void afficherPas(int pas);
67
 
67
 
68
		public void mettreEnValeurPageActive(int pageActive);
68
		public void mettreEnValeurPageActive(int pageActive);
69
		
69
 
Line 70... Line 70...
70
		public void mettreNbTotalPages(int nbPages);
70
		public void mettreNbTotalPages(int nbPages);
71
	}
71
	}
72
 
72
 
73
	private Vue vue;
73
	private Vue vue;
74
	private int nbPage = 1;
74
	private int nbPage = 1;
75
	private int pageCourante = 1;
75
	private int pageCourante = 1;
76
	private int nbElementsTotal = 0;
76
	private int nbElementsTotal = 0;
Line 77... Line 77...
77
	private int pas = 10;
77
	private int pas = 10;
78
	
78
 
79
	private String groupePagination = null;
79
	private String groupePagination = null;
Line 149... Line 149...
149
 
149
 
Line 150... Line 150...
150
		BusEvenementiel.getInstance().addHandler(EvenementChangementPage.TYPE, new GestionnaireEvenementChangementPage() {
150
		BusEvenementiel.getInstance().addHandler(EvenementChangementPage.TYPE, new GestionnaireEvenementChangementPage() {
151
 
151
 
152
			@Override
152
			@Override
153
			public void onChangementPage(EvenementChangementPage event) {
153
			public void onChangementPage(EvenementChangementPage event) {
154
				if(event.getGroupePagination() == groupePagination) {
154
				if (event.getGroupePagination() == groupePagination) {
155
					pageCourante = event.getPageAAfficher();
155
					pageCourante = event.getPageAAfficher();
156
					mettreEnValeurPageCourante();
156
					mettreEnValeurPageCourante();
157
				}
157
				}
Line 158... Line 158...
158
			}
158
			}
Line 159... Line 159...
159
		});
159
		});
160
 
160
 
161
		BusEvenementiel.getInstance().addHandler(EvenementChangementPas.TYPE, new GestionnaireEvenementChangementPas() {
161
		BusEvenementiel.getInstance().addHandler(EvenementChangementPas.TYPE, new GestionnaireEvenementChangementPas() {
162
 
162
 
163
			@Override
163
			@Override
164
			public void onChangementPas(EvenementChangementPas event) {
164
			public void onChangementPas(EvenementChangementPas event) {
165
				if(event.getGroupePagination() == groupePagination) {
165
				if (event.getGroupePagination() == groupePagination) {
166
					// modifie le pas et les liens en fonction
166
					// modifie le pas et les liens en fonction
167
					pas = event.getPas();
167
					pas = event.getPas();
168
					actualiserPas();
168
					actualiserPas();
169
					actualiserLiensPagesPagination();
169
					actualiserLiensPagesPagination();
170
				}
170
				}
171
			}
171
			}
172
		});
172
		});
173
	}
173
	}
174
	
174
 
175
	private void gererDecalagePageCourante(int ancienPas, int nouveauPas) {	
175
	private void gererDecalagePageCourante(int ancienPas, int nouveauPas) {
176
		if(ancienPas != nouveauPas) {
176
		if (ancienPas != nouveauPas) {
177
			double rapportPas = (double)ancienPas/(double)nouveauPas;
177
			double rapportPas = (double) ancienPas / (double) nouveauPas;
178
			pageCourante = (int)(Math.ceil((double)pageCourante*(double)rapportPas));
178
			pageCourante = (int) (Math.ceil((double) pageCourante * (double) rapportPas));
179
		}
179
		}
180
	}
180
	}
181
	
181
 
182
	/**
182
	/**
Line 235... Line 235...
235
	}
235
	}
Line 236... Line 236...
236
 
236
 
237
	public void setPageCourante(int pageCourante) {
237
	public void setPageCourante(int pageCourante) {
238
		this.pageCourante = pageCourante;
238
		this.pageCourante = pageCourante;
239
	}
239
	}
240
	
240
 
-
 
241
	public void changerPas(int nouveauPas) {
-
 
242
 
241
	public void changerPas(int nouveauPas) {
243
		// TODO corriger bug qui ne charge pas la bonne page ds certains cas
-
 
244
		// gererDecalagePageCourante(pas, nouveauPas);
-
 
245
		// pas = nouveauPas;
242
		gererDecalagePageCourante(pas, nouveauPas);
246
		// chargerElements((pageCourante - 1)*pas, pageCourante*pas);
243
		pas = nouveauPas;
247
		pas = nouveauPas;
244
		chargerElements((pageCourante - 1)*pas, pageCourante*pas);
248
		chargerElements(0, pas);
245
		BusEvenementiel.getInstance().fireEvent(new EvenementChangementPas(nouveauPas, groupePagination));
249
		BusEvenementiel.getInstance().fireEvent(new EvenementChangementPas(nouveauPas, groupePagination));
246
		BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(1, groupePagination));
-
 
247
		//BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(pageCourante, groupePagination));
250
		BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(1, groupePagination));
Line 248... Line 251...
248
	}
251
	}
249
 
252
 
250
	public void allerALaPagePrecedente() {
253
	public void allerALaPagePrecedente() {
Line 256... Line 259...
256
		}
259
		}
Line 257... Line 260...
257
 
260
 
Line 258... Line 261...
258
	}
261
	}
259
 
262
 
260
	public void allerALapageSuivante() {
263
	public void allerALapageSuivante() {
261
		if (pageCourante < nbPage ) {
264
		if (pageCourante < nbPage) {
262
			int pageAAfficher = pageCourante + 1;
265
			int pageAAfficher = pageCourante + 1;
263
			pageCourante = pageAAfficher;
266
			pageCourante = pageAAfficher;
264
			chargerElements(pas * (pageAAfficher - 1), pas * (pageAAfficher));
267
			chargerElements(pas * (pageAAfficher - 1), pas * (pageAAfficher));
Line 272... Line 275...
272
		chargerElements(0, pas);
275
		chargerElements(0, pas);
273
		BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(pageAAfficher, groupePagination));
276
		BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(pageAAfficher, groupePagination));
274
	}
277
	}
Line 275... Line 278...
275
 
278
 
276
	public void allerAlaDernierePage() {
279
	public void allerAlaDernierePage() {
277
		int pageAAfficher = nbPage ;
280
		int pageAAfficher = nbPage;
278
		pageCourante = pageAAfficher;
281
		pageCourante = pageAAfficher;
279
		chargerElements(pas * (pageAAfficher - 1), pas * (pageAAfficher));
282
		chargerElements(pas * (pageAAfficher - 1), pas * (pageAAfficher));
280
		BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(pageAAfficher, groupePagination));
283
		BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(pageAAfficher, groupePagination));
Line 307... Line 310...
307
	public abstract void actualiserPasCache(int pas);
310
	public abstract void actualiserPasCache(int pas);
Line 308... Line 311...
308
 
311
 
309
	public void setPas(int pas) {
312
	public void setPas(int pas) {
310
		this.pas = pas;
313
		this.pas = pas;
311
	}
314
	}
312
	
315
 
313
	public void setGroupePagination(String groupePagination) {
316
	public void setGroupePagination(String groupePagination) {
314
		this.groupePagination = groupePagination;
317
		this.groupePagination = groupePagination;
315
	}
318
	}
316
	
319
 
317
	public String getGroupePagination() {
320
	public String getGroupePagination() {
318
		return groupePagination;
321
		return groupePagination;
Line 319... Line 322...
319
	}
322
	}