use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class CaseWorkItemsPanel method initLayout.
private void initLayout() {
ContainerableListPanel workItemsPanel = new ContainerableListPanel<CaseWorkItemType, PrismContainerValueWrapper<CaseWorkItemType>>(ID_WORKITEMS_TABLE, CaseWorkItemType.class) {
@Override
protected List<IColumn<PrismContainerValueWrapper<CaseWorkItemType>, String>> createDefaultColumns() {
return CaseWorkItemsPanel.this.createDefaultColumns();
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
if (View.FULL_LIST.equals(view)) {
return createRowActions();
}
return null;
}
@Override
protected ISelectableDataProvider<CaseWorkItemType, PrismContainerValueWrapper<CaseWorkItemType>> createProvider() {
return CaseWorkItemsPanel.this.createProvider(getSearchModel());
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_CASE_WORK_ITEMS_PANEL;
}
@Override
protected boolean hideFooterIfSinglePage() {
return View.DASHBOARD.equals(view);
}
@Override
protected boolean isHeaderVisible() {
return !View.DASHBOARD.equals(view);
}
@Override
protected IColumn createCheckboxColumn() {
return CaseWorkItemsPanel.this.createCheckboxColumn();
}
@Override
protected IColumn createIconColumn() {
return CaseWorkItemsPanel.this.createIconColumn();
}
@Override
protected IColumn createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
return CaseWorkItemsPanel.this.createNameColumn();
}
@Override
protected String getStorageKey() {
return SessionStorage.KEY_WORK_ITEMS;
}
@Override
protected CaseWorkItemType getRowRealValue(PrismContainerValueWrapper<CaseWorkItemType> rowModelObject) {
if (rowModelObject == null) {
return null;
}
return rowModelObject.getRealValue();
}
};
workItemsPanel.setOutputMarkupId(true);
add(workItemsPanel);
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class PageWorkItemsClaimable method createRowActions.
@Override
protected List<InlineMenuItem> createRowActions() {
List<InlineMenuItem> menu = new ArrayList<>();
menu.add(new ButtonInlineMenuItem(createStringResource("pageWorkItem.button.claim")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>() {
@Override
public void onClick(AjaxRequestTarget target) {
claimWorkItemPerformed(getRowModel(), target);
}
};
}
@Override
public IModel<Boolean> getEnabled() {
IModel<PrismContainerValueWrapper<CaseWorkItemType>> rowModel = ((ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>) getAction()).getRowModel();
if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getRealValue() != null) {
CaseWorkItemType workItem = rowModel.getObject().getRealValue();
return Model.of(CaseWorkItemUtil.isCaseWorkItemNotClosed(workItem));
} else {
return super.getEnabled();
}
}
@Override
public IModel<String> getConfirmationMessageModel() {
return createStringResource("CaseWorkItemsPanel.confirmWorkItemsClaimAction");
}
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_ICON_CLAIM);
}
});
return menu;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class ObjectTemplateItemPanel method createAdditionalColumns.
@Override
protected List<IColumn<PrismContainerValueWrapper<ObjectTemplateItemDefinitionType>, String>> createAdditionalColumns() {
List<IColumn<PrismContainerValueWrapper<ObjectTemplateItemDefinitionType>, String>> columns = new ArrayList<>();
columns.add(new AbstractColumn<>(createStringResource("ObjectTemplateItemDefinitionType.mapping")) {
@Override
public void populateItem(Item<ICellPopulator<PrismContainerValueWrapper<ObjectTemplateItemDefinitionType>>> cellItem, String componentId, IModel<PrismContainerValueWrapper<ObjectTemplateItemDefinitionType>> rowModel) {
IModel<PrismContainerWrapper<MappingType>> mappingModel = PrismContainerWrapperModel.fromContainerValueWrapper(rowModel, ObjectTemplateItemDefinitionType.F_MAPPING);
cellItem.add(new MappingColumnPanel(componentId, mappingModel));
}
});
List<InlineMenuItem> items = new ArrayList<>();
InlineMenuItem item = new InlineMenuItem(createStringResource("pageAdminFocus.button.delete")) {
private static final long serialVersionUID = 1L;
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
getMultivalueContainerListPanel().deleteItemPerformed(target, getMultivalueContainerListPanel().getPerformedSelectedItems(getRowModel()));
}
};
}
};
items.add(item);
item = new ButtonInlineMenuItem(createStringResource("PageBase.button.edit")) {
private static final long serialVersionUID = 1L;
@Override
public CompositedIconBuilder getIconCompositedBuilder() {
return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_EDIT_MENU_ITEM);
}
@Override
public InlineMenuItemAction initAction() {
return new ColumnMenuAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
getMultivalueContainerListPanel().editItemPerformed(target, getRowModel(), getMultivalueContainerListPanel().getSelectedItems());
target.add(getMultivalueContainerListPanel().getFeedbackPanel());
}
};
}
};
items.add(item);
columns.add(new InlineMenuButtonColumn(items, getPageBase()) {
@Override
public String getCssClass() {
return "col-xs-1";
}
});
return columns;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class MultivalueContainerListDataProvider method searchThroughList.
protected List<PrismContainerValueWrapper<C>> searchThroughList() {
List<PrismContainerValueWrapper<C>> list = model.getObject();
if (list == null || list.isEmpty()) {
return null;
}
ObjectQuery query = getQuery();
if (query == null || query.getFilter() == null) {
return list;
}
List<PrismContainerValueWrapper<C>> filtered = list.stream().filter(valueWrapper -> {
try {
return ObjectQuery.match(valueWrapper.getRealValue(), query.getFilter(), getPageBase().getMatchingRuleRegistry());
} catch (SchemaException e) {
throw new TunnelException(e.getMessage());
}
}).collect(Collectors.toList());
return filtered;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.
the class ResourceAttributeRefPanelFactory method getChoicesList.
private List<ItemName> getChoicesList(PrismPropertyPanelContext<ItemPathType> ctx) {
PrismPropertyWrapper<?> wrapper = ctx.unwrapWrapperModel();
// attribute/ref
if (wrapper == null) {
return Collections.emptyList();
}
// attribute value
if (wrapper.getParent() == null) {
return Collections.emptyList();
}
// attribute
ItemWrapper<?, ?> attributeWrapper = wrapper.getParent().getParent();
if (attributeWrapper == null) {
return Collections.emptyList();
}
PrismContainerValueWrapper<?> itemWrapper = attributeWrapper.getParent();
if (itemWrapper == null) {
return Collections.emptyList();
}
if (!(itemWrapper instanceof ConstructionValueWrapper)) {
return Collections.emptyList();
}
ConstructionValueWrapper constructionWrapper = (ConstructionValueWrapper) itemWrapper;
try {
ResourceSchema schema = constructionWrapper.getRefinedSchema();
if (schema == null) {
return new ArrayList<>();
}
ResourceObjectDefinition rOcd = schema.findObjectDefinition(constructionWrapper.getKind(), constructionWrapper.getIntent());
if (rOcd == null) {
return Collections.emptyList();
}
if (ConstructionType.F_ASSOCIATION.equivalent(attributeWrapper.getItemName())) {
Collection<ResourceAssociationDefinition> associationDefs = rOcd.getAssociationDefinitions();
return associationDefs.stream().map(ResourceAssociationDefinition::getName).collect(Collectors.toList());
}
Collection<? extends ResourceAttributeDefinition<?>> attrDefs = rOcd.getAttributeDefinitions();
return attrDefs.stream().map(a -> a.getItemName()).collect(Collectors.toList());
} catch (SchemaException e) {
LOGGER.warn("Cannot get resource attribute definitions");
}
return Collections.emptyList();
}
Aggregations