On Mon, Mar 03, 2008 at 07:27:41PM -0800, Gin Yeah exclaimed:
>Can you just make your 1d list look like a 2d list to the ListView?
>
> // this make a 1d list to look like a 2d list
> class FoldingList extends AbstractList<List<String>> implements
>Serializable {
> List<String> inputList;
> int width;
> int size;
>
> FoldingList(List<String> inputList, int width) {
> this.inputList = inputList;
> this.width = width;
> this.size = inputList.size() / width;
> }
>
> @Override public List<String> get(int index) {
> return inputList.subList(width*index, width*(index + 1));
> }
>
> @Override public int size() {
> return size;
> }
> }
>
>
>
>public HomePage extends WebPage {
> List<String> dataList = new ArrayList<String>(Arrays.asList(new
>String[]{
> "Item1", "Item2", "Item3", "Item4", "Item5", "Item6"
> }));
>
> FoldingList list2 = new FoldingList(dataList, 2);
>
> ListView listView = new ListView("columnList", list2) {
> @Override protected void populateItem(ListItem item) {
> @SuppressWarnings("unchecked")
> List<String> row = (List<String>) item.getModelObject();
> item.add(new Label("column1", row.get(0)));
> item.add(new Label("column2", row.get(1)));
> }
> };
> add(listView);
>}
>
>
> <table border="1" style="border-collapse: collapse;">
> <tr wicket:id="columnList">
> <td wicket:id="column1">column1</td>
> <td wicket:id="column2">column2</td>
> </tr>
> </table>
>
This looks like it will work as well. Thanks for the idea.
-Ryan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]