{
return Identity.instance().isLoggedIn() && hotelSearch.getHotels().size() == 0;
}
};
body.add(noHotelsFound.setOutputMarkupId(true));
hotelDataView = new DataView("hotel", new SimpleDataProvider() // A DataProvider adapts between your data and Wicket's internal representation
{
public Iterator iterator(int from, int count)
{
return hotelSearch.getHotels().subList(from, from + count).iterator();
}
public int size()
{
return hotelSearch.getHotels().size();
}
})
{
/**
* You specify the tr in the html, and populate each one here
*/
@Override
protected void populateItem(Item item)
{
final Hotel hotel = (Hotel) item.getModelObject();
item.add(new Label("hotelName", hotel.getName()));
item.add(new Label("hotelAddress", hotel.getAddress()));
item.add(new Label("hotelCityStateCountry", hotel.getCity() + ", " + hotel.getState() + ", " + hotel.getCountry()));
item.add(new Label("hotelZip", hotel.getZip()));
//item.add(new BookmarkablePageLink("viewHotel", org.jboss.seam.example.wicket.Hotel.class).setParameter("hotelId", hotel.getId()));
item.add(new Link("viewHotel")
{
@Begin
@Override
public void onClick()
{
hotelBooking.selectHotel(hotel);
setResponsePage(new org.jboss.seam.example.wicket.Hotel(new PageParameters()));
}
});
}
};
// Set the maximum items per page
hotelDataView.setItemsPerPage(hotelSearchForm.getPageSize());
hotelDataView.setOutputMarkupId(true);
hotels = new WebMarkupContainer("hotels");
hotels.add(hotelDataView).setOutputMarkupId(true);
// Add a pager
hotels.add(new AjaxPagingNavigator("hotelPager", hotelDataView)
{
@Override
public boolean isVisible()
{
return hotelDataView.isVisible();
}
});
body.add(hotels);
/*
* Existing hotel booking
*/
bookedHotelDataView = new DataView("bookedHotel", new SimpleDataProvider()
{
public Iterator iterator(int from, int count)
{
return bookings.subList(from, from + count).iterator();
}