use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.
the class PageTasks method initLayout.
private void initLayout() {
refreshPanel = new AutoRefreshPanel(ID_REFRESH_PANEL, refreshModel, this, false);
add(refreshPanel);
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);
List<IColumn<TaskDto, String>> taskColumns = initTaskColumns();
TaskDtoProviderOptions options = TaskDtoProviderOptions.minimalOptions();
options.setGetNextRunStartTime(true);
options.setUseClusterInformation(true);
options.setResolveObjectRef(true);
TaskDtoProvider provider = new TaskDtoProvider(PageTasks.this, options) {
@Override
protected void saveProviderPaging(ObjectQuery query, ObjectPaging paging) {
TasksStorage storage = getSessionStorage().getTasks();
storage.setPaging(paging);
}
@Override
public TaskDto createTaskDto(PrismObject<TaskType> task, Task opTask, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException {
TaskDto dto = super.createTaskDto(task, opTask, result);
addInlineMenuToTaskRow(dto);
return dto;
}
};
provider.setQuery(createTaskQuery());
BoxedTablePanel<TaskDto> taskTable = new BoxedTablePanel(ID_TASK_TABLE, provider, taskColumns, UserProfileStorage.TableId.PAGE_TASKS_PANEL, (int) getItemsPerPage(UserProfileStorage.TableId.PAGE_TASKS_PANEL)) {
@Override
protected WebMarkupContainer createHeader(String headerId) {
return new SearchFragment(headerId, ID_TABLE_HEADER, PageTasks.this, searchModel);
}
@Override
protected WebMarkupContainer createButtonToolbar(String id) {
String fileName = "TaskType_" + createStringResource("MainObjectListPanel.exportFileName").getString();
CSVDataExporter csvDataExporter = new CSVDataExporter();
ResourceStreamResource resource = (new ResourceStreamResource() {
protected IResourceStream getResourceStream() {
return new ExportToolbar.DataExportResourceStreamWriter(csvDataExporter, getTaskTable().getDataTable());
}
}).setFileName(fileName + "." + csvDataExporter.getFileNameExtension());
AbstractLink exportDataLink = (new ResourceLink(id, resource)).setBody(csvDataExporter.getDataFormatNameModel());
exportDataLink.add(new AttributeAppender("class", " btn btn-primary btn-sm"));
return exportDataLink;
}
};
taskTable.setOutputMarkupId(true);
TasksStorage storage = getSessionStorage().getTasks();
taskTable.setCurrentPage(storage.getPaging());
mainForm.add(taskTable);
List<IColumn<NodeDto, String>> nodeColumns = initNodeColumns();
BoxedTablePanel nodeTable = new BoxedTablePanel(ID_NODE_TABLE, new NodeDtoProvider(PageTasks.this) {
@Override
public NodeDto createNodeDto(PrismObject<NodeType> node) {
NodeDto dto = super.createNodeDto(node);
addInlineMenuToNodeRow(dto);
return dto;
}
}, nodeColumns, UserProfileStorage.TableId.PAGE_TASKS_NODES_PANEL, (int) getItemsPerPage(UserProfileStorage.TableId.PAGE_TASKS_NODES_PANEL));
nodeTable.setOutputMarkupId(true);
nodeTable.setShowPaging(false);
mainForm.add(nodeTable);
initDiagnosticButtons();
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.
the class PageTasks method initNodeColumns.
private List<IColumn<NodeDto, String>> initNodeColumns() {
List<IColumn<NodeDto, String>> columns = new ArrayList<>();
IColumn column = new CheckBoxHeaderColumn<>();
columns.add(column);
column = new PropertyColumn<>(createStringResource("pageTasks.node.name"), "name", "name");
columns.add(column);
columns.add(new EnumPropertyColumn<NodeDto>(createStringResource("pageTasks.node.executionStatus"), "executionStatus") {
@Override
protected String translate(Enum en) {
return createStringResource(en).getString();
}
});
columns.add(new PropertyColumn(createStringResource("pageTasks.node.managementPort"), "managementPort"));
columns.add(new AbstractColumn<NodeDto, String>(createStringResource("pageTasks.node.lastCheckInTime")) {
@Override
public void populateItem(Item<ICellPopulator<NodeDto>> item, String componentId, final IModel<NodeDto> rowModel) {
item.add(new Label(componentId, new AbstractReadOnlyModel<Object>() {
@Override
public Object getObject() {
return createLastCheckInTime(rowModel);
}
}));
}
});
CheckBoxColumn check = new CheckBoxColumn(createStringResource("pageTasks.node.clustered"), "clustered");
check.setEnabled(false);
columns.add(check);
columns.add(new PropertyColumn(createStringResource("pageTasks.node.statusMessage"), "statusMessage"));
IColumn<NodeDto, String> menuColumn = new InlineMenuButtonColumn<NodeDto>(createNodesInlineMenu(false), 2, PageTasks.this) {
@Override
protected int getHeaderNumberOfButtons() {
return 2;
}
@Override
protected List<InlineMenuItem> getHeaderMenuItems() {
return createNodesInlineMenu(true);
}
};
columns.add(menuColumn);
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.
the class PageRoles method initColumns.
private List<IColumn<SelectableBean<RoleType>, String>> initColumns() {
List<IColumn<SelectableBean<RoleType>, String>> columns = new ArrayList<>();
IColumn column = new PropertyColumn(createStringResource("OrgType.displayName"), "value.displayName");
columns.add(column);
column = new PropertyColumn(createStringResource("OrgType.identifier"), "value.identifier");
columns.add(column);
column = new PropertyColumn(createStringResource("ObjectType.description"), "value.description");
columns.add(column);
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.
the class PageAuditLogDetails method initColumns.
private List<IColumn<AuditEventRecordType, String>> initColumns() {
List<IColumn<AuditEventRecordType, String>> columns = new ArrayList<>();
PropertyColumn<AuditEventRecordType, String> timeColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("AuditEventRecordType.timestamp"), AuditEventRecordType.F_TIMESTAMP.getLocalPart()) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId, IModel<AuditEventRecordType> rowModel) {
XMLGregorianCalendar time = rowModel.getObject().getTimestamp();
item.add(new Label(componentId, WebComponentUtil.getLocalizedDate(time, DateLabelComponent.SHORT_SHORT_STYLE)));
}
};
columns.add(timeColumn);
PropertyColumn<AuditEventRecordType, String> stageColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("PageAuditLogViewer.eventStageShortLabel"), AuditEventRecordType.F_EVENT_STAGE.getLocalPart()) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId, IModel<AuditEventRecordType> rowModel) {
AuditEventStageType stage = rowModel.getObject().getEventStage();
String shortStage = "";
if (AuditEventStageType.EXECUTION.equals(stage)) {
shortStage = AuditEventStageType.EXECUTION.value().substring(0, 4);
} else if (AuditEventStageType.REQUEST.equals(stage)) {
shortStage = AuditEventStageType.REQUEST.value().substring(0, 3);
}
item.add(new Label(componentId, shortStage));
}
};
columns.add(stageColumn);
PropertyColumn<AuditEventRecordType, String> typeColumn = new PropertyColumn<AuditEventRecordType, String>(createStringResource("PageAuditLogViewer.eventTypeShortLabel"), AuditEventRecordType.F_EVENT_TYPE.getLocalPart()) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<AuditEventRecordType>> item, String componentId, IModel<AuditEventRecordType> rowModel) {
//TODO create some proper short values
AuditEventTypeType type = rowModel.getObject().getEventType();
String typeVal = type.value().substring(0, 4);
item.add(new Label(componentId, typeVal));
}
};
columns.add(typeColumn);
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn in project midpoint by Evolveum.
the class AssignmentPreviewDialog method initLayout.
public void initLayout() {
List<IColumn<AssignmentsPreviewDto, String>> columns = initColumns();
ListDataProvider provider = new ListDataProvider(pageBase, data);
WebMarkupContainer content = new WebMarkupContainer(ID_CONTENT);
content.setOutputMarkupId(true);
add(content);
TablePanel table = new TablePanel<>(ID_TABLE, provider, columns);
table.setOutputMarkupId(true);
content.add(table);
AjaxButton addButton = new AjaxButton(ID_BUTTON_ADD, createStringResource("userBrowserDialog.button.selectButton")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
List<AssignmentsPreviewDto> previewDtos = data.getObject();
List<AssignmentsPreviewDto> selectedDtos = new ArrayList<>();
for (AssignmentsPreviewDto dto : previewDtos) {
if (dto.isSelected()) {
selectedDtos.add(dto);
}
}
AssignmentPreviewDialog.this.addButtonClicked(target, selectedDtos);
}
};
addButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return multiselect;
}
});
content.add(addButton);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("AssignmentPreviewDialog.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
((PageBase) getPage()).hideMainPopup(ajaxRequestTarget);
}
};
content.add(cancelButton);
}
Aggregations