Hi all
Here's just newbie's quesion on using PageableListView.
I'm trying to use PageableLiveView in my project. But it doesnt work. The
following is the error I got. As I can see, I do have that room_type
component in the html file. It just doesnt work.
Since I dont understand how PageableListView works, I just mimic the library
example on the wicket website.
Now I need this to show my search result and I dont know any other ways to
make pageable list. This is quite urgent to me. I need it to finish my
assignment.
Could any buddy please help me out???? Many thanks..
=======================================================================
WicketMessage: The component(s) below failed to render. A common problem is
that you have added a component in code but forgot to reference it in the
markup (thus the component will never be rendered).
1. [Component id = room_type, page =
com.smartbooking.wicket.page.RoomResultListPage, path =
1:rooms:0:description:room_type.Label, isVisible = true, isVersioned = true]
2. [Component id = room_type, page =
com.smartbooking.wicket.page.RoomResultListPage, path =
1:rooms:1:description:room_type.Label, isVisible = true, isVersioned = true]
Root cause:
org.apache.wicket.WicketRuntimeException: The component(s) below failed to
render. A common problem is that you have added a component in code but
forgot to reference it in the markup (thus the component will never be
rendered).
1. [Component id = room_type, page =
com.smartbooking.wicket.page.RoomResultListPage, path =
1:rooms:0:description:room_type.Label, isVisible = true, isVersioned = true]
2. [Component id = room_type, page =
com.smartbooking.wicket.page.RoomResultListPage, path =
1:rooms:1:description:room_type.Label, isVisible = true, isVersioned = true]
at org.apache.wicket.Page.checkRendering(Page.java:1115)
...........
====================================================================================
Code:
******************************************************************************************************************************
public class RoomResultListPage extends WebPage {
public RoomResultListPage(final PageParameters parameters) {
final PageableListView listView;
add(listView = new MyPageableListView("rooms", new
PropertyModel(this,
"rooms"), 2){
@Override
protected void populateItem(final ListItem listitem) {
final Room room =
(Room)listitem.getModelObject();
listitem.add(RoomDetails.link("details", room));
listitem.add(RoomDetails.link("description",
room));
}
});
add(new PagingNavigator("navigator", listView));
}
public List getRooms()
{
List sample = new ArrayList();
Room room1 = new Room();
room1.setRid(1L);
room1.setRoom_type("single");
room1.setDescription("test1");
Room room2 = new Room();
room2.setRid(2L);
room2.setRoom_type("double");
room2.setDescription("test2");
Room room3 = new Room();
room3.setRid(3L);
room3.setRoom_type("xing");
room3.setDescription("test3");
sample.add(room1);
sample.add(room2);
sample.add(room3);
return sample;
}
}
***********************************************************************************************************
public final class RoomDetails extends WebPage {
public RoomDetails(final PageParameters pp){
}
public RoomDetails(final Room room) {
// TODO Auto-generated constructor stub
add(new Label("room_type", room.getRoom_type()));
add(new Label("description", room.getDescription()));
}
public static BookmarkablePageLink link(final String name,
final Room room) {
final BookmarkablePageLink link = new BookmarkablePageLink(name,
RoomDetails.class);
if (room != null) {
link.setParameter("rid", room.getRid());
link.add(new Label("room_type", new Model(room)));
} else {
link.add(new Label("room_type", "No matched room
type"));
link.setEnabled(false);
}
return link;
}
}
******************************************************************************************************************************
<table width = "100%">
<tr>
<th>Room Type</th>
<th>Description</th>
</tr>
<tr wicket:id="rooms">
<td>
#
Huckleberry Finn
</td>
<td>
Mark Twain
</td>
</tr>
</table>
<p>
</p>
****************************************************************************************************************
--
View this message in context:
http://www.nabble.com/question-on-PageableLiveView-tp20011877p20011877.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]