use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method initLayout.
protected void initLayout(IModel model, PageBase parentPage) {
PrismObject<ResourceType> resourceObject = (PrismObject<ResourceType>) model.getObject();
ResourceType resource = resourceObject.asObjectable();
add(createLastAvailabilityStatusInfo(resource));
add(createSourceTargetInfo(resource));
add(createSchemaStatusInfo(resource));
CapabilitiesPanel capabilities = new CapabilitiesPanel(PANEL_CAPABILITIES, capabilitiesModel);
add(capabilities);
List<ResourceConfigurationDto> resourceConfigList = createResourceConfigList(resource);
ListDataProvider<ResourceConfigurationDto> resourceConfigProvider = new ListDataProvider<ResourceConfigurationDto>(ResourceDetailsTabPanel.this, new ListModel<ResourceConfigurationDto>(resourceConfigList));
List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<String>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart()), new ColumnTypeDto<String>("ShadowType.objectClass", "objectTypeDefinition.objectClass.localPart", ShadowType.F_OBJECT_CLASS.getLocalPart()), new ColumnTypeDto<String>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<String>("ResourceType.isSync", "sync", null));
List<IColumn<SelectableBean<ResourceType>, String>> tableColumns = ColumnUtils.createColumns(columns);
PropertyColumn tasksColumn = new PropertyColumn(PageBase.createStringResourceStatic(this, "ResourceType.tasks"), "definedTasks") {
@Override
public void populateItem(Item item, String componentId, final IModel rowModel) {
ResourceConfigurationDto conf = (ResourceConfigurationDto) rowModel.getObject();
RepeatingView repeater = new RepeatingView(componentId);
for (final TaskType task : conf.getDefinedTasks()) {
repeater.add(new LinkPanel(repeater.newChildId(), new Model<String>(task.getName().getOrig())) {
@Override
public void onClick(AjaxRequestTarget target) {
ResourceDetailsTabPanel.this.taskDetailsPerformed(target, task.getOid());
}
});
}
item.add(repeater);
}
};
tableColumns.add(tasksColumn);
BoxedTablePanel<ResourceConfigurationDto> resourceConfig = new BoxedTablePanel("resourceConfig", resourceConfigProvider, tableColumns);
resourceConfig.setAdditionalBoxCssClasses("box-success");
add(resourceConfig);
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class PageResources method initResourceColumns.
private List<IColumn<SelectableBean<ResourceType>, String>> initResourceColumns() {
List<IColumn<SelectableBean<ResourceType>, String>> columns = new ArrayList<>();
columns.add(new PropertyColumn(createStringResource("pageResources.connectorType"), SelectableBean.F_VALUE + ".connector.connectorType"));
columns.add(new PropertyColumn(createStringResource("pageResources.version"), SelectableBean.F_VALUE + ".connector.connectorVersion"));
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class PageReports method initColumns.
private List<IColumn<ReportType, String>> initColumns() {
List<IColumn<ReportType, String>> columns = new ArrayList<IColumn<ReportType, String>>();
IColumn column;
column = new LinkColumn<SelectableBean<ReportType>>(createStringResource("PageReports.table.name"), ReportType.F_NAME.getLocalPart(), "value.name") {
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ReportType>> rowModel) {
ReportType report = rowModel.getObject().getValue();
if (report != null) {
reportTypeFilterPerformed(target, report.getOid());
}
}
@Override
public boolean isEnabled(IModel<SelectableBean<ReportType>> rowModel) {
return rowModel.getObject().getValue() != null && rowModel.getObject().getValue().isParent();
}
};
columns.add(column);
column = new PropertyColumn(createStringResource("PageReports.table.description"), "value.description");
columns.add(column);
column = new DoubleButtonColumn<SelectableBean<ReportType>>(new Model(), null) {
@Override
public String getFirstCap() {
return PageReports.this.createStringResource("PageReports.button.run").getString();
}
@Override
public String getSecondCap() {
return PageReports.this.createStringResource("PageReports.button.configure").getString();
}
@Override
public String getFirstColorCssClass() {
if (getRowModel().getObject().getValue() != null && getRowModel().getObject().getValue().isParent()) {
return BUTTON_COLOR_CLASS.PRIMARY.toString();
} else {
return BUTTON_COLOR_CLASS.PRIMARY.toString() + " " + BUTTON_DISABLED;
}
}
@Override
public void firstClicked(AjaxRequestTarget target, IModel<SelectableBean<ReportType>> model) {
runReportPerformed(target, model.getObject().getValue());
}
@Override
public void secondClicked(AjaxRequestTarget target, IModel<SelectableBean<ReportType>> model) {
configurePerformed(target, model.getObject().getValue());
}
@Override
public boolean isFirstButtonEnabled(IModel<SelectableBean<ReportType>> rowModel) {
return getRowModel().getObject().getValue() != null && rowModel.getObject().getValue().isParent();
}
};
columns.add(column);
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn in project midpoint by Evolveum.
the class PageCreatedReports method initColumns.
//TODO - consider adding Author name, File Type and ReportType to columns
private List<IColumn<SelectableBean<ReportOutputType>, String>> initColumns(final AjaxDownloadBehaviorFromStream ajaxDownloadBehavior) {
List<IColumn<SelectableBean<ReportOutputType>, String>> columns = new ArrayList<>();
IColumn column;
column = new CheckBoxHeaderColumn();
columns.add(column);
column = new PropertyColumn(createStringResource("pageCreatedReports.table.name"), "name", "value.name");
columns.add(column);
column = new PropertyColumn(createStringResource("pageCreatedReports.table.description"), "value.description");
columns.add(column);
column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(createStringResource("pageCreatedReports.table.time"), "createTimestamp") {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> rowModel) {
cellItem.add(new DateLabelComponent(componentId, new AbstractReadOnlyModel<Date>() {
@Override
public Date getObject() {
ReportOutputType object = rowModel.getObject().getValue();
MetadataType metadata = object != null ? object.getMetadata() : null;
if (metadata == null) {
return null;
}
return XmlTypeConverter.toDate(metadata.getCreateTimestamp());
}
}, DateLabelComponent.LONG_MEDIUM_STYLE));
}
};
columns.add(column);
column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(new Model(), null) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> model) {
DownloadButtonPanel panel = new DownloadButtonPanel(componentId) {
@Override
protected void deletePerformed(AjaxRequestTarget target) {
deleteSelectedPerformed(target, ReportDeleteDialogDto.Operation.DELETE_SINGLE, model.getObject().getValue());
}
@Override
protected void downloadPerformed(AjaxRequestTarget target) {
currentReport = model.getObject().getValue();
PageCreatedReports.this.downloadPerformed(target, model.getObject().getValue(), ajaxDownloadBehavior);
}
};
cellItem.add(panel);
}
};
columns.add(column);
column = new InlineMenuHeaderColumn<InlineMenuable>(initInlineMenu()) {
@Override
public void populateItem(Item<ICellPopulator<InlineMenuable>> cellItem, String componentId, IModel<InlineMenuable> rowModel) {
cellItem.add(new Label(componentId));
}
};
columns.add(column);
return columns;
}
use of org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn 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);
}
Aggregations