use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.
the class ShadowPanel method initLayout.
private void initLayout() {
try {
if (config != null) {
SingleContainerPanel attributesContainer = new SingleContainerPanel(ID_ATTRIBUTES, getModel(), config) {
@Override
protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
return checkShadowContainerVisibility(itemWrapper, ShadowPanel.this.getModel());
}
};
add(attributesContainer);
} else {
ItemPanelSettingsBuilder attributesSettingsBuilder = new ItemPanelSettingsBuilder().visibilityHandler(itemWrapper -> checkShadowContainerVisibility(itemWrapper, getModel()));
Panel attributesPanel = getPageBase().initItemPanel(ID_ATTRIBUTES, ShadowAttributesType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ShadowType.F_ATTRIBUTES), attributesSettingsBuilder.build());
add(attributesPanel);
}
ItemPanelSettingsBuilder associationBuilder = new ItemPanelSettingsBuilder().visibilityHandler(itemWrapper -> checkShadowContainerVisibility(itemWrapper, getModel()));
Panel associationsPanel = getPageBase().initItemPanel(ID_ASSOCIATIONS, ShadowAssociationType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ShadowType.F_ASSOCIATION), associationBuilder.build());
associationsPanel.add(new VisibleBehaviour(() -> checkAssociationsVisibility()));
add(associationsPanel);
ItemPanelSettingsBuilder activationBuilder = new ItemPanelSettingsBuilder().visibilityHandler(itemWrapper -> checkShadowContainerVisibility(itemWrapper, getModel()));
Panel activationPanel = getPageBase().initItemPanel(ID_ACTIVATION, ActivationType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ShadowType.F_ACTIVATION), activationBuilder.build());
activationPanel.add(new VisibleBehaviour(() -> isActivationSupported()));
add(activationPanel);
ItemPanelSettingsBuilder passwordSettingsBuilder = new ItemPanelSettingsBuilder().visibilityHandler(itemWrapper -> checkShadowContainerVisibility(itemWrapper, getModel()));
Panel passwordPanel = getPageBase().initItemPanel(ID_PASSWORD, PasswordType.COMPLEX_TYPE, PrismContainerWrapperModel.fromContainerWrapper(getModel(), ItemPath.create(ShadowType.F_CREDENTIALS, CredentialsType.F_PASSWORD)), passwordSettingsBuilder.build());
passwordPanel.add(new VisibleBehaviour(() -> isCredentialsSupported()));
add(passwordPanel);
} catch (SchemaException e) {
getSession().error("Cannot create panels for shadow, reason: " + e.getMessage());
LOGGER.trace("Cannot create panels for shadow, reason: {}", e.getMessage(), e);
}
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.
the class ReportMainPanel method getTabs.
private List<ITab> getTabs(PageAdminObjectDetails<ReportType> parentPage) {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(parentPage.createStringResource("pageReport.basic.title")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ObjectBasicPanel<ReportType>(panelId, getObjectModel()) {
@Override
protected QName getType() {
return ReportType.COMPLEX_TYPE;
}
@Override
protected ItemVisibility getBasicTabVisibility(ItemWrapper<?, ?> itemWrapper) {
if (itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ReportType.F_LIFECYCLE_STATE)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ReportType.F_DIAGNOSTIC_INFORMATION)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ReportType.F_DEFAULT_SCRIPT_CONFIGURATION)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ReportType.F_POST_REPORT_SCRIPT))) {
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
}
};
}
});
tabs.add(new PanelTab(parentPage.createStringResource("pageReport.engine.title")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new EngineReportTabPanel(panelId, getObjectModel());
}
@Override
public boolean isVisible() {
return hasDefinitionFor(ReportType.F_OBJECT_COLLECTION) || hasDefinitionFor(ReportType.F_DASHBOARD);
}
});
tabs.addAll(createTabsForCollectionReports(parentPage));
tabs.addAll(createTabsForDashboardReports(parentPage));
tabs.add(new PanelTab(parentPage.createStringResource("pageReport.export.title")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
PrismContainerWrapperModel<ReportType, Containerable> model = PrismContainerWrapperModel.fromContainerWrapper(getObjectModel(), ReportType.F_FILE_FORMAT);
return new SingleContainerPanel(panelId, model, FileFormatConfigurationType.COMPLEX_TYPE) {
@Override
protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
if (itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ReportType.F_FILE_FORMAT, FileFormatConfigurationType.F_HTML))) {
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
}
};
}
});
return tabs;
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.
the class ReportMainPanel method createDetailsPanelForParameter.
private MultivalueContainerDetailsPanel<SearchFilterParameterType> createDetailsPanelForParameter(String panelId, ListItem<PrismContainerValueWrapper<SearchFilterParameterType>> item) {
return new MultivalueContainerDetailsPanel<>(panelId, item.getModel(), true) {
@Override
protected DisplayNamePanel<SearchFilterParameterType> createDisplayNamePanel(String displayNamePanelId) {
return new DisplayNamePanel<>(displayNamePanelId, new ItemRealValueModel<>(getModel())) {
@Override
protected IModel<String> createHeaderModel() {
return () -> {
SearchFilterParameterType parameter = getModelObject();
String name = parameter.getName();
if (parameter.getDisplay() != null && parameter.getDisplay().getLabel() != null) {
name = WebComponentUtil.getTranslatedPolyString(parameter.getDisplay().getLabel());
}
return name;
};
}
@Override
protected String createImageModel() {
return "fa fa-sliders";
}
};
}
@Override
protected ItemVisibility getBasicTabVisibity(ItemWrapper<?, ?> itemWrapper) {
if (ItemPath.create(itemWrapper.getParent().getPath(), SearchFilterParameterType.F_DISPLAY).equivalent(itemWrapper.getPath())) {
return ItemVisibility.HIDDEN;
}
return super.getBasicTabVisibity(itemWrapper);
}
@Override
@NotNull
protected List<ITab> createTabs() {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(createStringResource("SearchFilterParameterType.display")) {
@Override
public WebMarkupContainer createPanel(String panelId) {
return new SingleContainerPanel<>(panelId, PrismContainerWrapperModel.fromContainerValueWrapper(getModel(), SearchFilterParameterType.F_DISPLAY), DisplayType.COMPLEX_TYPE) {
@Override
protected ItemVisibility getVisibility(ItemWrapper itemWrapper) {
if (ItemPath.create(itemWrapper.getParent().getPath(), DisplayType.F_LABEL).equivalent(itemWrapper.getPath()) || ItemPath.create(itemWrapper.getParent().getPath(), DisplayType.F_HELP).equivalent(itemWrapper.getPath())) {
return super.getVisibility(itemWrapper);
}
return ItemVisibility.HIDDEN;
}
};
}
});
return tabs;
}
};
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.
the class ResourceSchemaHandlingTabPanel method createMultivalueContainerDetailsPanel.
private MultivalueContainerDetailsPanel<ResourceObjectTypeDefinitionType> createMultivalueContainerDetailsPanel(String panelId, IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model) {
return new MultivalueContainerDetailsPanel<>(panelId, model, true) {
@Override
protected ItemVisibility getBasicTabVisibity(ItemWrapper<?, ?> itemWrapper) {
if (itemWrapper instanceof PrismContainerWrapper) {
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
}
@Override
@NotNull
protected List<ITab> createTabs() {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(createStringResource("Attributes")) {
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ResourceAttributePanel(panelId, PrismContainerWrapperModel.fromContainerValueWrapper(getModel(), ResourceObjectTypeDefinitionType.F_ATTRIBUTE), null);
}
});
return tabs;
}
@Override
protected DisplayNamePanel<ResourceObjectTypeDefinitionType> createDisplayNamePanel(String displayNamePanelId) {
return new DisplayNamePanel<>(displayNamePanelId, new ItemRealValueModel<>(getModel()));
}
};
}
use of com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper in project midpoint by Evolveum.
the class PageObjectCollection method getTabs.
private List<ITab> getTabs() {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(createStringResource("pageObjectCollection.basic.title")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ObjectBasicPanel<ObjectCollectionType>(panelId, getObjectModel()) {
@Override
protected QName getType() {
return ObjectCollectionType.COMPLEX_TYPE;
}
@Override
protected ItemVisibility getBasicTabVisibility(ItemWrapper<?, ?> itemWrapper) {
if (itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ObjectCollectionType.F_SUBTYPE)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ObjectCollectionType.F_DIAGNOSTIC_INFORMATION)) || itemWrapper.getPath().isSubPathOrEquivalent(ItemPath.create(ItemPath.EMPTY_PATH, ObjectCollectionType.F_LIFECYCLE_STATE))) {
return ItemVisibility.HIDDEN;
}
return ItemVisibility.AUTO;
}
};
}
});
tabs.add(new PanelTab(createStringResource("pageObjectCollection.baseCollection.title")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new SingleContainerPanel<CollectionRefSpecificationType>(panelId, createModel(getObjectModel(), ObjectCollectionType.F_BASE_COLLECTION), CollectionRefSpecificationType.COMPLEX_TYPE) {
@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;
}
};
}
});
tabs.add(new PanelTab(createStringResource("pageObjectCollection.defaultView.title")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return createContainerPanel(panelId, getObjectModel(), ObjectCollectionType.F_DEFAULT_VIEW, GuiObjectListViewType.COMPLEX_TYPE);
}
});
tabs.add(new PanelTab(createStringResource("pageObjectCollection.domain.title")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return createContainerPanel(panelId, getObjectModel(), ObjectCollectionType.F_DOMAIN, CollectionRefSpecificationType.COMPLEX_TYPE);
}
});
tabs.add(new PanelTab(createStringResource("pageObjectCollection.option.title")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return createContainerPanel(panelId, getObjectModel(), ObjectCollectionType.F_GET_OPTIONS, SelectorQualifiedGetOptionsType.COMPLEX_TYPE);
}
});
return tabs;
}
Aggregations