Search in sources :

Example 1 with AssignmentObjectRelation

use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.

the class PageCertDefinitions method initLayout.

private void initLayout() {
    Form mainForm = new MidpointForm(ID_MAIN_FORM);
    add(mainForm);
    MainObjectListPanel<AccessCertificationDefinitionType> mainPanel = new MainObjectListPanel<AccessCertificationDefinitionType>(ID_TABLE, AccessCertificationDefinitionType.class, null) {

        private static final long serialVersionUID = 1L;

        @Override
        protected UserProfileStorage.TableId getTableId() {
            return UserProfileStorage.TableId.PAGE_CERT_DEFINITIONS_PANEL;
        }

        @Override
        protected IColumn<SelectableBean<AccessCertificationDefinitionType>, String> createCheckboxColumn() {
            return null;
        }

        @Override
        public void objectDetailsPerformed(AjaxRequestTarget target, AccessCertificationDefinitionType service) {
            PageCertDefinitions.this.detailsPerformed(target, service);
        }

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            return PageCertDefinitions.this.createInlineMenu();
        }

        @Override
        protected void newObjectPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation, CompiledObjectCollectionView collectionView) {
            navigateToNext(PageCertDefinition.class);
        }
    };
    mainPanel.setOutputMarkupId(true);
    mainPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_CERT_DEF_BOX_CSS_CLASSES);
    mainForm.add(mainPanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) AccessCertificationDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationDefinitionType) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 2 with AssignmentObjectRelation

use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.

the class AssignmentPopup method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    Form form = new Form(ID_FORM);
    form.setOutputMarkupId(true);
    add(form);
    MultiCompositedButtonPanel newObjectIcon = new MultiCompositedButtonPanel(ID_COMPOSITED_BUTTONS, createNewButtonDescriptionModel()) {

        @Override
        protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
            Form form = (Form) AssignmentPopup.this.get(ID_FORM);
            AssignmentPopup.this.getModelObject().setSelectionVisible(false);
            addOrReplaceTabPanels(form, relationSpec);
            target.add(form);
        }
    };
    form.add(newObjectIcon);
    newObjectIcon.add(new VisibleBehaviour(() -> getModelObject() != null && getModelObject().isSelectionVisible()));
    addOrReplaceTabPanels(form, null);
    MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
    warningMessage.setOutputMarkupId(true);
    warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
    add(warningMessage);
    form.add(createCancelButton());
    form.add(createAddButton());
    form.add(createBackButton());
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) WebPage(org.apache.wicket.markup.html.WebPage) Form(org.apache.wicket.markup.html.form.Form) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) MultiCompositedButtonPanel(com.evolveum.midpoint.web.component.MultiCompositedButtonPanel) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 3 with AssignmentObjectRelation

use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.

the class MainObjectListPanel method createNewObjectButton.

private Component createNewObjectButton(String buttonId) {
    DisplayType newObjectButtonDisplayType = getNewObjectButtonStandardDisplayType();
    CompositedIconBuilder builder = new CompositedIconBuilder();
    builder.setBasicIcon(WebComponentUtil.getIconCssClass(newObjectButtonDisplayType), IconCssStyle.IN_ROW_STYLE).appendColorHtmlValue(WebComponentUtil.getIconColor(newObjectButtonDisplayType));
    CompiledObjectCollectionView view = getObjectCollectionView();
    if (ObjectCollectionViewUtil.isArchetypedCollectionView(view)) {
        IconType plusIcon = new IconType();
        plusIcon.setCssClass(GuiStyleConstants.CLASS_ADD_NEW_OBJECT);
        plusIcon.setColor("green");
        builder.appendLayerIcon(plusIcon, LayeredIconCssStyle.BOTTOM_RIGHT_STYLE);
    }
    String iconTitle = WebComponentUtil.getDisplayTypeTitle(newObjectButtonDisplayType);
    AjaxCompositedIconButton createNewObjectButton = new AjaxCompositedIconButton(buttonId, builder.build(), createStringResource(StringUtils.isEmpty(iconTitle) ? "MainObjectListPanel.newObject" : iconTitle)) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (isCollectionViewPanelForCompiledView()) {
                CompiledObjectCollectionView collectionView = getObjectCollectionView();
                // HACK TODO clenup and think about generic mechanism for this
                if (isCollectionViewWithoutMorePossibleNewType(collectionView)) {
                    newObjectPerformed(target, null, collectionView);
                    return;
                }
            }
            if (!showNewObjectCreationPopup()) {
                newObjectPerformed(target, null, getObjectCollectionView());
                return;
            }
            NewObjectCreationPopup buttonsPanel = new NewObjectCreationPopup(getPageBase().getMainPopupBodyId(), new PropertyModel<>(loadButtonDescriptions(), MultiFunctinalButtonDto.F_ADDITIONAL_BUTTONS)) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
                    getPageBase().hideMainPopup(target);
                    MainObjectListPanel.this.newObjectPerformed(target, relationSpec, collectionViews);
                }
            };
            getPageBase().showMainPopup(buttonsPanel, target);
        }
    };
    createNewObjectButton.add(new VisibleBehaviour(this::isCreateNewObjectEnabled));
    createNewObjectButton.add(AttributeAppender.append("class", "btn btn-default btn-sm"));
    return createNewObjectButton;
}
Also used : AjaxCompositedIconButton(com.evolveum.midpoint.gui.impl.component.AjaxCompositedIconButton) WebPage(org.apache.wicket.markup.html.WebPage) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)

