View Javadoc
1   /*
2    * Copyright (c) 2002-2014, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.util.html;
35  
36  import java.io.Serializable;
37  
38  import java.util.List;
39  
40  
41  /**
42   * Handles paging
43   * @param <E> the type
44   */
45  public interface IPaginator<E> extends Serializable
46  {
47      /** Default value for Page Index Parameter */
48      String PARAMETER_PAGE_INDEX = "page_index";
49  
50      /** Default value for Items Per Page Parameter */
51      String PARAMETER_ITEMS_PER_PAGE = "items_per_page";
52      String LABEL_FIRST = "|&lt;";
53      String LABEL_PREVIOUS = "&lt;";
54      String LABEL_NEXT = "&gt;";
55      String LABEL_LAST = "&gt;|";
56  
57      /**
58       * Gets the number of pages
59       * @return the number of pages
60       */
61      int getPagesCount(  );
62  
63      /**
64       * Returns the List
65       *
66       * @return The List
67       */
68      List<E> getPageItems(  );
69  
70      /**
71       * Returns the current page index
72       *
73       * @return The current page index
74       */
75      int getPageCurrent(  );
76  
77      /**
78       * Returns the previous page link
79       *
80       * @return The previous page link
81       */
82      String getFirstPageLink(  );
83  
84      /**
85       * Returns the previous page link
86       *
87       * @return The previous page link
88       */
89      String getPreviousPageLink(  );
90  
91      /**
92       * Returns the previous page link
93       *
94       * @return The previous page link
95       */
96      String getLastPageLink(  );
97  
98      /**
99       * Returns the previous page link
100      *
101      * @return The previous page link
102      */
103     String getNextPageLink(  );
104 
105     /**
106      * Returns Pages Links
107      *
108      * @return Pages Links
109      */
110     List<PaginatorPage> getPagesLinks(  );
111 
112     /**
113      * Returns the index of the first item of the current page range
114      * @return The index of the first item of the current page range
115      */
116     int getRangeMin(  );
117 
118     /**
119      * Returns the index of the last item of the current page range
120      * @return The index of the last item of the current page range
121      */
122     int getRangeMax(  );
123 
124     /**
125      * Returns the number of items in the collection
126      * @return The number of items in the collection
127      */
128     int getItemsCount(  );
129 
130     /**
131      * Get First label
132      * @return The Label
133      */
134     String getLabelFirst(  );
135 
136     /**
137      * Get Previous label
138      * @return The Label
139      */
140     String getLabelPrevious(  );
141 
142     /**
143      * Get Next label
144      * @return The Label
145      */
146     String getLabelNext(  );
147 
148     /**
149      * Get First label
150      * @return The Label
151      */
152     String getLabelLast(  );
153 
154     /**
155      * Get Item Count label
156      * @return The Label
157      */
158     String getLabelItemCount(  );
159 
160     /**
161      * Get Item Count per page label
162      * @return The Label
163      */
164     String getLabelItemCountPerPage(  );
165 
166     /**
167      * Get the parameter name of the <code>items_per_page</code>
168      * @return the parameter name
169      */
170     String getItemsPerPageParameterName(  );
171 
172     /**
173      * Set the parameter name of the <code>items_per_page</code>
174      * @param strItemsPerPageParameterName the parameter name
175      */
176     void setItemsPerPageParameterName( String strItemsPerPageParameterName );
177 
178     /**
179      * Gets the items count per page.
180      * @return items count per page.
181      */
182     int getItemsPerPage(  );
183 }