use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class PageCreatedReports method initInlineMenu.
private List<InlineMenuItem> initInlineMenu() {
List<InlineMenuItem> menuItems = new ArrayList<>();
// menuItems.add(new InlineMenuItem(createStringResource("pageCreatedReports.inlineMenu.deleteAll")) {
// private static final long serialVersionUID = 1L;
//
// @Override
// public InlineMenuItemAction initAction() {
// return new HeaderMenuAction(PageCreatedReports.this) {
// private static final long serialVersionUID = 1L;
//
// @Override
// public void onClick(AjaxRequestTarget target) {
// deleteAllPerformed(target, ReportDeleteDialogDto.Operation.DELETE_ALL);
// }
// };
// }
// });
menuItems.add(new ButtonInlineMenuItem(createStringResource("pageCreatedReports.button.delete")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportDataType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportDataType report = null;
if (getRowModel() != null) {
SelectableBeanImpl<ReportDataType> rowDto = getRowModel().getObject();
report = rowDto.getValue();
}
deleteSelectedPerformed(target, ReportDeleteDialogDto.Operation.DELETE_SELECTED, report);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-minus");
}
});
boolean canViewTraces;
boolean canReadTraces;
try {
canReadTraces = isAuthorized(ModelAuthorizationAction.READ_TRACE.getUrl());
} catch (Throwable t) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't authorize reading traces", t);
canReadTraces = false;
}
canViewTraces = canReadTraces && WebModelServiceUtils.isEnableExperimentalFeature(this);
ButtonInlineMenuItem item = new ButtonInlineMenuItem(createStringResource("DownloadButtonPanel.download")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportDataType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ReportDataType> rowDto = getRowModel().getObject();
currentReport = rowDto.getValue();
downloadPerformed(target, ajaxDownloadBehavior);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-download");
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
};
if (!canReadTraces) {
item.setVisibilityChecker((rowModel, isHeader) -> !isTrace(rowModel));
}
menuItems.add(item);
ButtonInlineMenuItem viewTraceItem = new ButtonInlineMenuItem(createStringResource("DownloadButtonPanel.viewTrace")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportDataType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
SelectableBeanImpl<ReportDataType> rowDto = getRowModel().getObject();
currentReport = rowDto.getValue();
PageParameters parameters = new PageParameters();
parameters.add(PageTraceView.PARAM_OBJECT_ID, currentReport.getOid());
navigateToNext(PageTraceView.class, parameters);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-eye");
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
};
menuItems.add(viewTraceItem);
viewTraceItem.setVisibilityChecker((rowModel, isHeader) -> canViewTraces && isTrace(rowModel));
return menuItems;
}
use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class PageReports method createInlineMenu.
private List<InlineMenuItem> createInlineMenu() {
List<InlineMenuItem> menu = new ArrayList<>();
ButtonInlineMenuItem runButton = new ButtonInlineMenuItem(createStringResource("PageReports.button.run")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportType report = getRowModel().getObject().getValue();
com.evolveum.midpoint.web.page.admin.reports.PageReport.runReportPerformed(target, report.asPrismObject(), PageReports.this);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_START_MENU_ITEM);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
};
runButton.setVisibilityChecker((rowModel, isHeader) -> !isImportReport((IModel<SelectableBean<ReportType>>) rowModel));
menu.add(runButton);
ButtonInlineMenuItem importButton = new ButtonInlineMenuItem(createStringResource("PageReports.button.import")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportType report = getRowModel().getObject().getValue();
com.evolveum.midpoint.web.page.admin.reports.PageReport.importReportPerformed(target, report.asPrismObject(), PageReports.this);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_UPLOAD);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
};
importButton.setVisibilityChecker((rowModel, isHeader) -> isImportReport((IModel<SelectableBean<ReportType>>) rowModel));
menu.add(importButton);
menu.add(new ButtonInlineMenuItem(createStringResource("PageReports.button.configure")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportType reportObject = getRowModel().getObject().getValue();
configurePerformed(target, reportObject);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_EDIT_MENU_ITEM);
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
menu.add(new ButtonInlineMenuItem(createStringResource("PageReports.button.showOutput")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<SelectableBeanImpl<ReportType>>() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
ReportType reportObject = getRowModel().getObject().getValue();
PageParameters pageParameters = new PageParameters();
pageParameters.add(OnePageParameterEncoder.PARAMETER, reportObject.getOid());
navigateToNext(PageCreatedReports.class, pageParameters);
}
};
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder("fa fa-files-o");
}
@Override
public boolean isHeaderMenuItem() {
return false;
}
});
return menu;
}
use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class ObjectDataProvider method internalIterator.
@Override
public Iterator<W> internalIterator(long first, long count) {
LOGGER.trace("begin::iterator() from {} count {}.", first, count);
for (W available : getAvailableData()) {
if (available instanceof SelectableBeanImpl) {
SelectableBeanImpl<O> selectableBean = (SelectableBeanImpl<O>) available;
if (selectableBean.isSelected() && selectableBean.getValue() != null) {
selected.add(selectableBean.getValue());
}
}
}
for (W available : getAvailableData()) {
if (available instanceof SelectableBeanImpl) {
SelectableBeanImpl<O> selectableBean = (SelectableBeanImpl<O>) available;
if (!selectableBean.isSelected()) {
selected.remove(selectableBean.getValue());
}
}
}
getAvailableData().clear();
OperationResult result = new OperationResult(OPERATION_SEARCH_OBJECTS);
try {
ObjectPaging paging = createPaging(first, count);
Task task = getPageBase().createSimpleTask(OPERATION_SEARCH_OBJECTS);
ObjectQuery query = getQuery();
if (query == null) {
query = getPrismContext().queryFactory().createQuery();
}
query.setPaging(paging);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Query {} with {}", getType().getSimpleName(), query.debugDump());
}
List<PrismObject<O>> list = getModel().searchObjects(getType(), query, getOptionsToUse(), task, result);
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Query {} resulted in {} objects", getType().getSimpleName(), list.size());
}
for (PrismObject<O> object : list) {
getAvailableData().add(createDataObjectWrapper(object));
}
} catch (Exception ex) {
result.recordFatalError(getPageBase().createStringResource("ObjectDataProvider.message.listObjects.fatalError").getString(), ex);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't list objects", ex);
} finally {
result.computeStatusIfUnknown();
}
if (!WebComponentUtil.isSuccessOrHandledError(result)) {
handleNotSuccessOrHandledErrorInIterator(result);
}
LOGGER.trace("end::iterator()");
return getAvailableData().iterator();
}
use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class TreeTablePanel method moveRootPerformed.
private void moveRootPerformed(final TreeSelectableBean<OrgType> root, AjaxRequestTarget target) {
OrgTreeAssignablePanel orgAssignablePanel = new OrgTreeAssignablePanel(parentPage.getMainPopupBodyId(), false) {
private static final long serialVersionUID = 1L;
@Override
protected void onItemSelect(SelectableBeanImpl<OrgType> selected, AjaxRequestTarget target) {
moveConfirmPerformed(root, selected, target);
}
@SuppressWarnings("unchecked")
@Override
protected OrgType getAssignmentOwnerObject() {
return root.getValue();
}
};
orgAssignablePanel.setOutputMarkupId(true);
parentPage.showMainPopup(orgAssignablePanel, target);
}
use of com.evolveum.midpoint.web.component.util.SelectableBeanImpl in project midpoint by Evolveum.
the class ResourceDetailsTabPanel method initLayout.
protected void initLayout() {
// PrismObject<ResourceType> resourceObject = getObjectWrapper().getObject();
// ResourceType resource = resourceObject.asObjectable();
add(createLastAvailabilityStatusInfo());
add(createSourceTargetInfo());
add(createSchemaStatusInfo());
CapabilitiesPanel capabilities = new CapabilitiesPanel(PANEL_CAPABILITIES, capabilitiesModel);
add(capabilities);
ListDataProvider<ResourceConfigurationDto> resourceConfigProvider = new ListDataProvider<>(ResourceDetailsTabPanel.this, createResourceConfigListModel());
List<IColumn<SelectableBeanImpl<ResourceType>, String>> tableColumns = new ArrayList<>();
tableColumns.add(ColumnUtils.createPropertyColumn(new ColumnTypeDto<>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart())));
tableColumns.add(new PropertyColumn<>(createStringResource("ShadowType.objectClass"), "objectTypeDefinition.objectClass") {
@Override
public IModel<?> getDataModel(IModel<SelectableBeanImpl<ResourceType>> rowModel) {
IModel<QName> model = (IModel<QName>) super.getDataModel(rowModel);
if (model.getObject() != null) {
return () -> model.getObject().getLocalPart();
}
return model;
}
});
List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<>("ResourceType.isSync", "sync", null));
tableColumns.addAll(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 AjaxLinkPanel(repeater.newChildId(), new Model<>(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);
}
Aggregations