use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.
the class TaskSubtasksAndThreadsTabPanel method initLayout.
private void initLayout() {
Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
add(subtasksLabel);
TaskTablePanel subtasksPanel = new TaskTablePanel(ID_SUBTASKS_PANEL, createOperationOptions()) {
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> createSubtasksQuery(), null);
}
@Override
protected List<IColumn<SelectableBean<TaskType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<TaskType>, String>> columns = super.createDefaultColumns();
// });
return columns;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_SUBTASKS;
}
@Override
@NotNull
protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, rootTaskModel.getObject());
}
};
add(subtasksPanel);
Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
add(workerThreadsTableLabel);
TaskTablePanel workerThreadsTable = new TaskTablePanel(ID_WORKER_THREADS_TABLE, null) {
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return new SelectableListDataProvider<>(TaskSubtasksAndThreadsTabPanel.this, createWorkersModel());
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_WORKERS;
}
@Override
protected boolean isHeaderVisible() {
return false;
}
@Override
@NotNull
protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, rootTaskModel.getObject());
}
};
add(workerThreadsTable);
}
use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.
the class TaskResultTabPanel method initResultColumns.
private List<IColumn<SelectableBean<OperationResult>, String>> initResultColumns() {
List<IColumn<SelectableBean<OperationResult>, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.token"), createPropertyExpression("token")));
columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.operation"), createPropertyExpression("operation")));
columns.add(new PropertyColumn<>(createStringResource("pageTaskEdit.opResult.status"), createPropertyExpression("status")));
columns.add(new AbstractColumn<SelectableBean<OperationResult>, String>(createStringResource("pageTaskEdit.opResult.timestamp")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<OperationResult>>> cellItem, String componentId, IModel<SelectableBean<OperationResult>> rowModel) {
Label label = new Label(componentId, (IModel<String>) () -> {
Long resultEndTime = rowModel.getObject().getValue().getEnd();
return resultEndTime != null && resultEndTime > 0 ? WebComponentUtil.getShortDateTimeFormattedValue(new Date(resultEndTime), getPageBase()) : "";
});
cellItem.add(label);
}
});
columns.add(new AbstractColumn<SelectableBean<OperationResult>, String>(createStringResource("pageTaskEdit.opResult.message"), createPropertyExpression("message")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<OperationResult>>> cellItem, String componentId, IModel<SelectableBean<OperationResult>> rowModel) {
Label label = new Label(componentId, (IModel<String>) () -> WebComponentUtil.nl2br(rowModel.getObject().getValue().getMessage()));
label.setEscapeModelStrings(false);
cellItem.add(label);
}
});
// columns.add(new PropertyColumn(createStringResource("pageTaskEdit.opResult.message"), "message"));
return columns;
}
use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.
the class TaskResultPanel method initLayout.
protected void initLayout() {
IModel<List<OperationResult>> resultModel = new ReadOnlyModel<>(this::createOperationResultList);
SelectableListDataProvider<SelectableBean<OperationResult>, OperationResult> provider = new SelectableListDataProvider<>(this, resultModel);
BoxedTablePanel<SelectableBean<OperationResult>> resultTablePanel = new BoxedTablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
resultTablePanel.setOutputMarkupId(true);
add(resultTablePanel);
AjaxFallbackLink<Void> showResult = new AjaxFallbackLink<>(ID_SHOW_RESULT) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(Optional<AjaxRequestTarget> optionalTarget) {
if (optionalTarget.isEmpty()) {
LOGGER.warn("Cannot show result in interactive way, request target not present.");
return;
}
AjaxRequestTarget target = optionalTarget.get();
OperationResultPopupPanel body = new OperationResultPopupPanel(getPageBase().getMainPopupBodyId(), new Model<>(getTaskOperationResult()));
body.setOutputMarkupId(true);
getPageBase().showMainPopup(body, target);
}
};
showResult.add(new VisibleBehaviour(() -> getTaskOperationResult() != null));
showResult.setOutputMarkupId(true);
add(showResult);
}
use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.
the class TaskSubtasksAndThreadsPanel method initLayout.
protected void initLayout() {
Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
add(subtasksLabel);
TaskTablePanel subtasksPanel = new TaskTablePanel(ID_SUBTASKS_PANEL, createOperationOptions()) {
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> createSubtasksQuery(), null);
}
@Override
protected List<Component> createToolbarButtonsList(String buttonId) {
return new ArrayList<>();
}
@Override
protected List<IColumn<SelectableBean<TaskType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<TaskType>, String>> columns = super.createDefaultColumns();
// });
return columns;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_SUBTASKS;
}
@Override
@NotNull
protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, getObjectDetailsModels().getRootTaskModelObject());
}
};
add(subtasksPanel);
Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
add(workerThreadsTableLabel);
TaskTablePanel workerThreadsTable = new TaskTablePanel(ID_WORKER_THREADS_TABLE, null) {
@Override
protected ISelectableDataProvider<TaskType, SelectableBean<TaskType>> createProvider() {
return new SelectableListDataProvider<>(TaskSubtasksAndThreadsPanel.this, createWorkersModel());
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.TABLE_WORKERS;
}
@Override
protected boolean isHeaderVisible() {
return false;
}
@Override
protected List<Component> createToolbarButtonsList(String buttonId) {
return new ArrayList<>();
}
@Override
@NotNull
protected TaskInformation getAttachedTaskInformation(SelectableBean<TaskType> selectableTaskBean) {
return TaskInformationUtil.getOrCreateInfo(selectableTaskBean, getObjectDetailsModels().getRootTaskModelObject());
}
};
add(workerThreadsTable);
}
use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.
the class SearchPropertiesConfigPanel method initTable.
private void initTable(WebMarkupContainer configPanel) {
List<IColumn<SelectableBean<ValueSearchFilterItem>, String>> columns = getTableColumns();
BoxedTablePanel<SelectableBean<ValueSearchFilterItem>> table = new BoxedTablePanel<SelectableBean<ValueSearchFilterItem>>(ID_PROPERTIES_TABLE, provider, columns) {
private static final long serialVersionUID = 1L;
@Override
protected WebMarkupContainer createHeader(String headerId) {
return new WebMarkupContainer(headerId);
}
@Override
public String getAdditionalBoxCssClasses() {
return null;
}
@Override
protected WebMarkupContainer createButtonToolbar(String id) {
AjaxButton addRowButton = new AjaxButton(id) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
propertyAddedPerformed(ajaxRequestTarget);
}
};
addRowButton.setOutputMarkupId(true);
addRowButton.add(AttributeAppender.append("class", "btn btn-sm btn-default fa fa-plus"));
addRowButton.add(AttributeAppender.append("style", "color: green;"));
return addRowButton;
}
@Override
protected boolean hideFooterIfSinglePage() {
return true;
}
@Override
public int getAutoRefreshInterval() {
return 0;
}
@Override
public boolean isAutoRefreshEnabled() {
return false;
}
};
table.setOutputMarkupId(true);
configPanel.add(table);
}
Aggregations