use of com.evolveum.midpoint.web.component.data.BoxedTablePanel in project midpoint by Evolveum.
the class StatisticsPanel method initLayout.
protected void initLayout() {
contentsPanel = new WebMarkupContainer(ID_CONTENTS_PANEL);
contentsPanel.setOutputMarkupId(true);
add(contentsPanel);
ListView<ProvisioningStatisticsLineDto> provisioningLines = new ListView<>(ID_PROVISIONING_STATISTICS_LINES, new PropertyModel<>(getModel(), StatisticsDto.F_PROVISIONING_LINES)) {
protected void populateItem(final ListItem<ProvisioningStatisticsLineDto> item) {
ListDataProvider<ProvisioningStatisticsOperationDto> provider = new ListDataProvider<>(StatisticsPanel.this, new PropertyModel<>(item.getModel(), ProvisioningStatisticsLineDto.F_OPERATIONS));
BoxedTablePanel<ProvisioningStatisticsOperationDto> provisioningTable = new BoxedTablePanel<>(ID_PROVISIONING_OPERATIONS, provider, createProvisioningStatisticsColumns()) {
private static final long serialVersionUID = 1L;
@Override
protected WebMarkupContainer createHeader(String headerId) {
return new ProvisioningStatisticsHeaderFragment(headerId, ID_PROVISIONING_TITLE, StatisticsPanel.this, item.getModel());
}
@Override
protected Item<ProvisioningStatisticsOperationDto> customizeNewRowItem(Item<ProvisioningStatisticsOperationDto> item, IModel<ProvisioningStatisticsOperationDto> model) {
item.add(AttributeModifier.append("class", new ReadOnlyModel<>(() -> {
if (model.getObject() != null && OperationResultStatusType.FATAL_ERROR == model.getObject().getStatus()) {
return "bg-red disabled color-palette";
}
return null;
})));
return item;
}
@Override
protected boolean hideFooterIfSinglePage() {
return true;
}
};
provisioningTable.setOutputMarkupId(true);
provisioningTable.add(new VisibleBehaviour(() -> hasAnyOperation(item.getModelObject())));
item.add(provisioningTable);
}
};
contentsPanel.add(provisioningLines);
ListDataProvider<MappingsLineDto> mappingsProvider = new ListDataProvider<>(this, new PropertyModel<>(getModel(), StatisticsDto.F_MAPPINGS_LINES));
BoxedTablePanel<MappingsLineDto> mappingsLines = new BoxedTablePanel<>(ID_MAPPINGS_STATISTICS_LINES, mappingsProvider, createMappingsColumn()) {
private static final long serialVersionUID = 1L;
@Override
protected WebMarkupContainer createHeader(String headerId) {
return new TableHeaderFragment(headerId, ID_MAPPINGS_TITLE, StatisticsPanel.this, createStringResource("Title.MappingsStatistics"));
}
@Override
protected boolean hideFooterIfSinglePage() {
return true;
}
};
mappingsLines.setOutputMarkupId(true);
contentsPanel.add(mappingsLines);
ListDataProvider<NotificationsLineDto> notificationsProvider = new ListDataProvider<>(this, new PropertyModel<>(getModel(), StatisticsDto.F_NOTIFICATIONS_LINES));
BoxedTablePanel<NotificationsLineDto> notificationsLines = new BoxedTablePanel<>(ID_NOTIFICATIONS_STATISTICS_LINES, notificationsProvider, createNotificationColumns()) {
private static final long serialVersionUID = 1L;
@Override
protected WebMarkupContainer createHeader(String headerId) {
return new TableHeaderFragment(headerId, ID_NOTIFICATIONS_TITLE, StatisticsPanel.this, createStringResource("Title.NotificationsStatistics"));
}
@Override
protected boolean hideFooterIfSinglePage() {
return true;
}
};
notificationsLines.setOutputMarkupId(true);
contentsPanel.add(notificationsLines);
Label lastMessage = new Label(ID_LAST_MESSAGE, new PropertyModel<>(getModel(), StatisticsDto.F_LAST_MESSAGE));
contentsPanel.add(lastMessage);
}
use of com.evolveum.midpoint.web.component.data.BoxedTablePanel in project midpoint by Evolveum.
the class TaskResultTabPanel method initLayout.
private void initLayout() {
IModel<List<OperationResult>> resultModel = new ReadOnlyModel<>(() -> 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<Void>(ID_SHOW_RESULT) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(Optional<AjaxRequestTarget> optionalTarget) {
if (!optionalTarget.isPresent()) {
LOGGER.warn("Cannot show result in interactive way, request target not present.");
return;
}
AjaxRequestTarget target = optionalTarget.get();
PrismObjectWrapper<TaskType> taskWrapper = TaskResultTabPanel.this.getModelObject();
TaskType taskType = taskWrapper.getObject().asObjectable();
OperationResult opResult = OperationResult.createOperationResult(taskType.getResult());
OpResult result = opResult != null ? OpResult.getOpResult(getPageBase(), opResult) : null;
OperationResultPanel body = new OperationResultPanel(getPageBase().getMainPopupBodyId(), new Model<>(result));
body.add(new VisibleBehaviour(() -> opResult != null));
body.setOutputMarkupId(true);
getPageBase().showMainPopup(body, target);
}
};
showResult.setOutputMarkupId(true);
add(showResult);
}
use of com.evolveum.midpoint.web.component.data.BoxedTablePanel in project midpoint by Evolveum.
the class TaskErrorsTabPanel method initLayoutOld.
private void initLayoutOld() {
SelectableBeanObjectDataProvider<? extends ObjectType> provider = new SelectableBeanObjectDataProvider<>(this, null) {
@Override
public SelectableBean<ObjectType> createDataObjectWrapper(ObjectType obj) {
return new TaskErrorSelectableBeanImplOld<>(obj, getModelObject().getOid());
}
@Override
public ObjectQuery getQuery() {
return createContentQuery(getModelObject().getOid(), getPageBase());
}
@NotNull
@Override
protected List<ObjectOrdering> createObjectOrderings(SortParam<String> sortParam) {
if (sortParam != null && sortParam.getProperty() != null) {
OrderDirection order = sortParam.isAscending() ? OrderDirection.ASCENDING : OrderDirection.DESCENDING;
ItemPath ordering;
if (sortParam.getProperty().equals(TaskErrorSelectableBeanImplOld.F_ERROR_TIMESTAMP)) {
ordering = ItemPath.create("operationExecution", "timestamp");
} else {
ordering = ItemPath.create(new QName(SchemaConstantsGenerated.NS_COMMON, sortParam.getProperty()));
}
return Collections.singletonList(getPrismContext().queryFactory().createOrdering(ordering, order));
} else {
return Collections.emptyList();
}
}
@Override
public Class<ObjectType> getType() {
return ObjectType.class;
}
};
BoxedTablePanel<TaskErrorSelectableBeanImplOld<ObjectType>> table = new BoxedTablePanel<>(ID_TASK_ERRORS, provider, initColumnsOld());
table.setOutputMarkupId(true);
add(table);
}
use of com.evolveum.midpoint.web.component.data.BoxedTablePanel in project midpoint by Evolveum.
the class AssignmentsInfoDialog method initLayout.
public void initLayout(PageBase pageBase) {
List<IColumn<AssignmentInfoDto, String>> columns = initColumns();
ListDataProvider<AssignmentInfoDto> provider = new ListDataProvider<>(pageBase, getModel());
WebMarkupContainer content = new WebMarkupContainer(ID_CONTENT);
content.setOutputMarkupId(true);
add(content);
BoxedTablePanel<AssignmentInfoDto> table = new BoxedTablePanel<AssignmentInfoDto>(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<AssignmentInfoDto> allAssignmentInfoDtos = AssignmentsInfoDialog.this.getModelObject();
List<AssignmentInfoDto> selectedDtos = allAssignmentInfoDtos.stream().filter(AssignmentInfoDto::isSelected).collect(Collectors.toList());
AssignmentsInfoDialog.this.addButtonClicked(target, selectedDtos);
}
};
addButton.setVisible(enableMultiSelect());
content.add(addButton);
AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("AssignmentPreviewDialog.button.cancel")) {
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
getPageBase().hideMainPopup(ajaxRequestTarget);
}
};
cancelButton.add(new VisibleBehaviour(() -> showCancelButton()));
content.add(cancelButton);
}
Aggregations