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 ClassesNested 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.WrapperNested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEventNested classes/interfaces inherited from interface io.jmix.ui.component.PaginationComponent
PaginationComponent.AfterRefreshEvent, PaginationComponent.BeforeRefreshEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected UiComponentPropertiesprotected PaginationDataBinderprotected Integerprotected com.vaadin.shared.Registrationprotected Messagesprotected ThemeConstantsManagerprotected UiPropertiesFields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds after refresh listener.Adds before refresh listener.protected booleancanSetUnlimitedValue(Integer value) protected voidprotected booleanprotected intfindClosestValue(int maxResults, List<Integer> optionsList) protected voidprotected PaginationComponent.BeforeRefreshEventprotected IntegergetDefaultOptionValue(List<Integer> options, MetaClass metaClass) protected intgetEntityMaxFetchSize(MetaClass metaClass) protected intgetEntityPageSize(MetaClass metaClass) protected com.vaadin.ui.Buttonprotected intprotected com.vaadin.ui.ComboBox<Integer>INTERNAL.protected com.vaadin.ui.Buttonprotected com.vaadin.ui.Buttonprotected com.vaadin.ui.Buttonprotected intprotected voidprotected voidprotected voidSetup MaxResult value to data binder and to items per page ComboBox if it's visible.protected booleanbooleanbooleanprotected voidonItemsPerPageValueChange(com.vaadin.data.HasValue.ValueChangeEvent<Integer> event) processOptions(List<Integer> options, MetaClass metaClass) Sorts options.protected voidvoidsetDataBinder(PaginationDataBinder dataBinder) Sets a data binder.voidsetItemsPerPageDefaultValue(Integer defaultValue) Sets default value for the items per page ComboBox.voidsetItemsPerPageOptions(List<Integer> options) Sets items per page options which should be used in the ComboBox.voidsetItemsPerPageUnlimitedOptionVisible(boolean unlimitedOptionVisible) Sets visibility of unlimited (null) option value in the items per page ComboBox.voidsetItemsPerPageValue(Integer value) INTERNAL.voidsetItemsPerPageVisible(boolean itemsPerPageVisible) Sets visibility of items per page ComboBox.voidsetMessages(Messages messages) protected voidvoidsetThemeConstantsManager(ThemeConstantsManager themeConstantsManager) voidsetTotalCountDelegate(Supplier<Integer> delegate) Sets delegate which is used to get the total count of items.voidsetUiComponentProperties(UiComponentProperties componentProperties) voidsetUiProperties(UiProperties uiProperties) protected voidMethods 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, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, withUnwrappedCompositionMethods 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:
getTotalCountDelegatein interfacePaginationComponent- Returns:
- delegate which is used to get the total count of items.
-
setTotalCountDelegate
Description copied from interface:PaginationComponentSets 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:
setTotalCountDelegatein interfacePaginationComponent
-
getDataBinder
- Specified by:
getDataBinderin interfacePaginationComponent- Returns:
- a data binder
-
addBeforeRefreshListener
public Subscription addBeforeRefreshListener(Consumer<PaginationComponent.BeforeRefreshEvent> listener) Description copied from interface:PaginationComponentAdds 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:
addBeforeRefreshListenerin 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:PaginationComponentAdds after refresh listener. It is invoked when data is refreshed.- Specified by:
addAfterRefreshListenerin interfacePaginationComponent- Returns:
- a registration object for removing an event listener
-
fireAfterRefreshEvent
protected void fireAfterRefreshEvent() -
isItemsPerPageVisible
public boolean isItemsPerPageVisible()- Specified by:
isItemsPerPageVisiblein interfacePaginationComponent- Returns:
- true if items per page ComboBox is visible
-
setItemsPerPageVisible
public void setItemsPerPageVisible(boolean itemsPerPageVisible) Description copied from interface:PaginationComponentSets 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:
setItemsPerPageVisiblein interfacePaginationComponent
-
isItemsPerPageUnlimitedOptionVisible
public boolean isItemsPerPageUnlimitedOptionVisible()- Specified by:
isItemsPerPageUnlimitedOptionVisiblein interfacePaginationComponent- Returns:
trueif unlimited (null) option should be visible in the items per page ComboBox.
-
setItemsPerPageUnlimitedOptionVisible
public void setItemsPerPageUnlimitedOptionVisible(boolean unlimitedOptionVisible) Description copied from interface:PaginationComponentSets 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:
setItemsPerPageUnlimitedOptionVisiblein interfacePaginationComponent
-
getItemsPerPageOptions
- Specified by:
getItemsPerPageOptionsin interfacePaginationComponent- Returns:
- items per page options.
-
setItemsPerPageOptions
Description copied from interface:PaginationComponentSets 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:
setItemsPerPageOptionsin interfacePaginationComponent- Parameters:
options- items per page options- See Also:
-
getItemsPerPageDefaultValue
- Specified by:
getItemsPerPageDefaultValuein interfacePaginationComponent- Returns:
- items per page default value or
null
-
setItemsPerPageDefaultValue
Description copied from interface:PaginationComponentSets default value for the items per page ComboBox.- Specified by:
setItemsPerPageDefaultValuein interfacePaginationComponent
-
setDataBinder
Description copied from interface:PaginationComponentSets a data binder. It is used for managing data loading and dividing data to pages.- Specified by:
setDataBinderin 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
-