Interface IPaging

  • All Superinterfaces:
    IAnyGroup<IPaging>, IComponent<IPaging>, IDisable<IPaging>, IHtmlBasedComponent<IPaging>, IMeshComposite<IPaging>, IXulElement<IPaging>

    public interface IPaging
    extends IXulElement<IPaging>, IDisable<IPaging>, IMeshComposite<IPaging>, IAnyGroup<IPaging>
    Immutable Paging component

    A paging component is used with another component to separate long content into multiple pages. If a component has long content to display, you could separate them into pages, and then use a paging component as a controller to allow the user decide which page to display.

    The listbox, grid and tree components support the paging intrinsically, so you don't need to specify a paging component explicitly. In other words, they will instantiate and manage a paging component automatically if the paging mold is specified. Of course, you could specify an external paging component, if you want to have different visual layout, or to control multiple listboxes, grids and/or trees with one single paging component.

    Support @Action

    Name Action Type
    onPaging ActionData: PagingData
    Represents an action triggered by the user navigates a new page.

    Support Molds

    Name Snapshot
    "default"
    "os"

    For example, suppose you have 100 items and prefer to show 20 items at a time, then you can use the paging components as follows.
     @RichletMapping("")
     public IComponent index() {
         return IVlayout.of(IPaging.ofTotalSize(100));
     }
     
     
    Author:
    jumperchen
    See Also:
    Paging
    • Field Detail

      • DEFAULT

        static final IPaging DEFAULT
        Constant for default attributes of this immutable component.
    • Method Detail

      • getWidgetClass

        default java.lang.String getWidgetClass()
        Returns the client widget class.

        Default: "zul.mess.Paging"

        Specified by:
        getWidgetClass in interface IComponent<IPaging>
      • getPageSize

        default int getPageSize()
        Returns the number of items per page.

        Default: 20.

      • withPageSize

        IPaging withPageSize​(int pageSize)
        Returns a copy of this immutable component with the specified pageSize.

        Sets the items to show in each page

        Parameters:
        pageSize - The number of items per page. (positive only)

        Default: 20.

        Returns:
        A modified copy of the this object
      • getTotalSize

        default int getTotalSize()
        Returns the total number of items.

        Default: 0

      • withTotalSize

        IPaging withTotalSize​(int totalSize)
        Returns a copy of this immutable component with the specified totalSize.

        To specify the total size of the paging component

        Parameters:
        totalSize - The total size of the paging component. (non-negative only)

        Default: 0

        Returns:
        A modified copy of the this object
      • getPageCount

        default int getPageCount()
        Returns the number of pages.

        Note: there is at least one page even no item at all.

        Default: 1

      • withPageCount

        IPaging withPageCount​(int pageCount)
        Returns a copy of this immutable component with the specified pageCount.

        Sets the number of pages

        Note: there is at least one page even no item at all.

        Parameters:
        pageCount - The number of pages.

        Default: 1

        Returns:
        A modified copy of the this object
      • isDetailed

        default boolean isDetailed()
        Returns whether to show the detailed info, such as getTotalSize()

        Default: false

      • withDetailed

        IPaging withDetailed​(boolean detailed)
        Returns a copy of this immutable component with the specified detailed.

        Sets whether to show total size and index of items in current page

        Parameters:
        detailed - true if enables the detail information.

        Default: false

        Returns:
        A modified copy of the this object
      • isAutohide

        default boolean isAutohide()
        Returns whether to automatically hide the paging if there is only one page available.

        Default: false

      • withAutohide

        IPaging withAutohide​(boolean autohide)
        Returns a copy of this immutable component with the specified autohide.

        Sets whether to automatically hide the paging component at client if there is only one page available.

        Parameters:
        autohide - true if enables the auto-hide feature.

        Default: false

        Returns:
        A modified copy of the this object
      • getActivePage

        default int getActivePage()
        Returns the active page (starting from 0).

        Default: 0

      • withActivePage

        IPaging withActivePage​(int activePage)
        Returns a copy of this immutable component with the specified activePage.

        Sets the active page (starting from 0)

        Note: In server side, the active page starts from 0. But in browser UI, it starts from 1 for human to see.

        Parameters:
        activePage - The active page to display at client.

        Default: 0

        Returns:
        A modified copy of the this object
      • getPageIncrement

        default int getPageIncrement()
        Returns the number of page anchors shall appear at the client.

        Default: 10.

      • withPageIncrement

        IPaging withPageIncrement​(int pageIncrement)
        Returns a copy of this immutable component with the specified pageIncrement.

        Sets the number of page list icon when the mold is "os"

        Parameters:
        pageIncrement - The number of page list icon when the mold is "os" (Non-positive only)

        Default: 10.

        Returns:
        A modified copy of the this object
      • ofTotalSize

        static IPaging ofTotalSize​(int totalSize)
        Returns the instance with the given total size.
        Parameters:
        totalSize - The total size of this paging component.
      • ofId

        static IPaging ofId​(java.lang.String id)
        Returns the instance with the given id.
        Parameters:
        id - The id to identify this component