01: /*
02: * $Id: MyTable.java 457812 2005-10-06 21:20:34Z jdonnerstag $
03: * $Revision: 457812 $
04: * $Date: 2005-10-06 23:20:34 +0200 (Thu, 06 Oct 2005) $
05: *
06: * ====================================================================
07: * Licensed under the Apache License, Version 2.0 (the "License");
08: * you may not use this file except in compliance with the License.
09: * You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: */
19: package wicket.markup;
20:
21: import java.util.ArrayList;
22: import java.util.List;
23:
24: import wicket.markup.html.basic.Label;
25: import wicket.markup.html.list.ListItem;
26: import wicket.markup.html.list.ListView;
27: import wicket.model.Model;
28:
29: /**
30: * Dummy component used for ComponentCreateTagTest
31: *
32: * @author Juergen Donnerstag
33: */
34: public class MyTable extends ListView {
35: private static final long serialVersionUID = 1L;
36:
37: /**
38: * Construct.
39: * @param id
40: */
41: public MyTable(final String id) {
42: super (id, new Model(null));
43: }
44:
45: protected void populateItem(ListItem listItem) {
46: String txt = (String) listItem.getModelObject();
47: listItem.add(new Label("txt", txt));
48: }
49:
50: /**
51: * Sets the number of rows per page.
52: * @param rows
53: */
54: public void setRowsPerPage(final int rows) {
55: List list = new ArrayList();
56:
57: for (int i = 0; i < rows; i++) {
58: list.add("row: " + String.valueOf(i));
59: }
60:
61: setModelObject(list);
62: }
63: }
|