Search in sources :

Example 1 with OrgTreeAssignablePanel

use of com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel in project midpoint by Evolveum.

the class TreeTablePanel method moveRootPerformed.

private void moveRootPerformed(SelectableBean<OrgType> root, AjaxRequestTarget target) {
    if (root == null) {
        root = getTreePanel().getRootFromProvider();
    }
    final SelectableBean<OrgType> orgToMove = root;
    OrgTreeAssignablePanel orgAssignablePanel = new OrgTreeAssignablePanel(parentPage.getMainPopupBodyId(), false, parentPage) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onItemSelect(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
            moveConfirmPerformed(orgToMove, selected, target);
        }
    };
    parentPage.showMainPopup(orgAssignablePanel, target);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) OrgTreeAssignablePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel)

Example 2 with OrgTreeAssignablePanel

use of com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel in project midpoint by Evolveum.

the class OrgTreeMemberPopupTabPanel method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    OrgTreeAssignablePanel orgTreePanel = new OrgTreeAssignablePanel(ID_ORG_TREE_VIEW_PANEL, true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onOrgTreeCheckBoxSelectionPerformed(AjaxRequestTarget target, IModel<TreeSelectableBean<OrgType>> rowModel) {
            onSelectionPerformed(target, (IModel) rowModel);
        }

        @Override
        protected List<OrgType> getPreselectedOrgsList() {
            return getPreselectedObjects();
        }

        @Override
        protected boolean isAssignButtonVisible() {
            return false;
        }

        @Override
        protected boolean isInducement() {
            return OrgTreeMemberPopupTabPanel.this.isInducement();
        }
    };
    orgTreePanel.setOutputMarkupId(true);
    add(orgTreePanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) OrgTreeAssignablePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel)

Example 3 with OrgTreeAssignablePanel

use of com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel in project midpoint by Evolveum.

the class AssignmentTablePanel method createAssignmentMenu.

protected List<InlineMenuItem> createAssignmentMenu() {
    List<InlineMenuItem> items = new ArrayList<>();
    InlineMenuItem item;
    if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_ASSIGN_ACTION_URI)) {
        item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.assign")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new InlineMenuItemAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        TypedAssignablePanel panel = new TypedAssignablePanel(getPageBase().getMainPopupBodyId(), RoleType.class) {

                            private static final long serialVersionUID = 1L;

                            @Override
                            protected void addPerformed(AjaxRequestTarget target, List selected, QName relation, ShadowKindType kind, String intent) {
                                super.addPerformed(target, selected, relation, kind, intent);
                                addSelectedAssignablePerformed(target, selected, relation, getPageBase().getMainPopup().getId());
                                reloadMainFormButtons(target);
                            }
                        };
                        panel.setOutputMarkupId(true);
                        getPageBase().showMainPopup(panel, target);
                    }
                };
            }
        };
        items.add(item);
        item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.assignOrg")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new InlineMenuItemAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        int count = WebModelServiceUtils.countObjects(OrgType.class, null, getPageBase());
                        if (count > 0) {
                            OrgTreeAssignablePanel orgTreePanel = new OrgTreeAssignablePanel(getPageBase().getMainPopupBodyId(), true) {

                                private static final long serialVersionUID = 1L;

                                @Override
                                protected void assignSelectedOrgPerformed(List<OrgType> selectedOrgs, AjaxRequestTarget target) {
                                    // TODO Auto-generated method stub
                                    addSelectedAssignablePerformed(target, (List) selectedOrgs, WebComponentUtil.getDefaultRelationOrFail(), getPageBase().getMainPopup().getId());
                                    reloadMainFormButtons(target);
                                }
                            };
                            orgTreePanel.setOutputMarkupId(true);
                            getPageBase().showMainPopup(orgTreePanel, target);
                        } else {
                            warn(createStringResource("AssignmentTablePanel.menu.assignOrg.noorgs").getString());
                            target.add(getPageBase().getFeedbackPanel());
                        }
                    }
                };
            }
        };
        items.add(item);
    }
    if (WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_UNASSIGN_ACTION_URI)) {
        item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.unassign")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new InlineMenuItemAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        AssignmentTablePanel.this.deleteAssignmentPerformed(target, null);
                    }
                };
            }
        };
        items.add(item);
    }
    if (isShowAllAssignmentsVisible()) {
        item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.showAllAssignments")) {

            private static final long serialVersionUID = 1L;

            @Override
            public InlineMenuItemAction initAction() {
                return new InlineMenuItemAction() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        showAllAssignments(target);
                    }
                };
            }
        };
        items.add(item);
    }
    return items;
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) TypedAssignablePanel(com.evolveum.midpoint.gui.api.component.TypedAssignablePanel) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ArrayList(java.util.ArrayList) List(java.util.List) OrgTreeAssignablePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel)

