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
  • Field Details

    • themeConstantsManager

      protected ThemeConstantsManager themeConstantsManager
    • messages

      protected Messages messages
    • componentProperties

      protected UiComponentProperties componentProperties
    • uiProperties

      protected UiProperties uiProperties
    • dataBinder

      protected PaginationDataBinder dataBinder
    • totalCountDelegate

      protected Supplier<Integer> totalCountDelegate
    • itemsPerPageOptions

      protected List<Integer> itemsPerPageOptions
    • processedOptions

      protected List<Integer> processedOptions
    • itemsPerPageDefaultValue

      protected Integer itemsPerPageDefaultValue
    • itemsPerPageValueChangeRegistration

      protected com.vaadin.shared.Registration itemsPerPageValueChangeRegistration
  • Constructor Details

    • AbstractPagination

      public AbstractPagination()
  • Method Details

    • setThemeConstantsManager

      @Autowired public void setThemeConstantsManager(ThemeConstantsManager themeConstantsManager)
    • setMessages

      @Autowired public void setMessages(Messages messages)
    • setUiComponentProperties

      @Autowired public void setUiComponentProperties(UiComponentProperties componentProperties)
    • setUiProperties

      @Autowired public void setUiProperties(UiProperties uiProperties)
    • getTotalCountDelegate

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

      public void setTotalCountDelegate(@Nullable Supplier<Integer> delegate)
      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 interface PaginationComponent
    • getDataBinder

      @Nullable public PaginationDataBinder getDataBinder()
      Specified by:
      getDataBinder in interface PaginationComponent
      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 interface PaginationComponent
      Returns:
      a registration object for removing an event listener
    • getItemsPerPageValue

      @Nullable public Integer getItemsPerPageValue()
      INTERNAL.
      Returns:
      items per page value
    • setItemsPerPageValue

      public void setItemsPerPageValue(@Nullable Integer value)
      INTERNAL.
      Parameters:
      value - items per page value
    • canSetUnlimitedValue

      protected boolean canSetUnlimitedValue(@Nullable Integer value)
    • fireBeforeRefreshEvent

      protected PaginationComponent.BeforeRefreshEvent 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 interface PaginationComponent
      Returns:
      a registration object for removing an event listener
    • fireAfterRefreshEvent

      protected void fireAfterRefreshEvent()
    • isItemsPerPageVisible

      public boolean isItemsPerPageVisible()
      Specified by:
      isItemsPerPageVisible in interface PaginationComponent
      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 use UiComponentProperties.getPaginationItemsPerPageOptions(). The default value is false.
      Specified by:
      setItemsPerPageVisible in interface PaginationComponent
    • isItemsPerPageUnlimitedOptionVisible

      public boolean isItemsPerPageUnlimitedOptionVisible()
      Specified by:
      isItemsPerPageUnlimitedOptionVisible in interface PaginationComponent
      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 with UiProperties.getEntityMaxFetchSize(String) limitation. The default value is true.
      Specified by:
      setItemsPerPageUnlimitedOptionVisible in interface PaginationComponent
    • getItemsPerPageOptions

      public List<Integer> getItemsPerPageOptions()
      Specified by:
      getItemsPerPageOptions in interface PaginationComponent
      Returns:
      items per page options.
    • setItemsPerPageOptions

      public void setItemsPerPageOptions(List<Integer> options)
      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 interface PaginationComponent
      Parameters:
      options - items per page options
      See Also:
    • getItemsPerPageDefaultValue

      @Nullable public Integer getItemsPerPageDefaultValue()
      Specified by:
      getItemsPerPageDefaultValue in interface PaginationComponent
      Returns:
      items per page default value or null
    • setItemsPerPageDefaultValue

      public void setItemsPerPageDefaultValue(@Nullable Integer defaultValue)
      Description copied from interface: PaginationComponent
      Sets default value for the items per page ComboBox.
      Specified by:
      setItemsPerPageDefaultValue in interface PaginationComponent
    • setDataBinder

      public void setDataBinder(PaginationDataBinder dataBinder)
      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 interface PaginationComponent
    • removeItemsPerPageValueChangeSubscription

      protected void removeItemsPerPageValueChangeSubscription()
    • setupItemsPerPageValueChangeListener

      protected void setupItemsPerPageValueChangeListener()
    • onItemsPerPageValueChange

      protected void onItemsPerPageValueChange(com.vaadin.data.HasValue.ValueChangeEvent<Integer> event)
    • setSilentlyItemsPerPageValue

      protected void setSilentlyItemsPerPageValue(@Nullable Integer value)
    • 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

      protected com.vaadin.ui.ComboBox<Integer> getItemsPerPageComboBox()
    • getEntityMaxFetchSize

      protected int getEntityMaxFetchSize(MetaClass metaClass)
    • getEntityPageSize

      protected int getEntityPageSize(MetaClass metaClass)
    • getDefaultOptionValue

      protected Integer getDefaultOptionValue(List<Integer> options, MetaClass metaClass)
    • findClosestValue

      protected int findClosestValue(int maxResults, List<Integer> optionsList)
    • processOptions

      protected List<Integer> processOptions(List<Integer> options, MetaClass metaClass)
      Sorts options. Options less than or equal 0 are ignored. Values greater than MaxFetchSize are replaced by MaxFetchSize.
      Parameters:
      options - items per page options
      metaClass - entity's MetaClass
      Returns:
      sorted options