use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.
the class AssignmentHolderOperationalButtonsPanel method changeArchetypeButtonClicked.
private void changeArchetypeButtonClicked(AjaxRequestTarget target) {
AssignmentPopup changeArchetypePopup = new AssignmentPopup(getPageBase().getMainPopupBodyId(), Model.of(new AssignmentPopupDto(null))) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List<AssignmentType> newAssignmentsList) {
addArchetypePerformed(target, newAssignmentsList);
}
@Override
protected List<ITab> createAssignmentTabs(AssignmentObjectRelation assignmentObjectRelation) {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(getPageBase().createStringResource("ObjectTypes.ARCHETYPE"), new VisibleBehaviour(() -> true)) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new FocusTypeAssignmentPopupTabPanel<ArchetypeType>(panelId, ObjectTypes.ARCHETYPE, null) {
private static final long serialVersionUID = 1L;
@Override
protected PrismContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
PrismContainerWrapper<AssignmentType> assignmentsWrapper = null;
try {
assignmentsWrapper = AssignmentHolderOperationalButtonsPanel.this.getModelObject().findContainer(FocusType.F_ASSIGNMENT);
} catch (SchemaException e) {
LOGGER.error("Cannot find assignment wrapper: {}", e.getMessage());
}
return assignmentsWrapper;
}
@Override
protected List<QName> getSupportedRelations() {
return Collections.singletonList(SchemaConstants.ORG_DEFAULT);
}
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<ArchetypeType>> rowModel) {
target.add(getObjectListPanel());
tabLabelPanelUpdate(target);
}
@Override
protected IModel<Boolean> getObjectSelectCheckBoxEnableModel(IModel<SelectableBean<ArchetypeType>> rowModel) {
if (rowModel == null) {
return Model.of(false);
}
List selectedObjects = getSelectedObjectsList();
return Model.of(selectedObjects == null || selectedObjects.size() == 0 || (rowModel.getObject() != null && rowModel.getObject().isSelected()));
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.ARCHETYPE;
}
@Override
protected ObjectQuery addFilterToContentQuery() {
ObjectQuery query = super.addFilterToContentQuery();
if (query == null) {
query = getPrismContext().queryFactory().createQuery();
}
List<String> archetypeOidsList = getArchetypeOidsListToAssign();
ObjectFilter filter = getPrismContext().queryFor(ArchetypeType.class).id(archetypeOidsList.toArray(new String[0])).buildFilter();
query.addFilter(filter);
return query;
}
};
}
});
return tabs;
}
@Override
protected IModel<String> getWarningMessageModel() {
return createStringResource("PageAdminObjectDetails.button.changeArchetype.warningMessage");
}
};
changeArchetypePopup.setOutputMarkupPlaceholderTag(true);
getPageBase().showMainPopup(changeArchetypePopup, target);
}
use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.
the class PageCreatedReports method initColumns.
private List<IColumn<SelectableBean<ReportDataType>, String>> initColumns() {
List<IColumn<SelectableBean<ReportDataType>, String>> columns = new ArrayList<>();
IColumn<SelectableBean<ReportDataType>, String> column = new AbstractColumn<SelectableBean<ReportDataType>, String>(createStringResource("pageCreatedReports.table.time"), "createTimestamp") {
private static final long serialVersionUID = 1L;
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<ReportDataType>>> cellItem, String componentId, final IModel<SelectableBean<ReportDataType>> rowModel) {
cellItem.add(new DateLabelComponent(componentId, new IModel<Date>() {
private static final long serialVersionUID = 1L;
@Override
public Date getObject() {
ReportDataType object = rowModel.getObject().getValue();
MetadataType metadata = object != null ? object.getMetadata() : null;
if (metadata == null) {
return null;
}
return XmlTypeConverter.toDate(metadata.getCreateTimestamp());
}
}, WebComponentUtil.getShortDateTimeFormat(PageCreatedReports.this)));
}
};
columns.add(column);
column = new PropertyColumn<>(createStringResource("pageCreatedReports.table.description"), SelectableBeanImpl.F_VALUE + "." + ReportDataType.F_DESCRIPTION.getLocalPart());
columns.add(column);
column = new EnumPropertyColumn(createStringResource("pageCreatedReports.table.fileFormat"), SelectableBeanImpl.F_VALUE + "." + ReportDataType.F_FILE_FORMAT.getLocalPart()) {
@Override
protected String translate(Enum en) {
return createStringResource(en).getString();
}
};
columns.add(column);
column = new ObjectReferenceColumn<SelectableBean<ReportDataType>>(createStringResource("pageCreatedReports.table.type"), SelectableBeanImpl.F_VALUE + "." + ReportDataType.F_REPORT_REF.getLocalPart()) {
@Override
public IModel<ObjectReferenceType> extractDataModel(IModel<SelectableBean<ReportDataType>> rowModel) {
SelectableBean<ReportDataType> bean = rowModel.getObject();
return Model.of(bean.getValue().getReportRef());
}
};
columns.add(column);
return columns;
}
use of com.evolveum.midpoint.web.component.util.SelectableBean 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.SelectableBean in project midpoint by Evolveum.
the class PageReports method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ReportType> table = new MainObjectListPanel<ReportType>(ID_TABLE, ReportType.class) {
private static final long serialVersionUID = 1L;
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_REPORTS;
}
@Override
protected List<IColumn<SelectableBean<ReportType>, String>> createDefaultColumns() {
return ColumnUtils.getDefaultObjectColumns();
}
@Override
protected IColumn<SelectableBean<ReportType>, String> createCheckboxColumn() {
return null;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return PageReports.this.createInlineMenu();
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
use of com.evolveum.midpoint.web.component.util.SelectableBean in project midpoint by Evolveum.
the class ChooseMemberPopup method createAssignmentTabs.
protected List<ITab> createAssignmentTabs(AssignmentObjectRelation relationSpec) {
List<ITab> tabs = new ArrayList<>();
List<QName> objectTypes = relationSpec != null && CollectionUtils.isNotEmpty(relationSpec.getObjectTypes()) ? relationSpec.getObjectTypes() : getAvailableObjectTypes();
List<ObjectReferenceType> archetypeRefList = relationSpec != null && !CollectionUtils.isEmpty(relationSpec.getArchetypeRefs()) ? relationSpec.getArchetypeRefs() : getArchetypeRefList();
tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.USER"), new VisibleBehaviour(() -> objectTypes == null || objectTypes.contains(UserType.COMPLEX_TYPE))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new MemberPopupTabPanel<UserType>(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<UserType>> rowModel) {
tabLabelPanelUpdate(target);
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.USER;
}
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
};
}
@Override
public String getCount() {
return Integer.toString(getTabPanelSelectedCount(getPanel()));
}
});
tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.ROLE"), new VisibleBehaviour(() -> objectTypes == null || objectTypes.contains(RoleType.COMPLEX_TYPE))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new MemberPopupTabPanel<RoleType>(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<RoleType>> rowModel) {
tabLabelPanelUpdate(target);
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.ROLE;
}
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
};
}
@Override
public String getCount() {
return Integer.toString(getTabPanelSelectedCount(getPanel()));
}
});
tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.ORG"), new VisibleBehaviour(() -> objectTypes == null || objectTypes.contains(OrgType.COMPLEX_TYPE))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new MemberPopupTabPanel<OrgType>(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<OrgType>> rowModel) {
selectedOrgsListUpdate(rowModel);
tabLabelPanelUpdate(target);
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.ORG;
}
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
@Override
protected List<OrgType> getPreselectedObjects() {
return selectedOrgsList;
}
};
}
@Override
public String getCount() {
return Integer.toString(selectedOrgsList.size());
}
});
if (archetypeRefList == null || archetypeRefList.isEmpty()) {
tabs.add(new CountablePanelTab(createStringResource("TypedAssignablePanel.orgTreeView"), new VisibleBehaviour(() -> isOrgTreeVisible() && (objectTypes == null || objectTypes.contains(OrgType.COMPLEX_TYPE)))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new OrgTreeMemberPopupTabPanel(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<OrgType>> rowModel) {
selectedOrgsListUpdate(rowModel);
tabLabelPanelUpdate(target);
}
@Override
protected List<OrgType> getPreselectedObjects() {
return selectedOrgsList;
}
};
}
@Override
public String getCount() {
return Integer.toString(selectedOrgsList.size());
}
});
}
tabs.add(new CountablePanelTab(getPageBase().createStringResource("ObjectTypes.SERVICE"), new VisibleBehaviour(() -> objectTypes == null || objectTypes.contains(ServiceType.COMPLEX_TYPE))) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new MemberPopupTabPanel<ServiceType>(panelId, relationsConfig, archetypeRefList) {
private static final long serialVersionUID = 1L;
@Override
protected T getAbstractRoleTypeObject() {
return ChooseMemberPopup.this.getAssignmentTargetRefObject();
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.SERVICE;
}
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<ServiceType>> rowModel) {
tabLabelPanelUpdate(target);
}
};
}
@Override
public String getCount() {
return Integer.toString(getTabPanelSelectedCount(getPanel()));
}
});
return tabs;
}
Aggregations