Example 4 with AssignmentObjectRelation

use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.

the class NewObjectCreationPopup method initLayout.

private void initLayout() {
    MultiCompositedButtonPanel buttonPanel = new MultiCompositedButtonPanel(ID_NEW_OBJECT_SELECTION_BUTTON_PANEL, getModel()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation relationSpec, CompiledObjectCollectionView collectionViews, Class<? extends WebPage> page) {
            NewObjectCreationPopup.this.buttonClickPerformed(target, relationSpec, collectionViews, page);
        }
    };
    buttonPanel.setOutputMarkupId(true);
    add(buttonPanel);
    AjaxButton cancel = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("PageBase.button.cancel")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            cancelPerformed(target);
        }
    };
    add(cancel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) WebPage(org.apache.wicket.markup.html.WebPage) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) CompiledObjectCollectionView(com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView) MultiCompositedButtonPanel(com.evolveum.midpoint.web.component.MultiCompositedButtonPanel) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation)

Example 5 with AssignmentObjectRelation

use of com.evolveum.midpoint.model.api.AssignmentObjectRelation in project midpoint by Evolveum.

the class FocusProjectionsPanel method initLayout.

protected void initLayout() {
    IModel<Integer> deadShadows = new ReadOnlyModel<>(this::countDeadShadows);
    Label label = new Label(ID_DEAD_SHADOWS, deadShadows);
    label.add(new VisibleBehaviour(() -> deadShadows.getObject() > 0));
    add(label);
    MultivalueContainerListPanelWithDetailsPanel<ShadowType> multivalueContainerListPanel = new MultivalueContainerListPanelWithDetailsPanel<ShadowType>(ID_SHADOW_TABLE, ShadowType.class, getPanelConfiguration()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected ISelectableDataProvider<ShadowType, PrismContainerValueWrapper<ShadowType>> createProvider() {
            return new ProjectionsListProvider(FocusProjectionsPanel.this, getSearchModel(), loadShadowModel()) {

                @Override
                protected PageStorage getPageStorage() {
                    PageStorage storage = getSession().getSessionStorage().getPageStorageMap().get(SessionStorage.KEY_FOCUS_PROJECTION_TABLE);
                    if (storage == null) {
                        storage = getSession().getSessionStorage().initPageStorage(SessionStorage.KEY_FOCUS_PROJECTION_TABLE);
                    }
                    return storage;
                }
            };
        }

        @Override
        protected void newItemPerformed(AjaxRequestTarget target, AssignmentObjectRelation relation) {
            List<QName> supportedTypes = Arrays.asList(ResourceType.COMPLEX_TYPE);
            PageBase pageBase = FocusProjectionsPanel.this.getPageBase();
            ObjectBrowserPanel<ResourceType> resourceSelectionPanel = new ObjectBrowserPanel<>(pageBase.getMainPopupBodyId(), ResourceType.class, supportedTypes, true, pageBase) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void addPerformed(AjaxRequestTarget target, QName type, List<ResourceType> selected) {
                    FocusProjectionsPanel.this.addSelectedAccountPerformed(target, selected);
                    target.add(getPageBase().getFeedbackPanel());
                }
            };
            resourceSelectionPanel.setOutputMarkupId(true);
            pageBase.showMainPopup(resourceSelectionPanel, target);
        }

        @Override
        protected boolean isCreateNewObjectVisible() {
            PrismObjectDefinition<F> def = FocusProjectionsPanel.this.getObjectWrapperModel().getObject().getObject().getDefinition();
            PrismReferenceDefinition ref = def.findReferenceDefinition(UserType.F_LINK_REF);
            return (ref.canRead() && ref.canAdd());
        }

        @Override
        protected IModel<PrismContainerWrapper<ShadowType>> getContainerModel() {
            return null;
        }

        @Override
        protected TableId getTableId() {
            return TableId.FOCUS_PROJECTION_TABLE;
        }

        @Override
        protected List<IColumn<PrismContainerValueWrapper<ShadowType>, String>> createDefaultColumns() {
            return initBasicColumns();
        }

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            return createShadowMenu();
        }

        @Override
        public void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ShadowType>> rowModel, List<PrismContainerValueWrapper<ShadowType>> listItems) {
            loadShadowIfNeeded(rowModel, target);
            if (listItems != null) {
                listItems.forEach(value -> {
                    if (((ShadowWrapper) value.getParent()).isLoadWithNoFetch()) {
                        loadFullShadow((PrismObjectValueWrapper) value, target);
                    }
                });
            }
            super.editItemPerformed(target, rowModel, listItems);
        }

        @Override
        protected Search createSearch(Class<ShadowType> type) {
            Search search = super.createSearch(type);
            PropertySearchItem<Boolean> defaultDeadItem = search.findPropertySearchItem(ShadowType.F_DEAD);
            if (defaultDeadItem != null) {
                defaultDeadItem.setVisible(false);
            }
            addDeadSearchItem(search);
            return search;
        }

        @Override
        protected List<SearchItemDefinition> initSearchableItems(PrismContainerDefinition<ShadowType> containerDef) {
            List<SearchItemDefinition> defs = new ArrayList<>();
            SearchFactory.addSearchRefDef(containerDef, ShadowType.F_RESOURCE_REF, defs, AreaCategoryType.ADMINISTRATION, getPageBase());
            SearchFactory.addSearchPropertyDef(containerDef, ShadowType.F_NAME, defs);
            SearchFactory.addSearchPropertyDef(containerDef, ShadowType.F_INTENT, defs);
            SearchFactory.addSearchPropertyDef(containerDef, ShadowType.F_KIND, defs);
            return defs;
        }

        @Override
        protected MultivalueContainerDetailsPanel<ShadowType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<ShadowType>> item) {
            return FocusProjectionsPanel.this.getMultivalueContainerDetailsPanel(item);
        }
    };
    add(multivalueContainerListPanel);
    setOutputMarkupId(true);
}
Also used : VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Label(org.apache.wicket.markup.html.basic.Label) ArrayList(java.util.ArrayList) AssignmentObjectRelation(com.evolveum.midpoint.model.api.AssignmentObjectRelation) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) ProjectionsListProvider(com.evolveum.midpoint.web.component.util.ProjectionsListProvider) List(java.util.List) ArrayList(java.util.ArrayList) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) PageStorage(com.evolveum.midpoint.web.session.PageStorage) IModel(org.apache.wicket.model.IModel) QName(javax.xml.namespace.QName) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ObjectBrowserPanel(com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel) MultivalueContainerListPanelWithDetailsPanel(com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel) ListItem(org.apache.wicket.markup.html.list.ListItem)

Aggregations

AssignmentObjectRelation (com.evolveum.midpoint.model.api.AssignmentObjectRelation)29 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)18 CompiledObjectCollectionView (com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView)13 ArrayList (java.util.ArrayList)12 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)8 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)8 WebPage (org.apache.wicket.markup.html.WebPage)8 QName (javax.xml.namespace.QName)7 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)7 IModel (org.apache.wicket.model.IModel)7 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)6 List (java.util.List)6 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)5 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)5 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)5 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)5 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 MultiCompositedButtonPanel (com.evolveum.midpoint.web.component.MultiCompositedButtonPanel)4 MultiFunctinalButtonDto (com.evolveum.midpoint.web.component.MultiFunctinalButtonDto)4