configurationDao.checkAndUpdateDatabaseEntries();
final List<IColumn<ConfigurationDO, String>> columns = new ArrayList<IColumn<ConfigurationDO, String>>();
final CellItemListener<ConfigurationDO> cellItemListener = new CellItemListener<ConfigurationDO>() {
public void populateItem(final Item<ICellPopulator<ConfigurationDO>> item, final String componentId, final IModel<ConfigurationDO> rowModel)
{
final ConfigurationDO configuration = rowModel.getObject();
appendCssClasses(item, configuration.getId(), configuration.isDeleted());
}
};
columns.add(new CellItemListenerPropertyColumn<ConfigurationDO>(new Model<String>(getString("administration.configuration.parameter")),
null, null, cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<ConfigurationDO>> item, final String componentId,
final IModel<ConfigurationDO> rowModel)
{
final ConfigurationDO configuration = rowModel.getObject();
item.add(new ListSelectActionPanel(componentId, rowModel, ConfigurationEditPage.class, configuration.getId(),
ConfigurationListPage.this, getString(configuration.getI18nKey())));
addRowClick(item);
cellItemListener.populateItem(item, componentId, rowModel);
}
});
columns.add(new CellItemListenerPropertyColumn<ConfigurationDO>(new Model<String>(getString("administration.configuration.value")),
"value", null, cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<ConfigurationDO>> item, final String componentId, final IModel<ConfigurationDO> rowModel)
{
final ConfigurationDO configuration = rowModel.getObject();
final String value;
if (configuration.getValue() == null) {
value = "";
} else if (configuration.getConfigurationType() == ConfigurationType.TASK) {
final TaskDO task = taskTree.getTaskById(configuration.getTaskId());
if (task != null) {
value = task.getId() + ": " + task.getTitle();
} else {
value = "???";
}
} else {
value = String.valueOf(configuration.getValue());
}
item.add(new Label(componentId, value));
cellItemListener.populateItem(item, componentId, rowModel);
}
});
columns.add(new CellItemListenerPropertyColumn<ConfigurationDO>(new Model<String>(getString("description")), null, null, cellItemListener) {
@Override
public void populateItem(final Item<ICellPopulator<ConfigurationDO>> item, final String componentId, final IModel<ConfigurationDO> rowModel)
{
final ConfigurationDO configuration = rowModel.getObject();
item.add(new Label(componentId, getString(configuration.getDescriptionI18nKey())));
cellItemListener.populateItem(item, componentId, rowModel);
}
});
dataTable = createDataTable(columns, null, SortOrder.ASCENDING);
form.add(dataTable);