Package io.jmix.ui.component.impl
Class AbstractPagination<T extends JmixAbstractPagination>
java.lang.Object
io.jmix.ui.component.impl.AbstractComponent<T>
io.jmix.ui.component.impl.AbstractPagination<T>
- All Implemented Interfaces:
AttachNotifier
,Component
,Component.BelongToFrame
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Component.HasXmlDescriptor
,Component.Wrapper
,HasContextHelp
,HasDebugId
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,PaginationComponent
- Direct Known Subclasses:
PaginationImpl
,SimplePaginationImpl
public abstract class AbstractPagination<T extends JmixAbstractPagination>
extends AbstractComponent<T>
implements PaginationComponent
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.PaginationComponent
PaginationComponent.AfterRefreshEvent, PaginationComponent.BeforeRefreshEvent
-
Field Summary
Modifier and TypeFieldDescriptionprotected UiComponentProperties
protected PaginationDataBinder
protected Integer
protected com.vaadin.shared.Registration
protected Messages
protected ThemeConstantsManager
protected UiProperties
Fields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds after refresh listener.Adds before refresh listener.protected boolean
canSetUnlimitedValue
(Integer value) protected void
protected boolean
protected int
findClosestValue
(int maxResults, List<Integer> optionsList) protected void
protected PaginationComponent.BeforeRefreshEvent
protected Integer
getDefaultOptionValue
(List<Integer> options, MetaClass metaClass) protected int
getEntityMaxFetchSize
(MetaClass metaClass) protected int
getEntityPageSize
(MetaClass metaClass) protected com.vaadin.ui.Button
protected int
protected com.vaadin.ui.ComboBox<Integer>
INTERNAL.protected com.vaadin.ui.Button
protected com.vaadin.ui.Button
protected com.vaadin.ui.Button
protected int
protected void
protected void
protected void
Setup MaxResult value to data binder and to items per page ComboBox if it's visible.protected boolean
boolean
boolean
protected void
onItemsPerPageValueChange
(com.vaadin.data.HasValue.ValueChangeEvent<Integer> event) processOptions
(List<Integer> options, MetaClass metaClass) Sorts options.protected void
void
setDataBinder
(PaginationDataBinder dataBinder) Sets a data binder.void
setItemsPerPageDefaultValue
(Integer defaultValue) Sets default value for the items per page ComboBox.void
setItemsPerPageOptions
(List<Integer> options) Sets items per page options which should be used in the ComboBox.void
setItemsPerPageUnlimitedOptionVisible
(boolean unlimitedOptionVisible) Sets visibility of unlimited (null) option value in the items per page ComboBox.void
setItemsPerPageValue
(Integer value) INTERNAL.void
setItemsPerPageVisible
(boolean itemsPerPageVisible) Sets visibility of items per page ComboBox.void
setMessages
(Messages messages) protected void
void
setThemeConstantsManager
(ThemeConstantsManager themeConstantsManager) void
setTotalCountDelegate
(Supplier<Integer> delegate) Sets delegate which is used to get the total count of items.void
setUiComponentProperties
(UiComponentProperties componentProperties) void
setUiProperties
(UiProperties uiProperties) protected void
Methods inherited from class io.jmix.ui.component.impl.AbstractComponent
addAttachListener, addDetachListener, addStyleName, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setParent, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.component.Component
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
-
Field Details
-
themeConstantsManager
-
messages
-
componentProperties
-
uiProperties
-
dataBinder
-
totalCountDelegate
-
itemsPerPageOptions
-
processedOptions
-
itemsPerPageDefaultValue
-
itemsPerPageValueChangeRegistration
protected com.vaadin.shared.Registration itemsPerPageValueChangeRegistration
-
-
Constructor Details
-
AbstractPagination
public AbstractPagination()
-
-
Method Details
-
setThemeConstantsManager
-
setMessages
-
setUiComponentProperties
-
setUiProperties
-
getTotalCountDelegate
- Specified by:
getTotalCountDelegate
in interfacePaginationComponent
- Returns:
- delegate which is used to get the total count of items.
-
setTotalCountDelegate
Description copied from interface:PaginationComponent
Sets delegate which is used to get the total count of items. For instance:@Autowired private DataManager dataManager; @Install(to = "pagination", subject = "totalCountDelegate") private Integer paginationTotalCountDelegate() { return dataManager.loadValue("select count(e) from demo_User e", Integer.class).one(); }
- Specified by:
setTotalCountDelegate
in interfacePaginationComponent
-
getDataBinder
- Specified by:
getDataBinder
in interfacePaginationComponent
- Returns:
- a data binder
-
addBeforeRefreshListener
public Subscription addBeforeRefreshListener(Consumer<PaginationComponent.BeforeRefreshEvent> listener) Description copied from interface:PaginationComponent
Adds before refresh listener. It is invoked when data should be refreshed after user actions: click on navigation buttons (next, last etc), change items per page value.- Specified by:
addBeforeRefreshListener
in interfacePaginationComponent
- Returns:
- a registration object for removing an event listener
-
getItemsPerPageValue
INTERNAL.- Returns:
- items per page value
-
setItemsPerPageValue
INTERNAL.- Parameters:
value
- items per page value
-
canSetUnlimitedValue
-
fireBeforeRefreshEvent
-
addAfterRefreshListener
public Subscription addAfterRefreshListener(Consumer<PaginationComponent.AfterRefreshEvent> listener) Description copied from interface:PaginationComponent
Adds after refresh listener. It is invoked when data is refreshed.- Specified by:
addAfterRefreshListener
in interfacePaginationComponent
- Returns:
- a registration object for removing an event listener
-
fireAfterRefreshEvent
protected void fireAfterRefreshEvent() -
isItemsPerPageVisible
public boolean isItemsPerPageVisible()- Specified by:
isItemsPerPageVisible
in interfacePaginationComponent
- Returns:
- true if items per page ComboBox is visible
-
setItemsPerPageVisible
public void setItemsPerPageVisible(boolean itemsPerPageVisible) Description copied from interface:PaginationComponent
Sets visibility of items per page ComboBox. This ComboBox contains options to limit the number of items for one page. If custom options are not set component will useUiComponentProperties.getPaginationItemsPerPageOptions()
. The default value isfalse
.- Specified by:
setItemsPerPageVisible
in interfacePaginationComponent
-
isItemsPerPageUnlimitedOptionVisible
public boolean isItemsPerPageUnlimitedOptionVisible()- Specified by:
isItemsPerPageUnlimitedOptionVisible
in interfacePaginationComponent
- Returns:
true
if unlimited (null) option should be visible in the items per page ComboBox.
-
setItemsPerPageUnlimitedOptionVisible
public void setItemsPerPageUnlimitedOptionVisible(boolean unlimitedOptionVisible) Description copied from interface:PaginationComponent
Sets visibility of unlimited (null) option value in the items per page ComboBox. If unlimited (null) option is selected component will try to load data withUiProperties.getEntityMaxFetchSize(String)
limitation. The default value istrue
.- Specified by:
setItemsPerPageUnlimitedOptionVisible
in interfacePaginationComponent
-
getItemsPerPageOptions
- Specified by:
getItemsPerPageOptions
in interfacePaginationComponent
- Returns:
- items per page options.
-
setItemsPerPageOptions
Description copied from interface:PaginationComponent
Sets items per page options which should be used in the ComboBox. Options less than or equal to 0 are ignored, options greater than entity's max fetch size will be replaced by it.- Specified by:
setItemsPerPageOptions
in interfacePaginationComponent
- Parameters:
options
- items per page options- See Also:
-
getItemsPerPageDefaultValue
- Specified by:
getItemsPerPageDefaultValue
in interfacePaginationComponent
- Returns:
- items per page default value or
null
-
setItemsPerPageDefaultValue
Description copied from interface:PaginationComponent
Sets default value for the items per page ComboBox.- Specified by:
setItemsPerPageDefaultValue
in interfacePaginationComponent
-
setDataBinder
Description copied from interface:PaginationComponent
Sets a data binder. It is used for managing data loading and dividing data to pages.- Specified by:
setDataBinder
in interfacePaginationComponent
-
removeItemsPerPageValueChangeSubscription
protected void removeItemsPerPageValueChangeSubscription() -
setupItemsPerPageValueChangeListener
protected void setupItemsPerPageValueChangeListener() -
onItemsPerPageValueChange
-
setSilentlyItemsPerPageValue
-
initItemsPerPageLayout
protected void initItemsPerPageLayout() -
initItemsPerPageOptions
protected void initItemsPerPageOptions() -
initMaxResultValue
protected void initMaxResultValue()Setup MaxResult value to data binder and to items per page ComboBox if it's visible. -
getTotalCount
protected int getTotalCount() -
getItemsCountToDisplay
protected int getItemsCountToDisplay()- Returns:
- current items count for page
-
checkDataBound
protected void checkDataBound() -
isEmptyOrNullDataBinder
protected boolean isEmptyOrNullDataBinder() -
dataBinderContainsItems
protected boolean dataBinderContainsItems() -
getFirstButton
protected com.vaadin.ui.Button getFirstButton() -
getPrevButton
protected com.vaadin.ui.Button getPrevButton() -
getNextButton
protected com.vaadin.ui.Button getNextButton() -
getLastButton
protected com.vaadin.ui.Button getLastButton() -
getItemsPerPageComboBox
-
getEntityMaxFetchSize
-
getEntityPageSize
-
getDefaultOptionValue
-
findClosestValue
-
processOptions
Sorts options. Options less than or equal 0 are ignored. Values greater than MaxFetchSize are replaced by MaxFetchSize.- Parameters:
options
- items per page optionsmetaClass
- entity's MetaClass- Returns:
- sorted options
-