Class SimplePagination

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.html.Div>
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, PaginationComponent<SimplePagination>, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class SimplePagination extends JmixSimplePagination implements PaginationComponent<SimplePagination>, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
See Also:
  • Field Details

    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • messages

      protected Messages messages
    • uiComponents

      protected UiComponents uiComponents
    • currentAuthentication

      protected CurrentAuthentication currentAuthentication
    • flowuiProperties

      protected FlowuiProperties flowuiProperties
    • itemsPerPage

      protected ItemsPerPage itemsPerPage
    • loader

      protected PaginationDataLoader loader
    • firstButtonClickRegistration

      protected com.vaadin.flow.shared.Registration firstButtonClickRegistration
    • previousButtonClickRegistration

      protected com.vaadin.flow.shared.Registration previousButtonClickRegistration
    • nextButtonClickRegistration

      protected com.vaadin.flow.shared.Registration nextButtonClickRegistration
    • lastButtonClickRegistration

      protected com.vaadin.flow.shared.Registration lastButtonClickRegistration
    • totalCountLabelClickRegistration

      protected com.vaadin.flow.shared.Registration totalCountLabelClickRegistration
    • itemsPerPageValueChangeRegistration

      protected com.vaadin.flow.shared.Registration itemsPerPageValueChangeRegistration
    • totalCountDelegate

      protected Function<LoadContext,Integer> totalCountDelegate
    • samePage

      protected boolean samePage
    • lastPage

      protected boolean lastPage
    • refreshing

      protected boolean refreshing
    • state

      protected SimplePagination.State state
    • lastState

      protected SimplePagination.State lastState
    • size

      protected int size
    • start

      protected int start
    • numberDatatype

      protected Datatype<?> numberDatatype
  • Constructor Details

    • SimplePagination

      public SimplePagination()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • autowireDependencies

      protected void autowireDependencies()
    • initComponent

      protected void initComponent()
    • disableUi

      protected void disableUi()
    • createItemsPerPage

      protected ItemsPerPage createItemsPerPage()
    • initItemsPerPage

      protected void initItemsPerPage(ItemsPerPage itemsPerPage)
    • getItemsPerPageDefaultValue

      @Nullable public Integer getItemsPerPageDefaultValue()
      Returns:
      items per page default value or null if not set
    • setItemsPerPageDefaultValue

      public void setItemsPerPageDefaultValue(@Nullable Integer defaultValue)
      Sets default value for the select component.
      Parameters:
      defaultValue - value to set
    • getItemsPerPageItems

      public Collection<Integer> getItemsPerPageItems()
      Returns:
      items that is used in select component
    • setItemsPerPageItems

      public void setItemsPerPageItems(List<Integer> itemsPerPageItems)
      Sets items which should be used in the select component. Items less than or equal to 0 are ignored, options greater than entity's max fetch size will be replaced by it.
      Parameters:
      itemsPerPageItems - items to set
    • isItemsPerPageUnlimitedItemVisible

      public boolean isItemsPerPageUnlimitedItemVisible()
      Returns:
      true if unlimited (null) item should be visible in the select component
    • setItemsPerPageUnlimitedItemVisible

      public void setItemsPerPageUnlimitedItemVisible(boolean unlimitedItemVisible)
      Sets visibility of unlimited (null) option value in the items per page select component. If unlimited (null) option is selected component will try to load data with FlowuiProperties.getEntityMaxFetchSize(String) limitation. The default value is true.
      Parameters:
      unlimitedItemVisible - whether unlimited option should be visible
    • isItemsPerPageVisible

      public boolean isItemsPerPageVisible()
      Returns:
      true if items per page select component is visible
    • setItemsPerPageVisible

      public void setItemsPerPageVisible(boolean itemsPerPageVisible)
      Sets visibility of items per page select component. This component contains options to limit the number of items for one page. If custom options are not set component will use FlowuiComponentProperties.getPaginationItemsPerPageItems(). The default value is false.
    • addBeforeRefreshListener

      public com.vaadin.flow.shared.Registration addBeforeRefreshListener(com.vaadin.flow.component.ComponentEventListener<PaginationComponent.BeforeRefreshEvent<SimplePagination>> 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 interface PaginationComponent<SimplePagination>
      Parameters:
      listener - listener to add
      Returns:
      a registration object for removing an event listener
    • addAfterRefreshListener

      public com.vaadin.flow.shared.Registration addAfterRefreshListener(com.vaadin.flow.component.ComponentEventListener<PaginationComponent.AfterRefreshEvent<SimplePagination>> listener)
      Description copied from interface: PaginationComponent
      Adds after refresh listener. It is invoked when data is refreshed.
      Specified by:
      addAfterRefreshListener in interface PaginationComponent<SimplePagination>
      Parameters:
      listener - listener to add
      Returns:
      a registration object for removing an event listener
    • getTotalCountDelegate

      @Nullable public Function<LoadContext,Integer> getTotalCountDelegate()
      Specified by:
      getTotalCountDelegate in interface PaginationComponent<SimplePagination>
      Returns:
      delegate which is used to get the total count of items
    • setTotalCountDelegate

      public void setTotalCountDelegate(@Nullable Function<LoadContext,Integer> totalCountDelegate)
      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(LoadContext<User> dataLoadContext) {
           return dataManager.loadValue("select count(e) from demo_User e", Integer.class).one();
       }
       
      Specified by:
      setTotalCountDelegate in interface PaginationComponent<SimplePagination>
      Parameters:
      totalCountDelegate - total count delegate to set
    • getPaginationLoader

      public PaginationDataLoader getPaginationLoader()
      Specified by:
      getPaginationLoader in interface PaginationComponent<SimplePagination>
      Returns:
      pagination data loader or null if not set
    • setPaginationLoader

      public void setPaginationLoader(@Nullable PaginationDataLoader loader)
      Description copied from interface: PaginationComponent
      Sets loader to the component.
      Specified by:
      setPaginationLoader in interface PaginationComponent<SimplePagination>
      Parameters:
      loader - pagination data loader to set
    • onRefreshItems

      protected void onRefreshItems(CollectionChangeType changeType)
    • removeListeners

      protected void removeListeners()
    • initListeners

      protected void initListeners()
    • onTotalCountLabelClick

      protected void onTotalCountLabelClick(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.html.Span> event)
    • onFirstClick

      protected void onFirstClick(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event)
    • onPreviousClick

      protected void onPreviousClick(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event)
    • onNextClick

      protected void onNextClick(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event)
    • onLastClick

      protected void onLastClick(com.vaadin.flow.component.ClickEvent<com.vaadin.flow.component.button.Button> event)
    • onItemsPerPageValueChange

      protected void onItemsPerPageValueChange(com.vaadin.flow.component.HasValue.ValueChangeEvent<Integer> event)
    • refreshData

      protected boolean refreshData()
    • onCollectionChanged

      protected void onCollectionChanged()
    • updateItemsPerPageAvailability

      protected void updateItemsPerPageAvailability()
    • updateTotalCountLabel

      protected void updateTotalCountLabel()
    • updateNavigationButtonsAvailability

      protected void updateNavigationButtonsAvailability()
    • getLabelMessageKey

      protected String getLabelMessageKey()
    • calculateRowsStatusLabelValue

      protected String calculateRowsStatusLabelValue()
    • setTotalCountLabelText

      protected void setTotalCountLabelText(int totalCount)
    • getTotalCount

      protected int getTotalCount()
    • loaderContainsItems

      protected boolean loaderContainsItems()
    • canSetUnlimitedValue

      protected boolean canSetUnlimitedValue(@Nullable Integer value)
    • getEntityMaxFetchSize

      protected int getEntityMaxFetchSize(MetaClass metaClass)
    • setSilentlyItemsPerPageValue

      protected void setSilentlyItemsPerPageValue(@Nullable Integer value)
    • fireBeforeRefreshEvent

      protected PaginationComponent.BeforeRefreshEvent<SimplePagination> fireBeforeRefreshEvent()
    • fireAfterRefreshEvent

      protected void fireAfterRefreshEvent()