public static class Paginator.Builder extends Menu.Builder<Paginator.Builder,Paginator>
Menu.Builder
for
a Paginator
.Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
Paginator.Builder |
addItems(java.lang.String... items)
Adds String items to the list of items to paginate.
|
Paginator.Builder |
allowTextInput(boolean allowTextInput)
Sets the
Paginator to allow
a page number to be specified by a user via text. |
Paginator |
build()
Builds the
Paginator
with this Builder. |
Paginator.Builder |
clearItems()
Clears the list of String items to paginate.
|
Paginator.Builder |
setBulkSkipNumber(int bulkSkipNumber)
Sets the
Paginator 's bulk-skip
function to skip multiple pages using alternate forward and backwards |
Paginator.Builder |
setColor(java.util.function.BiFunction<java.lang.Integer,java.lang.Integer,java.awt.Color> colorBiFunction)
Sets the
Color of the MessageEmbed ,
relative to the total page number and the current page as determined by the provided
BiFunction . |
Paginator.Builder |
setColor(java.awt.Color color)
Sets the
Color of the MessageEmbed . |
Paginator.Builder |
setColumns(int columns)
Sets the number of columns each page will have.
|
Paginator.Builder |
setFinalAction(java.util.function.Consumer<net.dv8tion.jda.core.entities.Message> finalAction)
Sets the
Consumer to perform if the
Paginator times out. |
Paginator.Builder |
setItems(java.lang.String... items)
Sets the String list of items to paginate.
|
Paginator.Builder |
setItemsPerPage(int num)
Sets the number of items that will appear on each page.
|
Paginator.Builder |
setLeftRightText(java.lang.String left,
java.lang.String right)
Sets the
Paginator to traverse
left or right when a provided text input is sent in the form of a Message to
the Channel the menu is displayed in. |
Paginator.Builder |
setText(java.util.function.BiFunction<java.lang.Integer,java.lang.Integer,java.lang.String> textBiFunction)
Sets the text of the
Message to be displayed
relative to the total page number and the current page as determined by the provided
BiFunction . |
Paginator.Builder |
setText(java.lang.String text)
Sets the text of the
Message to be displayed
when the Paginator is built. |
Paginator.Builder |
showPageNumbers(boolean show)
Sets whether or not the page number will be shown.
|
Paginator.Builder |
useNumberedItems(boolean number)
Sets whether or not the items will be automatically numbered.
|
Paginator.Builder |
waitOnSinglePage(boolean wait)
Sets whether the
Paginator will instantly
timeout, and possibly run a provided Runnable , if only a single slide is available to display. |
Paginator.Builder |
wrapPageEnds(boolean wrapPageEnds)
Sets the
Paginator to wrap
from the last page to the first when traversing right and visa versa from the left. |
addRoles, addUsers, setEventWaiter, setRoles, setTimeout, setUsers
public Paginator build()
Paginator
with this Builder.build
in class Menu.Builder<Paginator.Builder,Paginator>
java.lang.IllegalArgumentException
- If one of the following is violated:
EventWaiter
was set.public Paginator.Builder setColor(java.awt.Color color)
Color
of the MessageEmbed
.color
- The Color of the MessageEmbedpublic Paginator.Builder setColor(java.util.function.BiFunction<java.lang.Integer,java.lang.Integer,java.awt.Color> colorBiFunction)
Color
of the MessageEmbed
,
relative to the total page number and the current page as determined by the provided
BiFunction
.
colorBiFunction
- A BiFunction that uses both current and total page numbers to get a Color for the MessageEmbedpublic Paginator.Builder setText(java.lang.String text)
Message
to be displayed
when the Paginator
is built.
This is displayed directly above the embed.
text
- The Message content to be displayed above the embed when the Paginator is builtpublic Paginator.Builder setText(java.util.function.BiFunction<java.lang.Integer,java.lang.Integer,java.lang.String> textBiFunction)
Message
to be displayed
relative to the total page number and the current page as determined by the provided
BiFunction
.
textBiFunction
- The BiFunction that uses both current and total page numbers to get text for the Messagepublic Paginator.Builder setFinalAction(java.util.function.Consumer<net.dv8tion.jda.core.entities.Message> finalAction)
Consumer
to perform if the
Paginator
times out.finalAction
- The Consumer action to perform if the Paginator times outpublic Paginator.Builder setColumns(int columns)
columns
- The number of columnspublic Paginator.Builder setItemsPerPage(int num)
num
- Always positive, never-zero number of items per pagejava.lang.IllegalArgumentException
- If the provided number is less than 1public Paginator.Builder showPageNumbers(boolean show)
show
- true
if the page number should be shown, false
if it should notpublic Paginator.Builder useNumberedItems(boolean number)
number
- true
if the items should be numbered, false
if it should notpublic Paginator.Builder waitOnSinglePage(boolean wait)
Paginator
will instantly
timeout, and possibly run a provided Runnable
, if only a single slide is available to display.wait
- true
if the Paginator will still generatepublic Paginator.Builder clearItems()
public Paginator.Builder addItems(java.lang.String... items)
items
- The String list of items to addpublic Paginator.Builder setItems(java.lang.String... items)
items
- The String list of items to paginatepublic Paginator.Builder setBulkSkipNumber(int bulkSkipNumber)
Paginator
's bulk-skip
function to skip multiple pages using alternate forward and backwardsbulkSkipNumber
- The number of pages to skip when the bulk-skip reactions are used.public Paginator.Builder wrapPageEnds(boolean wrapPageEnds)
Paginator
to wrap
from the last page to the first when traversing right and visa versa from the left.wrapPageEnds
- true
to enable wrapping.public Paginator.Builder allowTextInput(boolean allowTextInput)
Paginator
to allow
a page number to be specified by a user via text.
Note that setting this doesn't mean that left and right text inputs
provided via setLeftRightText(String, String)
will
be invalidated if they were set previously! To invalidate those, provide
null
for one or both of the parameters of that method.
allowTextInput
- true
if the Paginator will allow page-number text inputpublic Paginator.Builder setLeftRightText(java.lang.String left, java.lang.String right)
Paginator
to traverse
left or right when a provided text input is sent in the form of a Message to
the Channel
the menu is displayed in.
If one or both these parameters are provided null
this resets
both of them and they will no longer be available when the Paginator is built.
left
- The left text input, causes the Paginator to traverse one page leftright
- The right text input, causes the Paginator to traverse one page right