66,7 → 66,7 |
public void afficherPas(int pas); |
|
public void mettreEnValeurPageActive(int pageActive); |
|
|
public void mettreNbTotalPages(int nbPages); |
} |
|
75,7 → 75,7 |
private int pageCourante = 1; |
private int nbElementsTotal = 0; |
private int pas = 10; |
|
|
private String groupePagination = null; |
|
/** |
151,7 → 151,7 |
|
@Override |
public void onChangementPage(EvenementChangementPage event) { |
if(event.getGroupePagination() == groupePagination) { |
if (event.getGroupePagination() == groupePagination) { |
pageCourante = event.getPageAAfficher(); |
mettreEnValeurPageCourante(); |
} |
162,7 → 162,7 |
|
@Override |
public void onChangementPas(EvenementChangementPas event) { |
if(event.getGroupePagination() == groupePagination) { |
if (event.getGroupePagination() == groupePagination) { |
// modifie le pas et les liens en fonction |
pas = event.getPas(); |
actualiserPas(); |
171,14 → 171,14 |
} |
}); |
} |
|
private void gererDecalagePageCourante(int ancienPas, int nouveauPas) { |
if(ancienPas != nouveauPas) { |
double rapportPas = (double)ancienPas/(double)nouveauPas; |
pageCourante = (int)(Math.ceil((double)pageCourante*(double)rapportPas)); |
|
private void gererDecalagePageCourante(int ancienPas, int nouveauPas) { |
if (ancienPas != nouveauPas) { |
double rapportPas = (double) ancienPas / (double) nouveauPas; |
pageCourante = (int) (Math.ceil((double) pageCourante * (double) rapportPas)); |
} |
} |
|
|
/** |
* Gérer les évènements sur les boutons dynamiques (qui sont recréés à |
* chaque fois) |
237,14 → 237,17 |
public void setPageCourante(int pageCourante) { |
this.pageCourante = pageCourante; |
} |
|
|
public void changerPas(int nouveauPas) { |
gererDecalagePageCourante(pas, nouveauPas); |
|
// TODO corriger bug qui ne charge pas la bonne page ds certains cas |
// gererDecalagePageCourante(pas, nouveauPas); |
// pas = nouveauPas; |
// chargerElements((pageCourante - 1)*pas, pageCourante*pas); |
pas = nouveauPas; |
chargerElements((pageCourante - 1)*pas, pageCourante*pas); |
chargerElements(0, pas); |
BusEvenementiel.getInstance().fireEvent(new EvenementChangementPas(nouveauPas, groupePagination)); |
BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(1, groupePagination)); |
//BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(pageCourante, groupePagination)); |
} |
|
public void allerALaPagePrecedente() { |
258,7 → 261,7 |
} |
|
public void allerALapageSuivante() { |
if (pageCourante < nbPage ) { |
if (pageCourante < nbPage) { |
int pageAAfficher = pageCourante + 1; |
pageCourante = pageAAfficher; |
chargerElements(pas * (pageAAfficher - 1), pas * (pageAAfficher)); |
274,7 → 277,7 |
} |
|
public void allerAlaDernierePage() { |
int pageAAfficher = nbPage ; |
int pageAAfficher = nbPage; |
pageCourante = pageAAfficher; |
chargerElements(pas * (pageAAfficher - 1), pas * (pageAAfficher)); |
BusEvenementiel.getInstance().fireEvent(new EvenementChangementPage(pageAAfficher, groupePagination)); |
309,11 → 312,11 |
public void setPas(int pas) { |
this.pas = pas; |
} |
|
|
public void setGroupePagination(String groupePagination) { |
this.groupePagination = groupePagination; |
} |
|
|
public String getGroupePagination() { |
return groupePagination; |
} |