Search in sources :

Example 1 with OrgTreePanel

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

the class TreeTablePanel method initLayout.

protected void initLayout() {
    OrgTreePanel treePanel = new OrgTreePanel(ID_TREE_PANEL, getModel(), false) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
            TreeTablePanel.this.selectTreeItemPerformed(selected, target);
        }

        protected List<InlineMenuItem> createTreeMenu() {
            return TreeTablePanel.this.createTreeMenu();
        }

        @Override
        protected List<InlineMenuItem> createTreeChildrenMenu(OrgType org) {
            return TreeTablePanel.this.createTreeChildrenMenu(org);
        }
    };
    treePanel.setOutputMarkupId(true);
    add(treePanel);
    add(createMemberPanel(treePanel.getSelected().getValue()));
    setOutputMarkupId(true);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OrgTreePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreePanel) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 2 with OrgTreePanel

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

the class AssignmentCatalogPanel method addOrReplaceLayout.

public void addOrReplaceLayout(AjaxRequestTarget target, WebMarkupContainer panelContainer) {
    WebMarkupContainer treePanelContainer = new WebMarkupContainer(ID_TREE_PANEL_CONTAINER);
    treePanelContainer.setOutputMarkupId(true);
    panelContainer.addOrReplace(treePanelContainer);
    if (AssignmentViewType.ROLE_CATALOG_VIEW.equals(AssignmentViewType.getViewTypeFromSession(pageBase)) && StringUtils.isNotEmpty(rootOid)) {
        // not let tree panel initializing in case of empty role catalog oid
        OrgTreePanel treePanel = new OrgTreePanel(ID_TREE_PANEL, Model.of(rootOid), false, "AssignmentShoppingCartPanel.treeTitle") {

            private static final long serialVersionUID = 1L;

            @Override
            protected void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
                AssignmentCatalogPanel.this.selectTreeItemPerformed(selected, target);
            }

            protected List<InlineMenuItem> createTreeMenu() {
                return new ArrayList<>();
            }

            @Override
            protected List<InlineMenuItem> createTreeChildrenMenu(OrgType org) {
                return new ArrayList<>();
            }

            @Override
            protected OrgTreeStateStorage getOrgTreeStateStorage() {
                return getRoleCatalogStorage();
            }
        };
        treePanel.setOutputMarkupId(true);
        treePanelContainer.add(new AttributeAppender("class", "col-md-3"));
        treePanelContainer.add(new VisibleEnableBehaviour() {

            private static final long serialVersionUID = 1L;

            @Override
            public boolean isVisible() {
                return !isCatalogOidEmpty();
            }
        });
        treePanelContainer.addOrReplace(treePanel);
    } else {
        WebMarkupContainer treePanel = new WebMarkupContainer(ID_TREE_PANEL);
        treePanel.setVisible(false);
        treePanel.setOutputMarkupId(true);
        treePanelContainer.addOrReplace(treePanel);
    }
    WebMarkupContainer catalogItemsPanelContainer = new WebMarkupContainer(ID_CATALOG_ITEMS_PANEL_CONTAINER);
    catalogItemsPanelContainer.setOutputMarkupId(true);
    panelContainer.addOrReplace(catalogItemsPanelContainer);
    String assignmentsOwnerName = getRoleCatalogStorage().getAssignmentsUserOwner() != null ? getRoleCatalogStorage().getAssignmentsUserOwner().getName().getOrig() : "";
    Label assignmentsOwnerLabel = new Label(ID_ASSIGNMENTS_OWNER_NAME, createStringResource("AssignmentCatalogPanel.assignmentsOwner", assignmentsOwnerName));
    assignmentsOwnerLabel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return AssignmentViewType.USER_TYPE.equals(getRoleCatalogStorage().getViewType());
        }
    });
    catalogItemsPanelContainer.add(assignmentsOwnerLabel);
    CatalogItemsPanel catalogItemsPanel;
    if (AssignmentViewType.USER_TYPE.equals(viewModel.getObject())) {
        PrismObject<UserType> assignmentsOwner = getRoleCatalogStorage().getAssignmentsUserOwner();
        listProviderData = new ArrayList<>();
        if (assignmentsOwner != null) {
            List<AssignmentType> assignments = assignmentsOwner.asObjectable().getAssignment();
            for (AssignmentType assignment : assignments) {
                if (assignment.getTargetRef() == null || !UserType.COMPLEX_TYPE.equals(assignment.getTargetRef().getType())) {
                    assignment.setId(null);
                    listProviderData.add(new AssignmentEditorDto(UserDtoStatus.MODIFY, assignment, pageBase));
                }
            }
            Collections.sort(listProviderData);
        }
        ListDataProvider listDataProvider = new ListDataProvider(this, Model.ofList(listProviderData));
        catalogItemsPanel = new CatalogItemsPanel(ID_CATALOG_ITEMS_PANEL, pageBase, itemsPerRow, listDataProvider);
    } else {
        catalogItemsPanel = new CatalogItemsPanel(ID_CATALOG_ITEMS_PANEL, selectedTreeItemOidModel, pageBase, itemsPerRow, objectProvider);
    }
    if (AssignmentViewType.ROLE_CATALOG_VIEW.equals(AssignmentViewType.getViewTypeFromSession(pageBase))) {
        catalogItemsPanelContainer.add(new AttributeAppender("class", "col-md-9"));
    } else {
        catalogItemsPanelContainer.add(new AttributeAppender("class", "col-md-12"));
    }
    catalogItemsPanel.setOutputMarkupId(true);
    catalogItemsPanelContainer.addOrReplace(catalogItemsPanel);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OrgTreePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreePanel) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Aggregations

InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)2 SelectableBean (com.evolveum.midpoint.web.component.util.SelectableBean)2 OrgTreePanel (com.evolveum.midpoint.web.page.admin.orgs.OrgTreePanel)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 Label (org.apache.wicket.markup.html.basic.Label)1