Package com.jagrosh.jdautilities.menu
Class Slideshow.Builder
java.lang.Object
com.jagrosh.jdautilities.menu.Menu.Builder<Slideshow.Builder,Slideshow>
com.jagrosh.jdautilities.menu.Slideshow.Builder
- Enclosing class:
Slideshow
The
Menu.Builder
for
a Slideshow
.- Author:
- John Grosh
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds String items to the list of items to paginate.allowTextInput
(boolean allowTextInput) Sets theSlideshow
to allow a slide number to be specified by a user via text.build()
Builds theSlideshow
with this Builder.setBulkSkipNumber
(int bulkSkipNumber) Sets theSlideshow
's bulk-skip function to skip multiple pages using alternate forward and backwardsSets theColor
of theMessageEmbed
.setColor
(BiFunction<Integer, Integer, Color> colorBiFunction) Sets theColor
of theMessageEmbed
, relative to the total page number and the current page as determined by the providedBiFunction
.setDescription
(String description) Sets the description of theMessageEmbed
in theMessage
to be displayed when theSlideshow
is built.setDescription
(BiFunction<Integer, Integer, String> descriptionBiFunction) Sets the description of theMessageEmbed
in theMessage
to be displayed relative to the total page number and the current page as determined by the providedBiFunction
.setFinalAction
(Consumer<net.dv8tion.jda.api.entities.Message> finalAction) setLeftRightText
(String left, String right) Sets theSlideshow
to traverse left or right when a provided text input is sent in the form of a Message to theGuildChannel
the menu is displayed in.Sets the text of theMessage
to be displayed when theSlideshow
is built.setText
(BiFunction<Integer, Integer, String> textBiFunction) Sets the text of theMessage
to be displayed relative to the total page number and the current page as determined by the providedBiFunction
.Sets the String list of urls to paginate.showPageNumbers
(boolean show) Sets whether or not the page number will be shown.waitOnSinglePage
(boolean wait) wrapPageEnds
(boolean wrapPageEnds) Sets theSlideshow
to wrap from the last page to the first when traversing right and visa versa from the left.Methods inherited from class com.jagrosh.jdautilities.menu.Menu.Builder
addRoles, addUsers, setEventWaiter, setRoles, setTimeout, setUsers
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Builds theSlideshow
with this Builder.- Specified by:
build
in classMenu.Builder<Slideshow.Builder,
Slideshow> - Returns:
- The Paginator built from this Builder.
- Throws:
IllegalArgumentException
- If one of the following is violated:- No
EventWaiter
was set. - No items were set to paginate.
- No
-
setColor
Sets theColor
of theMessageEmbed
.- Parameters:
color
- The Color of the MessageEmbed- Returns:
- This builder
-
setColor
Sets theColor
of theMessageEmbed
, relative to the total page number and the current page as determined by the providedBiFunction
.
As the page changes, the BiFunction will re-process the current page number and the total page number, allowing for the color of the embed to change depending on the page number.- Parameters:
colorBiFunction
- A BiFunction that uses both current and total page numbers to get a Color for the MessageEmbed- Returns:
- This builder
-
setText
Sets the text of theMessage
to be displayed when theSlideshow
is built.This is displayed directly above the embed.
- Parameters:
text
- The Message content to be displayed above the embed when the Slideshow is built- Returns:
- This builder
-
setText
Sets the text of theMessage
to be displayed relative to the total page number and the current page as determined by the providedBiFunction
.
As the page changes, the BiFunction will re-process the current page number and the total page number, allowing for the displayed text of the Message to change depending on the page number.- Parameters:
textBiFunction
- The BiFunction that uses both current and total page numbers to get text for the Message- Returns:
- This builder
-
setDescription
Sets the description of theMessageEmbed
in theMessage
to be displayed when theSlideshow
is built.- Parameters:
description
- The description of the MessageEmbed- Returns:
- This builder
-
setDescription
Sets the description of theMessageEmbed
in theMessage
to be displayed relative to the total page number and the current page as determined by the providedBiFunction
.
As the page changes, the BiFunction will re-process the current page number and the total page number, allowing for the displayed description of the MessageEmbed to change depending on the page number.- Parameters:
descriptionBiFunction
- The BiFunction that uses both current and total page numbers to get description for the MessageEmbed- Returns:
- This builder
-
setFinalAction
- Parameters:
finalAction
- The Consumer action to perform if the Slideshow times out- Returns:
- This builder
-
showPageNumbers
Sets whether or not the page number will be shown.- Parameters:
show
-true
if the page number should be shown,false
if it should not- Returns:
- This builder
-
waitOnSinglePage
Sets whether theSlideshow
will instantly timeout, and possibly run a providedRunnable
, if only a single slide is available to display.- Parameters:
wait
-true
if the Slideshow will still generate- Returns:
- This builder
-
addItems
Adds String items to the list of items to paginate.- Parameters:
items
- The String list of items to add- Returns:
- This builder
-
setUrls
Sets the String list of urls to paginate.
This method clears all previously set items before setting.- Parameters:
items
- The String list of urls to paginate- Returns:
- This builder
-
setBulkSkipNumber
Sets theSlideshow
's bulk-skip function to skip multiple pages using alternate forward and backwards- Parameters:
bulkSkipNumber
- The number of pages to skip when the bulk-skip reactions are used.- Returns:
- This builder
-
wrapPageEnds
Sets theSlideshow
to wrap from the last page to the first when traversing right and visa versa from the left.- Parameters:
wrapPageEnds
-true
to enable wrapping.- Returns:
- This builder
-
allowTextInput
Sets theSlideshow
to allow a slide number to be specified by a user via text.Note that setting this doesn't mean that left and right text inputs provided via
Paginator.Builder.setLeftRightText(String, String)
will be invalidated if they were set previously! To invalidate those, providenull
for one or both of the parameters of that method.- Parameters:
allowTextInput
-true
if the Slideshow will allow slide-number text input- Returns:
- This builder
-
setLeftRightText
Sets theSlideshow
to traverse left or right when a provided text input is sent in the form of a Message to theGuildChannel
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 Slideshow is built.- Parameters:
left
- The left text input, causes the Slideshow to traverse one slide leftright
- The right text input, causes the Slideshow to traverse one slide right- Returns:
- This builder
-