{
final List<IColumn<BookDO, String>> columns = new ArrayList<IColumn<BookDO, String>>();
final CellItemListener<BookDO> cellItemListener = new CellItemListener<BookDO>() {
public void populateItem(final Item<ICellPopulator<BookDO>> item, final String componentId, final IModel<BookDO> rowModel)
{
final BookDO book = rowModel.getObject();
appendCssClasses(item, book.getId(), book.isDeleted());
}
};
columns.add(new CellItemListenerPropertyColumn<BookDO>(new Model<String>(getString("created")), getSortable("created", sortable),
"created", cellItemListener) {
/**
* @see org.projectforge.web.wicket.CellItemListenerPropertyColumn#populateItem(org.apache.wicket.markup.repeater.Item,
* java.lang.String, org.apache.wicket.model.IModel)
*/
@Override
public void populateItem(final Item<ICellPopulator<BookDO>> item, final String componentId, final IModel<BookDO> rowModel)
{
final BookDO book = rowModel.getObject();
item.add(new ListSelectActionPanel(componentId, rowModel, BookEditPage.class, book.getId(), returnToPage, DateTimeFormatter
.instance().getFormattedDate(book.getCreated())));
addRowClick(item);
cellItemListener.populateItem(item, componentId, rowModel);
}
});
columns.add(new CellItemListenerPropertyColumn<BookDO>(new Model<String>(getString("book.yearOfPublishing.short")), getSortable(
"yearOfPublishing", sortable), "yearOfPublishing", cellItemListener));
columns.add(new CellItemListenerPropertyColumn<BookDO>(new Model<String>(getString("book.signature")), getSortable("signature4Sort",
sortable), "signature", cellItemListener));
columns.add(new CellItemListenerPropertyColumn<BookDO>(new Model<String>(getString("book.authors")), getSortable("authors", sortable),
"authors", cellItemListener));
columns.add(new CellItemListenerPropertyColumn<BookDO>(new Model<String>(getString("book.title")), getSortable("title", sortable),
"title", cellItemListener));
columns.add(new CellItemListenerPropertyColumn<BookDO>(new Model<String>(getString("book.keywords")),
getSortable("keywords", sortable), "keywords", cellItemListener));
columns.add(new CellItemListenerPropertyColumn<BookDO>(new Model<String>(getString("book.lendOutBy")),
getSortable("authors", sortable), "authors", cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<BookDO>> item, final String componentId, final IModel<BookDO> rowModel)
{
final BookDO book = rowModel.getObject();
final StringBuffer buf = new StringBuffer();
if (book.getLendOutBy() != null) {
buf.append(userFormatter.formatUser(book.getLendOutBy()));
buf.append(" ");
DateTimeFormatter.instance().getFormattedDate(book.getLendOutDate());
}
if (StringUtils.isNotEmpty(book.getLendOutComment()) == true) {
buf.append(" ").append(book.getLendOutComment());
}
final String htmlString = HtmlHelper.escapeXml(buf.toString());
final Label label = new Label(componentId, new Model<String>(htmlString));
label.setEscapeModelStrings(false);
item.add(label);