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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds String items to the list of items to paginate.allowTextInput(boolean allowTextInput) Sets theSlideshowto allow a slide number to be specified by a user via text.build()Builds theSlideshowwith this Builder.setBulkSkipNumber(int bulkSkipNumber) Sets theSlideshow's bulk-skip function to skip multiple pages using alternate forward and backwardsSets theColorof theMessageEmbed.setColor(BiFunction<Integer, Integer, Color> colorBiFunction) Sets theColorof theMessageEmbed, relative to the total page number and the current page as determined by the providedBiFunction.setDescription(String description) Sets the description of theMessageEmbedin theMessageto be displayed when theSlideshowis built.setDescription(BiFunction<Integer, Integer, String> descriptionBiFunction) Sets the description of theMessageEmbedin theMessageto 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 theSlideshowto traverse left or right when a provided text input is sent in the form of a Message to theGuildChannelthe menu is displayed in.Sets the text of theMessageto be displayed when theSlideshowis built.setText(BiFunction<Integer, Integer, String> textBiFunction) Sets the text of theMessageto 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 theSlideshowto 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 theSlideshowwith this Builder.- Specified by:
buildin classMenu.Builder<Slideshow.Builder,Slideshow> - Returns:
- The Paginator built from this Builder.
- Throws:
IllegalArgumentException- If one of the following is violated:- No
EventWaiterwas set. - No items were set to paginate.
- No
-
setColor
Sets theColorof theMessageEmbed.- Parameters:
color- The Color of the MessageEmbed- Returns:
- This builder
-
setColor
Sets theColorof 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 theMessageto be displayed when theSlideshowis 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 theMessageto 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 theMessageEmbedin theMessageto be displayed when theSlideshowis built.- Parameters:
description- The description of the MessageEmbed- Returns:
- This builder
-
setDescription
Sets the description of theMessageEmbedin theMessageto 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-trueif the page number should be shown,falseif it should not- Returns:
- This builder
-
waitOnSinglePage
Sets whether theSlideshowwill instantly timeout, and possibly run a providedRunnable, if only a single slide is available to display.- Parameters:
wait-trueif 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 theSlideshowto wrap from the last page to the first when traversing right and visa versa from the left.- Parameters:
wrapPageEnds-trueto enable wrapping.- Returns:
- This builder
-
allowTextInput
Sets theSlideshowto 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, providenullfor one or both of the parameters of that method.- Parameters:
allowTextInput-trueif the Slideshow will allow slide-number text input- Returns:
- This builder
-
setLeftRightText
Sets theSlideshowto traverse left or right when a provided text input is sent in the form of a Message to theGuildChannelthe menu is displayed in.If one or both these parameters are provided
nullthis 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
-