Add Pager Item Index

This commit is contained in:
Olof Larsson 2015-02-17 10:40:30 +01:00
parent 08937899a8
commit 3e4f280b42
2 changed files with 4 additions and 2 deletions

View File

@ -112,16 +112,18 @@ public abstract class PagerAbstract<T> implements Pager<T>
return ret; return ret;
} }
int index = (number - 1) * this.getItemsPerPage();
for (T pageItem : pageItems) for (T pageItem : pageItems)
{ {
if (stringifier != null) if (stringifier != null)
{ {
ret.add(stringifier.toString(pageItem)); ret.add(stringifier.toString(pageItem, index));
} }
else else
{ {
ret.add(pageItem.toString()); ret.add(pageItem.toString());
} }
index++;
} }
return ret; return ret;

View File

@ -2,5 +2,5 @@ package com.massivecraft.massivecore.pager;
public interface Stringifier<T> public interface Stringifier<T>
{ {
public String toString(T item); public String toString(T item, int index);
} }