Add Pager Item Index
This commit is contained in:
parent
08937899a8
commit
3e4f280b42
@ -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;
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user