Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/ibatis/common/util/PaginatedList.java


1   /*
2    *  Copyright 2004 Clinton Begin
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package com.ibatis.common.util;
17  
18  import java.util.List;
19  
20  /**
21   * Interface for lists that support paging
22   */
23  public interface PaginatedList extends List {
24  
25    /**
26     * Returns the maximum number of items per page
27     *
28     * @return The maximum number of items per page.
29     */
30    public int getPageSize();
31  
32    /**
33     * Is the current page the first page?
34     *
35     * @return True if the current page is the first page or if only
36     *         a single page exists.
37     */
38    public boolean isFirstPage();
39  
40    /**
41     * Is the current page a middle page (i.e. not first or last)?
42     *
43     * @return True if the current page is not the first or last page,
44     *         and more than one page exists (always returns false if only a
45     *         single page exists).
46     */
47    public boolean isMiddlePage();
48  
49    /**
50     * Is the current page the last page?
51     *
52     * @return True if the current page is the last page or if only
53     *         a single page exists.
54     */
55    public boolean isLastPage();
56  
57    /**
58     * Is a page available after the current page?
59     *
60     * @return True if the next page is available
61     */
62    public boolean isNextPageAvailable();
63  
64    /**
65     * Is a page available before the current page?
66     *
67     * @return True if the previous page is available
68     */
69    public boolean isPreviousPageAvailable();
70  
71    /**
72     * Moves to the next page after the current page.  If the current
73     * page is the last page, wrap to the first page.
74     *
75     * @return True if the page changed
76     */
77    public boolean nextPage();
78  
79    /**
80     * Moves to the page before the current page.  If the current
81     * page is the first page, wrap to the last page.
82     *
83     * @return True if the page changed
84     */
85    public boolean previousPage();
86  
87    /**
88     * Moves to a specified page.  If the specified
89     * page is beyond the last page, wrap to the first page.
90     * If the specified page is before the first page, wrap
91     * to the last page.
92     *
93     * @param pageNumber The page to go to
94     */
95    public void gotoPage(int pageNumber);
96  
97    /**
98     * Returns the current page index, which is a zero based integer.
99     * All paginated list implementations should know what index they are
100    * on, even if they don't know the ultimate boundaries (min/max).
101    *
102    * @return The current page
103    */
104   public int getPageIndex();
105 
106 }