Package se.datadosen.jalbum
Class Paginator
- All Implemented Interfaces:
Iterable<AlbumObject>
,Collection<AlbumObject>
Simplify iterating over groups ("pages") of album objects of current folder
The various counter methods (size(), totalPages(), totalSize()) reflects the
various filters set up. This class uses a "fluent" API, returning itself in a
modified state. Use reset() to reset it to initial state.
Will always ignore excluded and hidden objects
An instance of this class is available via the "children" variable during processing of index.htt and within jAlbum's system console.
- Since:
- 33
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondirs()
Include directories only (convenience for include(Category.folder))Exclude one or several file typesExclude one or several categoriesfilter
(Predicate<AlbumObject> filter) Add a custom filterint
int
getPage()
Include one or several file types.Include one or several categories.iterator()
nodirs()
Exclude directories (convenience for exclude(Category.folder))page
(int page) Set current page to iterate over, starting with 0.reset()
Reset Paginator to initial stateint
size()
Convenience to exclude directories, pages and web locationsint
int
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Constructor Details
-
Paginator
-
Paginator
Create a copy- Parameters:
original
-
-
-
Method Details
-
page
Set current page to iterate over, starting with 0. Set to -1 to iterate over all pages- Parameters:
page
-- Returns:
- new Paginator specific for this page
-
getPage
public int getPage()- Returns:
- Current page or -1 if no paging has been set
-
size
public int size()- Specified by:
size
in interfaceCollection<AlbumObject>
- Specified by:
size
in classAbstractCollection<AlbumObject>
- Returns:
- Number of items in current page
-
totalSize
public int totalSize()- Returns:
- Total number of items in current folder
-
totalPages
public int totalPages()- Returns:
- Total number of pages in current folder
-
getItemsPerPage
public int getItemsPerPage() -
include
Include one or several categories. As soon as one category added, other categories are excluded- Parameters:
cats
-- Returns:
-
exclude
Exclude one or several categories- Parameters:
cats
-- Returns:
-
include
Include one or several file types. As soon as one file type is added, other file types are excluded- Parameters:
types
-- Returns:
- Since:
- 33.2
-
exclude
Exclude one or several file types- Parameters:
types
-- Returns:
- Since:
- 33.2
-
dirs
Include directories only (convenience for include(Category.folder))- Returns:
-
nodirs
Exclude directories (convenience for exclude(Category.folder))- Returns:
-
thumbnails
Convenience to exclude directories, pages and web locations- Returns:
-
filter
Add a custom filter- Parameters:
filter
-- Returns:
-
reset
Reset Paginator to initial state- Returns:
-
iterator
- Specified by:
iterator
in interfaceCollection<AlbumObject>
- Specified by:
iterator
in interfaceIterable<AlbumObject>
- Specified by:
iterator
in classAbstractCollection<AlbumObject>
-