{
final List<IColumn<ScriptDO, String>> columns = new ArrayList<IColumn<ScriptDO, String>>();
final CellItemListener<ScriptDO> cellItemListener = new CellItemListener<ScriptDO>() {
public void populateItem(final Item<ICellPopulator<ScriptDO>> item, final String componentId, final IModel<ScriptDO> rowModel)
{
final ScriptDO script = rowModel.getObject();
appendCssClasses(item, script.getId(), script.isDeleted());
}
};
columns.add(new CellItemListenerPropertyColumn<ScriptDO>(new Model<String>(getString("scripting.script.name")), "name", "name",
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<ScriptDO>> item, final String componentId, final IModel<ScriptDO> rowModel)
{
final ScriptDO script = rowModel.getObject();
item.add(new ListSelectActionPanel(componentId, rowModel, ScriptExecutePage.class, script.getId(), ScriptListPage.this, script
.getName()));
cellItemListener.populateItem(item, componentId, rowModel);
addRowClick(item);
}
});
columns.add(new CellItemListenerPropertyColumn<ScriptDO>(new Model<String>(getString("description")), "description", "description",
cellItemListener));
columns.add(new AbstractColumn<ScriptDO, String>(new Model<String>(getString("scripting.script.parameter"))) {
public void populateItem(final Item<ICellPopulator<ScriptDO>> cellItem, final String componentId, final IModel<ScriptDO> rowModel)
{
final ScriptDO script = rowModel.getObject();
final Label label = new Label(componentId, new Model<String>(script.getParameterNames(true)));
cellItem.add(label);
cellItemListener.populateItem(cellItem, componentId, rowModel);
}
});
dataTable = createDataTable(columns, "name", SortOrder.ASCENDING);