..
The Grid component has the allCelebrities property defined as its source, so
it invokes the getAllCelebrities method to obtain the content to display. Note
however that Grid, after invoking this method, receives a list containing all 15
celebrities in collection, but displays only the first five.
Click on the pager to view the second page??”the same output will appear again.
Grid requested for the whole collection again, and this time displayed only the
second portion of five celebrities from it. Whenever we view another page, the whole
collection is requested from the data source, but only one page of data is displayed.
This is not too efficient but works for our purpose.
Imagine, however, that our collection contains as many as 10,000 celebrities, and it's
stored in a remote database. Requesting for the whole collection would put a lot of
strain on our resources, especially if we are going to have 2,000 pages.
We need to have the ability to request the celebrities, page-by-page??”only the first
five for the first page, only the second five for the second page and so on. This ability
is supported by Tapestry. All we need to do is to provide an implementation of the
GridDataSource interface.
Pages:
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182