Example 4 with OrgTreeAssignablePanel

use of com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel in project midpoint by Evolveum.

the class OrgTreeAssignmentPopupTabPanel method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    OrgTreeAssignablePanel orgTreePanel = new OrgTreeAssignablePanel(ID_ORG_TREE_VIEW_PANEL, true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onOrgTreeCheckBoxSelectionPerformed(AjaxRequestTarget target, IModel<TreeSelectableBean<OrgType>> rowModel) {
            onSelectionPerformed(target, (IModel) rowModel);
        }

        @Override
        protected boolean isAssignButtonVisible() {
            return false;
        }

        @Override
        protected List<OrgType> getPreselectedOrgsList() {
            return getPreselectedObjects();
        }

        @Override
        protected boolean isInducement() {
            return OrgTreeAssignmentPopupTabPanel.this.isInducement();
        }

        @Override
        protected ObjectFilter getSubtypeFilter() {
            return OrgTreeAssignmentPopupTabPanel.this.getSubtypeFilter();
        }
    };
    orgTreePanel.setOutputMarkupId(true);
    add(orgTreePanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) OrgTreeAssignablePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel)

Example 5 with OrgTreeAssignablePanel

use of com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel in project midpoint by Evolveum.

the class TypedAssignablePanel method onInitialize.

@Override
protected void onInitialize() {
    super.onInitialize();
    initAssignmentParametersPanel();
    WebMarkupContainer tablesContainer = new WebMarkupContainer(ID_TABLES_CONTAINER);
    tablesContainer.setOutputMarkupId(true);
    add(tablesContainer);
    PopupObjectListPanel<T> listRolePanel = createObjectListPanel(ID_ROLE_TABLE, ID_SELECTED_ROLES, ObjectTypes.ROLE);
    tablesContainer.add(listRolePanel);
    PopupObjectListPanel<T> listResourcePanel = createObjectListPanel(ID_RESOURCE_TABLE, ID_SELECTED_RESOURCES, ObjectTypes.RESOURCE);
    tablesContainer.add(listResourcePanel);
    PopupObjectListPanel<T> listOrgPanel = createObjectListPanel(ID_ORG_TABLE, ID_SELECTED_ORGS, ObjectTypes.ORG);
    tablesContainer.add(listOrgPanel);
    PopupObjectListPanel<T> listServicePanel = createObjectListPanel(ID_SERVICE_TABLE, ID_SELECTED_SERVICES, ObjectTypes.SERVICE);
    tablesContainer.add(listServicePanel);
    OrgTreeAssignablePanel orgTreePanel = new OrgTreeAssignablePanel(ID_ORG_TREE_VIEW_PANEL, true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void assignSelectedOrgPerformed(List<OrgType> selectedOrgs, AjaxRequestTarget target) {
            // noinspection unchecked
            TypedAssignablePanel.this.assignButtonClicked(target, (List<T>) selectedOrgs);
        }
    };
    orgTreePanel.setOutputMarkupId(true);
    orgTreePanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return OrgType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName()) && isOrgTreeViewSelected();
        }
    });
    tablesContainer.add(orgTreePanel);
    // todo now it's usually hiden by object list panel - bad layout; need to discuss: if count panel should be visible
    // after org tree panel is added
    // WebMarkupContainer countContainer = createCountContainer();
    // add(countContainer);
    AjaxButton addButton = new AjaxButton(ID_BUTTON_ASSIGN, createStringResource("userBrowserDialog.button.addButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            TypedAssignablePanel.this.assignButtonClicked(target, new ArrayList<>());
        }
    };
    addButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !isOrgTreeViewSelected();
        }
    });
    add(addButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ArrayList(java.util.ArrayList) List(java.util.List) OrgTreeAssignablePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Aggregations

OrgTreeAssignablePanel (com.evolveum.midpoint.web.page.admin.orgs.OrgTreeAssignablePanel)6 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)6 OrgType (com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 IModel (org.apache.wicket.model.IModel)2 TypedAssignablePanel (com.evolveum.midpoint.gui.api.component.TypedAssignablePanel)1 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)1 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)1 InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)1 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)1 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 QName (javax.xml.namespace.QName)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1