1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.portal.web.util;
35
36 import fr.paris.lutece.portal.service.i18n.I18nService;
37 import fr.paris.lutece.util.html.Paginator;
38
39 import java.util.List;
40 import java.util.Locale;
41
42
43
44
45
46
47
48 public class LocalizedPaginator<E> extends Paginator<E>
49 {
50 private static final long serialVersionUID = 6863575639914868230L;
51 private static final String KEY_FIRST = "portal.util.labelFirst";
52 private static final String KEY_PREVIOUS = "portal.util.labelPrevious";
53 private static final String KEY_NEXT = "portal.util.labelNext";
54 private static final String KEY_LAST = "portal.util.labelLast";
55 private static final String KEY_ITEM_COUNT = "portal.util.labelItemCount";
56 private static final String KEY_ITEM_COUNT_PER_PAGE = "portal.util.labelItemCountPerPage";
57 private Locale _locale;
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 public LocalizedPaginator( List<E> list, int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex, Locale locale )
76 {
77 super( list, nItemPerPage, strBaseUrl, strPageIndexParameterName, strPageIndex );
78 _locale = locale;
79 }
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99 public LocalizedPaginator( List<E> list, int nItemPerPage, String strBaseUrl, String strPageIndexParameterName, String strPageIndex,
100 String strItemsPerPageParameterName, Locale locale )
101 {
102 this( list, nItemPerPage, strBaseUrl, strPageIndexParameterName, strPageIndex, locale );
103 setItemsPerPageParameterName( strItemsPerPageParameterName );
104 }
105
106
107
108
109 @Override
110 public String getLabelFirst( )
111 {
112 return I18nService.getLocalizedString( KEY_FIRST, _locale );
113 }
114
115
116
117
118 @Override
119 public String getLabelPrevious( )
120 {
121 return I18nService.getLocalizedString( KEY_PREVIOUS, _locale );
122 }
123
124
125
126
127 @Override
128 public String getLabelNext( )
129 {
130 return I18nService.getLocalizedString( KEY_NEXT, _locale );
131 }
132
133
134
135
136 @Override
137 public String getLabelLast( )
138 {
139 return I18nService.getLocalizedString( KEY_LAST, _locale );
140 }
141
142
143
144
145 @Override
146 public String getLabelItemCount( )
147 {
148 return I18nService.getLocalizedString( KEY_ITEM_COUNT, _locale );
149 }
150
151
152
153
154 @Override
155 public String getLabelItemCountPerPage( )
156 {
157 return I18nService.getLocalizedString( KEY_ITEM_COUNT_PER_PAGE, _locale );
158 }
159 }