In short, is there any reason not to go down this route?
package com.vegas.ui.wicket.repeaters;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import wicket.markup.html.navigation.paging.IPageable;
public class PageableCoordinator implements IPageable
{
private final ArrayList<IPageable> pageables = new
ArrayList<IPageable>();
private int currentPage;
private final int pageCount;
public PageableCoordinator(Collection<IPageable> children)
{
if (children == null || children.isEmpty())
throw new IllegalArgumentException("The IPageable
Collection may
not be null or empty.");
int tempPageCount = -1;
for (IPageable child : children)
{
child.setCurrentPage(currentPage);
if (tempPageCount == -1)
tempPageCount = child.getPageCount();
else if (tempPageCount != child.getPageCount())
throw new IllegalArgumentException("The
pageCount must match for
each child IPageable.");
}
pageCount = tempPageCount;
setCurrentPage(1);
}
public PageableCoordinator(IPageable... children)
{
this(Arrays.asList(children));
}
public int getPageCount()
{
return pageCount;
}
public int getCurrentPage()
{
return currentPage;
}
public void setCurrentPage(int page)
{
currentPage = page;
for (IPageable p : pageables)
p.setCurrentPage(page);
}
}
Cheers,
Scott
On Fri, May 30, 2008 at 4:48 PM, Scott Swank <[EMAIL PROTECTED]> wrote:
> I need to create a 3 row x N column table with 5 columns per page.
> The problem is that I end up with:
>
> <tr><td wicket:id="row1">stuff</td></tr>
> <tr><td wicket:id="row2">stuff</td></tr>
> <tr><td wicket:id="row3">stuff</td></tr>
>
> <div wicket:id="pagingNav"></div>
>
> Where I want the contents of row1, row2 & row3 coordinated with
> respect to the PagingNavigator. Has anyone gone down such a path, and
> if so are there any relevant lessons learned? I'm considering
> subclassing DataView to create a DataViewCoordinator(DataView...
> dataViews) such that a call to:
>
> coordinator.setCurrentPage(int n)
>
> results in the same call to each of the coordinated DataViews.
>
> Many thanks,
> Scott
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]