Add Pager Item Index
This commit is contained in:
1 parent
08937899a8
commit
3e4f280b42
2 files changed
+4
-2
No files matched your search
@@ -112,16 +112,18 @@ public abstract class PagerAbstract<T> implements Pager<T>
|
||||
return ret;
|
||||
}
|
||||
|
||||
int index = (number - 1) * this.getItemsPerPage();
|
||||
for (T pageItem : pageItems)
|
||||
{
|
||||
if (stringifier != null)
|
||||
{
|
||||
ret.add(stringifier.toString(pageItem));
|
||||
ret.add(stringifier.toString(pageItem, index));
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.add(pageItem.toString());
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -2,5 +2,5 @@ package com.massivecraft.massivecore.pager;
|
||||
|
||||
public interface Stringifier<T>
|
||||
{
|
||||
public String toString(T item);
|
||||
public String toString(T item, int index);
|
||||
}
|
||||
Reference in new issue
Block a user