Package io.jmix.ui.widget
Class JmixPagination
java.lang.Object
com.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractComponentContainer
com.vaadin.ui.AbstractLayout
com.vaadin.ui.CssLayout
io.jmix.ui.widget.JmixAbstractPagination
io.jmix.ui.widget.JmixPagination
- All Implemented Interfaces:
com.vaadin.event.ContextClickEvent.ContextClickNotifier
,com.vaadin.event.LayoutEvents.LayoutClickNotifier
,com.vaadin.event.MethodEventSource
,com.vaadin.server.ClientConnector
,com.vaadin.server.Sizeable
,com.vaadin.shared.Connector
,com.vaadin.ui.Component
,com.vaadin.ui.Component.HasContextHelp
,com.vaadin.ui.ComponentContainer
,com.vaadin.ui.HasComponents
,com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier
,com.vaadin.ui.Layout
,Serializable
,Iterable<com.vaadin.ui.Component>
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Class describes data page in the component.Nested classes/interfaces inherited from class io.jmix.ui.widget.JmixAbstractPagination
JmixAbstractPagination.JmixItemsPerPageLayout
Nested classes/interfaces inherited from class com.vaadin.server.AbstractClientConnector
com.vaadin.server.AbstractClientConnector.IncorrectConcurrentAccessHandler
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.HasContextHelp, com.vaadin.ui.Component.Listener
Nested classes/interfaces inherited from interface com.vaadin.ui.Component.HasContextHelp
com.vaadin.ui.Component.HasContextHelp.ContextHelpIconClickEvent, com.vaadin.ui.Component.HasContextHelp.ContextHelpIconClickListener
Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents
com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.HasComponents.ComponentAttachEvent, com.vaadin.ui.HasComponents.ComponentAttachListener, com.vaadin.ui.HasComponents.ComponentDetachEvent, com.vaadin.ui.HasComponents.ComponentDetachListener
Nested classes/interfaces inherited from interface com.vaadin.ui.Layout
com.vaadin.ui.Layout.AlignmentHandler, com.vaadin.ui.Layout.MarginHandler, com.vaadin.ui.Layout.SpacingHandler
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
com.vaadin.server.Sizeable.Unit
-
Field Summary
Modifier and TypeFieldDescriptionprotected Runnable
protected int
protected PaginationDataBinder
protected int
protected int
protected int
protected BiConsumer<Integer,
Integer> protected List<JmixPagination.JmixPage>
protected static final String
Fields inherited from class io.jmix.ui.widget.JmixAbstractPagination
FIRST_PAGE_STYLENAME, firstButton, itemsPerPageLayout, LAST_PAGE_STYLENAME, lastButton, NAVIGATION_BTN_STYLENAME, NEXT_PAGE_STYLENAME, nextButton, PREV_PAGE_STYLENAME, prevButton, primaryStyleName
Fields inherited from class com.vaadin.ui.CssLayout
components
Fields inherited from class com.vaadin.ui.AbstractComponent
componentErrorProvider, DESIGN_ATTR_PLAIN_TEXT, requiredError
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
void
createPages
(int totalCount, int itemsToDisplay) Creates pages based on total count of items and items count to display per page.protected void
protected void
firePageChangeEvent
(int previousPage, int currentPage) void
forceSelectPage
(int pageNumber) Sets page without firing refresh event.int
int
int
int
getPages()
protected boolean
boolean
isFirstResultInRanges
(int firstResult) Checks that first result is not greater than last page's first result.protected boolean
isPageIndexNotInRange
(int pageIdx) void
Removes all pages from the layout.void
Selects first page or do nothing if current page is first.void
Selects last page or do nothing if current page is last.void
Selects next page or do nothing if current page is last.void
selectPage
(int pageNumber) Sets page by its number.void
Selects previous page or do nothing if current page is first.void
setCurrentPageNumber
(int currentPageNumber) Sets current page number.void
setCurrentPageNumberByFirstResult
(int firstResult) Sets page number based on provided first result.void
setDataBinder
(PaginationDataBinder dataBinder) Sets pagination data binder.void
setDataRefreshedProvider
(Supplier<Boolean> dataRefreshedProvider) Sets data refreshed provider.void
setMaxVisiblePages
(int maxVisiblePages) Sets maximum number of visible pages.void
setOnAfterRefreshListener
(Runnable listener) Sets after data refresh listener.void
setPageChangeListener
(BiConsumer<Integer, Integer> listener) Sets page change listener.void
Calculates page numbers and captions based ongetCurrentPageNumber()
.void
Sets to pages selected or not based ongetCurrentPageNumber()
.Methods inherited from class io.jmix.ui.widget.JmixAbstractPagination
createItemsPerPage, createNavigationBtn, createNavigationButtons, getFirstButton, getItemsPerPageComboBox, getItemsPerPageLabel, getItemsPerPageLayout, getLastButton, getNextButton, getPrevButton, getStyleName, isItemsPerPageUnlimitedOptionVisible, isItemsPerPageVisible, setItemsPerPageUnlimitedOptionVisible, setItemsPerPageVisible, setStyleName
Methods inherited from class com.vaadin.ui.CssLayout
addComponent, addComponent, addComponentAsFirst, addLayoutClickListener, beforeClientResponse, getComponent, getComponentCount, getComponentIndex, getCss, getState, getState, iterator, readDesign, removeComponent, removeLayoutClickListener, replaceComponent, writeDesign
Methods inherited from class com.vaadin.ui.AbstractLayout
isRequiredIndicatorVisible, readMargin, setRequiredIndicatorVisible, writeMargin
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addComponentAttachListener, addComponentDetachListener, addComponents, fireComponentAttachEvent, fireComponentDetachEvent, getComponentIterator, moveComponentsFrom, removeAllComponents, removeComponentAttachListener, removeComponentDetachListener, setHeight, setWidth
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addContextHelpIconClickListener, addListener, addShortcutListener, addStyleName, attach, detach, ensureContextHelpInitialized, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireContextHelpClick, focus, getActionManager, getCaption, getComponentError, getComponentErrorProvider, getContextHelpText, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getJTestId, getLocale, getParent, getPrimaryStyleName, getRequiredError, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isContextHelpTextHtmlEnabled, isEnabled, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setComponentErrorProvider, setContextHelpText, setContextHelpTextHtmlEnabled, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setJTestId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredError, setResponsive, setSizeFull, setSizeUndefined, setVisible, setWidth, setWidthFull, setWidthUndefined
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getIncorrectConcurrentAccessHandler, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setConnectorResource, setErrorHandler, setIncorrectConcurrentAccessHandler, setResource, updateDiffstate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getJTestId, getLocale, getParent, getPrimaryStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setJTestId, setParent, setPrimaryStyleName, setStyleName, setVisible
Methods inherited from interface com.vaadin.ui.ComponentContainer
addComponents, getComponentIterator, moveComponentsFrom, removeAllComponents
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
Methods inherited from interface com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier
addComponentAttachListener, addComponentDetachListener, removeComponentAttachListener, removeComponentDetachListener
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined
-
Field Details
-
PRIMARY_STYLENAME
- See Also:
-
pages
-
dataBinder
-
maxVisiblePages
protected int maxVisiblePages -
currentPageNumber
protected int currentPageNumber -
lastPageNumber
protected int lastPageNumber -
itemsToDisplay
protected int itemsToDisplay -
pageChangeListener
-
dataRefreshedProvider
-
afterRefreshListener
-
-
Constructor Details
-
JmixPagination
public JmixPagination()
-
-
Method Details
-
createContentLayout
protected void createContentLayout() -
getMaxVisiblePages
public int getMaxVisiblePages()- Returns:
- maximum number of visible pages
-
setMaxVisiblePages
public void setMaxVisiblePages(int maxVisiblePages) Sets maximum number of visible pages.- Parameters:
maxVisiblePages
- maximum visible pages value
-
getCurrentPageNumber
public int getCurrentPageNumber()- Returns:
- current page number
-
setCurrentPageNumber
public void setCurrentPageNumber(int currentPageNumber) Sets current page number. Note, page number starts from1
.- Parameters:
currentPageNumber
- current page number value
-
getLastPageNumber
public int getLastPageNumber()- Returns:
- number of last page
-
getItemsToDisplay
public int getItemsToDisplay()- Returns:
- items count that should be displayed per page
-
getDataBinder
- Returns:
- data source provider
-
setDataBinder
Sets pagination data binder.- Parameters:
dataBinder
- data binder
-
removePages
public void removePages()Removes all pages from the layout. -
createPages
public void createPages(int totalCount, int itemsToDisplay) Creates pages based on total count of items and items count to display per page.- Parameters:
totalCount
- total count of itemsitemsToDisplay
- items count to display per page
-
getPages
- Returns:
- pages list
-
getCurrentPage
- Returns:
- current page or
null
if list of pages is empty or number of current page is out of page number range
-
setCurrentPageNumberByFirstResult
public void setCurrentPageNumberByFirstResult(int firstResult) Sets page number based on provided first result. Throws an exception if page number cannot be set.- Parameters:
firstResult
- first result value
-
isFirstResultInRanges
public boolean isFirstResultInRanges(int firstResult) Checks that first result is not greater than last page's first result.- Parameters:
firstResult
- first result value to check- Returns:
true
if provided first result is less than or equal to last page's first result
-
selectFirstPage
public void selectFirstPage()Selects first page or do nothing if current page is first. -
selectNextPage
public void selectNextPage()Selects next page or do nothing if current page is last. -
selectPreviousPage
public void selectPreviousPage()Selects previous page or do nothing if current page is first. -
selectLastPage
public void selectLastPage()Selects last page or do nothing if current page is last. -
selectPage
public void selectPage(int pageNumber) Sets page by its number. Note, page number starts from 1.- Parameters:
pageNumber
- number of page
-
forceSelectPage
public void forceSelectPage(int pageNumber) Sets page without firing refresh event. Note, page number starts from 1.- Parameters:
pageNumber
- number of page
-
setOnAfterRefreshListener
Sets after data refresh listener. Is invoked data refreshing is finished successfully. -
fireAfterRefreshEvent
protected void fireAfterRefreshEvent() -
setPageChangeListener
Sets page change listener. Listener is invoked when selected page switched to another. -
firePageChangeEvent
protected void firePageChangeEvent(int previousPage, int currentPage) -
setDataRefreshedProvider
Sets data refreshed provider. Providestrue
if data refreshing is finished successfully. -
updatePageSelections
public void updatePageSelections()Sets to pages selected or not based ongetCurrentPageNumber()
. -
updatePageNumbers
public void updatePageNumbers()Calculates page numbers and captions based ongetCurrentPageNumber()
. -
isDataRefreshed
protected boolean isDataRefreshed() -
isPageIndexNotInRange
protected boolean isPageIndexNotInRange(int pageIdx)
-