Package tripleplay.ui
Class PagedMenu
java.lang.Object
A menu that is also capable of showing one page of its items at a time. Note that the caller
must connect buttons or sliders or some other UI elements within the menu to perform paging.
Note that this implementation assumes items are added in order of their page. Removal and of items and addition of items to the end of the last page is naturally supported.
TODO: support insertion of items in the middle of a page-
Nested Class Summary
Nested classes/interfaces inherited from class tripleplay.ui.Menu
Menu.AnimFn
Nested classes/interfaces inherited from class tripleplay.ui.Container
Container.Mutable<T extends Container.Mutable<T>>
Nested classes/interfaces inherited from class tripleplay.ui.Element
Element.Take
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
getPage()
Gets the current page.react.UnitSlot
incrementPage
(int delta) Gets a slot that will increment the page by the given delta when emitted.react.ValueView<Integer>
numPages()
Gets a view of the number of pages value.react.ValueView<Integer>
page()
Gets a view of the current page value.react.Slot<Integer>
pageSlot()
Gets a slot that will update the page when emitted.setPage
(int page) Sets the current page.Methods inherited from class tripleplay.ui.Menu
activate, deactivate, deactivated, itemTriggered
Methods inherited from class tripleplay.ui.Elements
add, add, childAdded, childAt, childCount, childRemoved, destroy, destroyAll, destroyAt, iterator, remove, removeAll, removeAt, setStylesheet, stylesheet
Methods inherited from class tripleplay.ui.Container
removeFromParent
Methods inherited from class tripleplay.ui.Element
addStyles, addStyles, bindEnabled, bindVisible, bounds, constraint, enabledSlot, hierarchyChanged, isAdded, isEnabled, isShowing, isVisible, location, parent, setConstraint, setEnabled, setStyles, setStyles, setVisible, size, styles, visibleSlot, x, y
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
itemsPerPage
public final int itemsPerPageNumber of items on a page is constant.
-
-
Constructor Details
-
PagedMenu
Creates a new paged menu with the given layout and number of items per page.
-
-
Method Details
-
page
Gets a view of the current page value. -
numPages
Gets a view of the number of pages value. -
pageSlot
Gets a slot that will update the page when emitted. -
incrementPage
public react.UnitSlot incrementPage(int delta) Gets a slot that will increment the page by the given delta when emitted. -
getPage
public int getPage()Gets the current page. -
setPage
Sets the current page. Items on the page are shown. All others are hidden.
-