use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.
the class AddCapabilityDialog method initLayout.
private void initLayout(WebMarkupContainer container) {
List<IColumn<CapabilityDto<CapabilityType>, String>> columns = initColumns();
TablePanel<CapabilityDto<CapabilityType>> table = new TablePanel<>(ID_TABLE, createProvider(), columns);
table.setOutputMarkupId(true);
table.setShowPaging(false);
container.add(table);
AjaxButton cancelButton = new AjaxButton(ID_CANCEL, createStringResource("addCapabilityDialog.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
cancelPerformed(ajaxRequestTarget);
}
};
container.add(cancelButton);
AjaxButton addButton = new AjaxButton(ID_ADD, createStringResource("addCapabilityDialog.button.Add")) {
@Override
public void onClick(AjaxRequestTarget target) {
addPerformed(target);
}
};
container.add(addButton);
}
use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.
the class TaskResultTabPanel method initLayout.
private void initLayout(final IModel<TaskDto> taskDtoModel, final PageBase pageBase) {
SortableDataProvider<OperationResult, String> provider = new ListDataProvider<>(this, new PropertyModel<List<OperationResult>>(taskDtoModel, TaskDto.F_OP_RESULT));
TablePanel resultTablePanel = new TablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
resultTablePanel.setStyle("padding-top: 0px;");
resultTablePanel.setShowPaging(false);
resultTablePanel.setOutputMarkupId(true);
add(resultTablePanel);
add(new AjaxFallbackLink(ID_SHOW_RESULT) {
public void onClick(AjaxRequestTarget target) {
OperationResult opResult = taskDtoModel.getObject().getTaskOperationResult();
OperationResultPanel body = new OperationResultPanel(pageBase.getMainPopupBodyId(), new Model<>(OpResult.getOpResult(pageBase, opResult)), pageBase);
body.setOutputMarkupId(true);
pageBase.showMainPopup(body, target);
}
});
}
use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.
the class TaskSubtasksAndThreadsTabPanel method initLayout.
private void initLayout(final IModel<TaskDto> taskDtoModel) {
WebMarkupContainer threadsConfigurationPanel = new WebMarkupContainer(ID_THREADS_CONFIGURATION_PANEL);
add(threadsConfigurationPanel);
threadsConfigurationPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return taskDtoModel.getObject().configuresWorkerThreads();
}
});
final TextField<Integer> workerThreads = new TextField<>(ID_WORKER_THREADS, new PropertyModel<Integer>(taskDtoModel, TaskDto.F_WORKER_THREADS));
workerThreads.setOutputMarkupId(true);
workerThreads.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return parentPage.isEdit();
}
});
threadsConfigurationPanel.add(workerThreads);
VisibleEnableBehaviour hiddenWhenEditingOrNoSubtasks = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !parentPage.isEdit() && !taskDtoModel.getObject().getSubtasks().isEmpty();
}
};
Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
subtasksLabel.add(hiddenWhenEditingOrNoSubtasks);
add(subtasksLabel);
SubtasksPanel subtasksPanel = new SubtasksPanel(ID_SUBTASKS_PANEL, new PropertyModel<List<TaskDto>>(taskDtoModel, TaskDto.F_SUBTASKS), parentPage.getWorkflowManager().isEnabled());
subtasksPanel.add(hiddenWhenEditingOrNoSubtasks);
add(subtasksPanel);
VisibleEnableBehaviour hiddenWhenNoSubtasks = new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
TaskDto taskDto = taskDtoModel.getObject();
return taskDto != null && !taskDto.getTransientSubtasks().isEmpty();
}
};
Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
workerThreadsTableLabel.add(hiddenWhenNoSubtasks);
add(workerThreadsTableLabel);
List<IColumn<WorkerThreadDto, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn(createStringResourceStatic(this, "TaskStatePanel.subtaskName"), WorkerThreadDto.F_NAME));
columns.add(new EnumPropertyColumn<WorkerThreadDto>(createStringResourceStatic(this, "TaskStatePanel.subtaskState"), WorkerThreadDto.F_EXECUTION_STATUS));
columns.add(new PropertyColumn(createStringResourceStatic(this, "TaskStatePanel.subtaskObjectsProcessed"), WorkerThreadDto.F_PROGRESS));
ISortableDataProvider<WorkerThreadDto, String> threadsProvider = new ListDataProvider<>(this, new AbstractReadOnlyModel<List<WorkerThreadDto>>() {
@Override
public List<WorkerThreadDto> getObject() {
List<WorkerThreadDto> rv = new ArrayList<>();
TaskDto taskDto = taskDtoModel.getObject();
if (taskDto != null) {
for (TaskDto subtaskDto : taskDto.getTransientSubtasks()) {
rv.add(new WorkerThreadDto(subtaskDto));
}
}
return rv;
}
});
TablePanel<WorkerThreadDto> workerThreadsTablePanel = new TablePanel<>(ID_WORKER_THREADS_TABLE, threadsProvider, columns);
workerThreadsTablePanel.add(hiddenWhenNoSubtasks);
add(workerThreadsTablePanel);
}
use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.
the class MyAccountsPanel method initLayout.
@Override
protected void initLayout() {
List<IColumn<SimpleAccountDto, String>> columns = new ArrayList<IColumn<SimpleAccountDto, String>>();
columns.add(new PropertyColumn(createStringResource("MyAccountsPanel.account.name"), "accountName"));
columns.add(new PropertyColumn(createStringResource("MyAccountsPanel.account.resource"), "resourceName"));
ISortableDataProvider provider = new ListDataProvider(this, getModel());
TablePanel accountsTable = new TablePanel<SimpleAccountDto>(ID_ACCOUNTS_TABLE, provider, columns);
accountsTable.setShowPaging(false);
add(accountsTable);
}
use of com.evolveum.midpoint.web.component.data.TablePanel in project midpoint by Evolveum.
the class MyAssignmentsPanel method initLayout.
private void initLayout() {
List<IColumn<AssignmentItemDto, String>> columns = new ArrayList<IColumn<AssignmentItemDto, String>>();
columns.add(new IconColumn<AssignmentItemDto>(null) {
private static final long serialVersionUID = 1L;
@Override
protected IModel<String> createIconModel(final IModel<AssignmentItemDto> rowModel) {
return new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
AssignmentItemDto item = rowModel.getObject();
if (item.getType() == null) {
return OperationResultStatusPresentationProperties.FATAL_ERROR.getIcon() + " fa-lg";
}
return item.getType().getIconCssClass();
}
};
}
@Override
protected IModel<String> createTitleModel(final IModel<AssignmentItemDto> rowModel) {
return new AbstractReadOnlyModel<String>() {
private static final long serialVersionUID = 1L;
@Override
public String getObject() {
AssignmentItemDto item = rowModel.getObject();
if (item.getType() == null) {
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.error");
}
switch(item.getType()) {
case CONSTRUCTION:
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.accountConstruction");
case ORG_UNIT:
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.orgUnit");
case ROLE:
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.role");
default:
return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.error");
}
}
};
}
});
columns.add(new AbstractColumn<AssignmentItemDto, String>(createStringResource("MyAssignmentsPanel.assignment.displayName")) {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<AssignmentItemDto>> cellItem, String componentId, final IModel<AssignmentItemDto> rowModel) {
AssignmentHeaderPanel panel = new AssignmentHeaderPanel(componentId, rowModel);
panel.add(new AttributeModifier("class", "dash-assignment-header"));
cellItem.add(panel);
}
});
ISortableDataProvider provider = new ListDataProvider(this, getModel());
TablePanel accountsTable = new TablePanel<AssignmentItemDto>(ID_ASSIGNMETNS_TABLE, provider, columns);
accountsTable.setShowPaging(false);
add(accountsTable);
}
Aggregations