Search in sources :

Example 1 with UserDelegationsTabPanel

use of com.evolveum.midpoint.web.component.objectdetails.UserDelegationsTabPanel in project midpoint by Evolveum.

the class PageUser method createMainPanel.

@Override
protected AbstractObjectMainPanel<UserType> createMainPanel(String id) {
    return new FocusMainPanel<UserType>(id, getObjectModel(), getAssignmentsModel(), getProjectionModel(), this) {

        @Override
        protected void addSpecificTabs(final PageAdminObjectDetails<UserType> parentPage, List<ITab> tabs) {
            FocusTabVisibleBehavior authorization;
            if (WebComponentUtil.isAuthorized(ModelAuthorizationAction.AUDIT_READ.getUrl())) {
                authorization = new FocusTabVisibleBehavior(unwrapModel(), ComponentConstants.UI_FOCUS_TAB_OBJECT_HISTORY_URL);
                tabs.add(new PanelTab(parentPage.createStringResource("pageAdminFocus.objectHistory"), authorization) {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public WebMarkupContainer createPanel(String panelId) {
                        return createObjectHistoryTabPanel(panelId, parentPage);
                    }
                });
            }
            authorization = new FocusTabVisibleBehavior(unwrapModel(), ComponentConstants.UI_FOCUS_TAB_DELEGATIONS_URL);
            tabs.add(new CountablePanelTab(parentPage.createStringResource("FocusType.delegations"), authorization) {

                private static final long serialVersionUID = 1L;

                @Override
                public WebMarkupContainer createPanel(String panelId) {
                    userDelegationsTabPanel = new UserDelegationsTabPanel<>(panelId, getMainForm(), getObjectModel(), delegationsModel, privilegesListModel, PageUser.this);
                    return userDelegationsTabPanel;
                }

                @Override
                public String getCount() {
                    return Integer.toString(delegationsModel.getObject() == null ? 0 : delegationsModel.getObject().size());
                }
            });
            authorization = new FocusTabVisibleBehavior(unwrapModel(), ComponentConstants.UI_FOCUS_TAB_DELEGATED_TO_ME_URL);
            tabs.add(new CountablePanelTab(parentPage.createStringResource("FocusType.delegatedToMe"), authorization) {

                private static final long serialVersionUID = 1L;

                @Override
                public WebMarkupContainer createPanel(String panelId) {
                    return new AssignmentTablePanel<UserType>(panelId, parentPage.createStringResource("FocusType.delegatedToMe"), getDelegatedToMeModel()) {

                        private static final long serialVersionUID = 1L;

                        @Override
                        public void populateAssignmentDetailsPanel(ListItem<AssignmentEditorDto> item) {
                            DelegationEditorPanel editor = new DelegationEditorPanel(ID_ROW, item.getModel(), true, privilegesListModel, PageUser.this);
                            item.add(editor);
                        }

                        @Override
                        public String getExcludeOid() {
                            return getObject().getOid();
                        }

                        @Override
                        protected List<InlineMenuItem> createAssignmentMenu() {
                            return new ArrayList<>();
                        }
                    };
                }

                @Override
                public String getCount() {
                    return Integer.toString(getDelegatedToMeModel().getObject() == null ? 0 : getDelegatedToMeModel().getObject().size());
                }
            });
        }

        @Override
        protected boolean getOptionsPanelVisibility() {
            if (isSelfProfile()) {
                return false;
            } else {
                return super.getOptionsPanelVisibility();
            }
        }

        @Override
        protected boolean areSavePreviewButtonsEnabled() {
            return super.areSavePreviewButtonsEnabled() || (userDelegationsTabPanel != null ? userDelegationsTabPanel.isDelegationsModelChanged() : false);
        }
    };
}
Also used : PanelTab(com.evolveum.midpoint.gui.api.component.tabs.PanelTab) CountablePanelTab(com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab) DelegationEditorPanel(com.evolveum.midpoint.web.component.assignment.DelegationEditorPanel) UserDelegationsTabPanel(com.evolveum.midpoint.web.component.objectdetails.UserDelegationsTabPanel) AssignmentEditorDto(com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto) CountablePanelTab(com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab) PageAdminObjectDetails(com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) FocusMainPanel(com.evolveum.midpoint.web.component.objectdetails.FocusMainPanel) FocusTabVisibleBehavior(com.evolveum.midpoint.gui.api.util.FocusTabVisibleBehavior)

Aggregations

CountablePanelTab (com.evolveum.midpoint.gui.api.component.tabs.CountablePanelTab)1 PanelTab (com.evolveum.midpoint.gui.api.component.tabs.PanelTab)1 FocusTabVisibleBehavior (com.evolveum.midpoint.gui.api.util.FocusTabVisibleBehavior)1 AssignmentEditorDto (com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto)1 DelegationEditorPanel (com.evolveum.midpoint.web.component.assignment.DelegationEditorPanel)1 FocusMainPanel (com.evolveum.midpoint.web.component.objectdetails.FocusMainPanel)1 UserDelegationsTabPanel (com.evolveum.midpoint.web.component.objectdetails.UserDelegationsTabPanel)1 PageAdminObjectDetails (com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1