use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.
the class BaseCollectionPanel method initLayout.
@Override
protected void initLayout() {
SingleContainerPanel panel = new SingleContainerPanel<CollectionRefSpecificationType>(ID_PANEL, createModel(getObjectWrapperModel(), ObjectCollectionType.F_BASE_COLLECTION), CollectionRefSpecificationType.COMPLEX_TYPE) {
private static final long serialVersionUID = 1L;
@Override
protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
if (ItemPath.create(ObjectCollectionType.F_BASE_COLLECTION, CollectionRefSpecificationType.F_BASE_COLLECTION_REF).isSuperPathOrEquivalent(itemWrapper.getPath())) {
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
}
};
add(panel);
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.
the class TaskBasicPanel method initLayout.
protected void initLayout() {
SingleContainerPanel mainPanel = new SingleContainerPanel(ID_MAIN_PANEL, getObjectWrapperModel(), getPanelConfiguration()) {
@Override
protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
return getBasicTabVisibility(itemWrapper.getPath());
}
@Override
protected ItemEditabilityHandler getEditabilityHandler() {
return wrapper -> getBasicTabEditability(wrapper.getPath());
}
@Override
protected IModel<PrismContainerWrapper> createVirtualContainerModel(VirtualContainersSpecificationType virtualContainer) {
if (isDeprecatedVirtualContainer(virtualContainer)) {
return null;
}
return super.createVirtualContainerModel(virtualContainer);
}
};
add(mainPanel);
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.
the class RoleManagementContentPanel method initLayout.
@Override
protected void initLayout() {
SingleContainerPanel panel = new SingleContainerPanel(ID_MAIN_PANEL, PrismContainerWrapperModel.fromContainerWrapper(getObjectWrapperModel(), ItemPath.create(SystemConfigurationType.F_ROLE_MANAGEMENT)), RoleManagementConfigurationType.COMPLEX_TYPE) {
@Override
protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
ItemPath path = itemWrapper.getPath();
if (path == null || path.isEmpty()) {
return ItemVisibility.AUTO;
}
QName name;
if (path.size() == 1) {
name = path.firstToQName();
} else {
name = path.rest().firstToQName();
}
boolean hide = RoleManagementConfigurationType.F_RELATIONS.equals(name);
return hide ? ItemVisibility.HIDDEN : ItemVisibility.AUTO;
}
};
add(panel);
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper 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();
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.
the class PrismContainerValuePanel method prepareNewContainers.
private void prepareNewContainers(AjaxRequestTarget target, List<PrismContainerDefinition<?>> containers) {
Task task = getPageBase().createSimpleTask("Create child containers");
WrapperContext ctx = new WrapperContext(task, task.getResult());
ctx.setCreateIfEmpty(true);
containers.forEach(container -> {
try {
ItemWrapper iw = getPageBase().createItemWrapper(container, getModelObject(), ctx);
if (iw != null) {
getModelObject().addItem(iw);
}
} catch (SchemaException e) {
OperationResult result = ctx.getResult();
result.recordFatalError(createStringResource("PrismContainerValuePanel.message.prepareNewContainers.fatalError", container).getString(), e);
getPageBase().showResult(ctx.getResult());
}
});
refreshPanel(target);
}
Aggregations