in osgi/log/src/main/java/org/apache/karaf/webconsole/osgi/log/LogsPage.java [59:87]
public LogsPage() {
CompoundPropertyModel<Options> model = new CompoundPropertyModel<Options>(new PropertyModel<Options>(this, "options"));
setDefaultModel(model);
@SuppressWarnings("unchecked")
IColumn<LogEntry, String>[] columns = new IColumn[] {
new AbstractColumn<LogEntry, String>(Model.of("time")) {
public void populateItem(Item<ICellPopulator<LogEntry>> cellItem, String componentId, IModel<LogEntry> rowModel) {
long time = rowModel.getObject().getTime();
DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.FULL);
cellItem.add(new Label(componentId, format.format(new Date(time))));
}
},
new AbstractColumn<LogEntry, String>(Model.of("level")) {
public void populateItem(Item<ICellPopulator<LogEntry>> cellItem, String componentId, IModel<LogEntry> rowModel) {
cellItem.add(new Label(componentId, Priority.valueOf(rowModel.getObject()).name()));
}
},
new PropertyColumnExt<LogEntry>("Bundle", "bundle.symbolicName"),
new PropertyColumnExt<LogEntry>("Version", "bundle.version"),
new PropertyColumnExt<LogEntry>("Message", "message"),
new PropertyColumnExt<LogEntry>("Exception", "exception"),
};
add(new OptionsForm("filters", model));
LogEntriesDataProvider provider = new LogEntriesDataProvider(logReader, options, matchers);
add(new BaseDataTable<LogEntry>("logs", Arrays.asList(columns), provider, 20));
}