Search in sources :

Example 1 with ProcessInstancesPanel

use of com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel in project midpoint by Evolveum.

the class TaskWfChildPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel) {
    changesModel = new PropertyModel<>(taskDtoModel, TaskDto.F_CHANGE_BEING_APPROVED);
    TaskChangesPanel changesPanel = new TaskChangesPanel(ID_CHANGES, changesModel);
    changesPanel.setOutputMarkupId(true);
    add(changesPanel);
    final ItemApprovalHistoryPanel history = new ItemApprovalHistoryPanel(ID_HISTORY, new PropertyModel<>(taskDtoModel, TaskDto.F_WORKFLOW_CONTEXT), UserProfileStorage.TableId.PAGE_TASK_HISTORY_PANEL, (int) parentPage.getItemsPerPage(UserProfileStorage.TableId.PAGE_TASK_HISTORY_PANEL));
    history.setOutputMarkupId(true);
    add(history);
    add(WebComponentUtil.createHelp(ID_HISTORY_HELP));
    WebMarkupContainer workItemsContainer = new WebMarkupContainer(ID_CURRENT_WORK_ITEMS_CONTAINER);
    final ISortableDataProvider<WorkItemDto, String> provider = new ListDataProvider(this, new PropertyModel<List<WorkItemDto>>(taskDtoModel, TaskDto.F_WORK_ITEMS));
    final WorkItemsPanel workItemsPanel = new WorkItemsPanel(ID_CURRENT_WORK_ITEMS, provider, UserProfileStorage.TableId.PAGE_TASK_CURRENT_WORK_ITEMS_PANEL, (int) parentPage.getItemsPerPage(UserProfileStorage.TableId.PAGE_TASK_CURRENT_WORK_ITEMS_PANEL), WorkItemsPanel.View.ITEMS_FOR_PROCESS);
    workItemsPanel.setOutputMarkupId(true);
    workItemsContainer.add(workItemsPanel);
    workItemsContainer.setOutputMarkupId(true);
    workItemsContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return provider.size() > 0;
        }
    });
    workItemsContainer.add(WebComponentUtil.createHelp(ID_CURRENT_WORK_ITEMS_HELP));
    add(workItemsContainer);
    final PropertyModel<List<ProcessInstanceDto>> relatedRequestsModel = new PropertyModel<>(taskDtoModel, TaskDto.F_WORKFLOW_REQUESTS);
    WebMarkupContainer relatedRequestsContainer = new WebMarkupContainer(ID_RELATED_REQUESTS_CONTAINER);
    relatedRequestsContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(relatedRequestsModel.getObject());
        }
    });
    relatedRequestsContainer.setOutputMarkupId(true);
    add(relatedRequestsContainer);
    ISortableDataProvider<ProcessInstanceDto, String> requestsProvider = new ListDataProvider(this, relatedRequestsModel);
    relatedRequestsContainer.add(new ProcessInstancesPanel(ID_RELATED_REQUESTS, requestsProvider, null, 10, ProcessInstancesPanel.View.TASKS_FOR_PROCESS, null));
    relatedRequestsContainer.add(WebComponentUtil.createHelp(ID_RELATED_REQUESTS_HELP));
    add(new AjaxFallbackLink(ID_SHOW_PARENT) {

        public void onClick(AjaxRequestTarget target) {
            String oid = taskDtoModel.getObject().getParentTaskOid();
            if (oid != null) {
                PageParameters parameters = new PageParameters();
                parameters.add(OnePageParameterEncoder.PARAMETER, oid);
                ((PageBase) getPage()).navigateToNext(PageTaskEdit.class, parameters);
            }
        }
    });
    add(WebComponentUtil.createHelp(ID_SHOW_PARENT_HELP));
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) ProcessInstancesPanel(com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ItemApprovalHistoryPanel(com.evolveum.midpoint.web.component.wf.processes.itemApproval.ItemApprovalHistoryPanel) WorkItemsPanel(com.evolveum.midpoint.web.component.wf.WorkItemsPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 2 with ProcessInstancesPanel

use of com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel in project midpoint by Evolveum.

the class TaskWfParentPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel) {
    final PropertyModel<List<ProcessInstanceDto>> requestsModel = new PropertyModel<>(taskDtoModel, TaskDto.F_WORKFLOW_REQUESTS);
    final ISortableDataProvider<ProcessInstanceDto, String> requestsProvider = new ListDataProvider<>(this, requestsModel);
    processInstancesPanel = new ProcessInstancesPanel(ID_REQUESTS, requestsProvider, null, 10, ProcessInstancesPanel.View.TASKS_FOR_PROCESS, null);
    processInstancesPanel.setOutputMarkupId(true);
    add(processInstancesPanel);
    add(WebComponentUtil.createHelp(ID_REQUESTS_HELP));
    changesContainer = new WebMarkupContainer(ID_CHANGES_CONTAINER);
    for (int i = 1; i <= CHANGES_NUMBER; i++) {
        final int index = i;
        final String changesId = ID_CHANGES_PREFIX + i;
        final String changesContentId = changesId + ID_CHANGES_CONTENT_SUFFIX;
        final WebMarkupContainer changes = new WebMarkupContainer(changesId);
        final IModel<TaskChangesDto> changesModel = new AbstractReadOnlyModel<TaskChangesDto>() {

            @Override
            public TaskChangesDto getObject() {
                return taskDtoModel.getObject().getChangesForIndex(index);
            }
        };
        final TaskChangesPanel changesPanel = new TaskChangesPanel(changesContentId, changesModel);
        changes.add(changesPanel);
        changes.add(new VisibleEnableBehaviour() {

            @Override
            public boolean isVisible() {
                return changesModel.getObject() != null;
            }
        });
        changesContainer.add(changes);
    }
    changesContainer.setOutputMarkupId(true);
    add(changesContainer);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ProcessInstancesPanel(com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) PropertyModel(org.apache.wicket.model.PropertyModel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) TaskChangesDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskChangesDto)

Example 3 with ProcessInstancesPanel

use of com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel in project midpoint by Evolveum.

the class PageSelfDashboard method initLayout.

private void initLayout() {
    DashboardSearchPanel dashboardSearchPanel = new DashboardSearchPanel(ID_SEARCH_PANEL, null);
    List<String> searchPanelActions = Arrays.asList(AuthorizationConstants.AUTZ_UI_USERS_ALL_URL, AuthorizationConstants.AUTZ_UI_USERS_URL, AuthorizationConstants.AUTZ_UI_RESOURCES_ALL_URL, AuthorizationConstants.AUTZ_UI_RESOURCES_URL, AuthorizationConstants.AUTZ_UI_TASKS_ALL_URL, AuthorizationConstants.AUTZ_UI_TASKS_URL);
    dashboardSearchPanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.SEARCH);
            return WebComponentUtil.getElementVisibility(visibilityType, searchPanelActions);
        }
    });
    add(dashboardSearchPanel);
    LinksPanel linksPanel = new LinksPanel(ID_LINKS_PANEL, Model.ofList(loadLinksList()));
    linksPanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.SHORTCUTS);
            return WebComponentUtil.getElementVisibility(visibilityType);
        }
    });
    add(linksPanel);
    // TODO is this correct? [med]
    application = getApplication();
    final Session session = Session.get();
    AsyncDashboardPanel<Object, List<WorkItemDto>> workItemsPanel = new AsyncDashboardPanel<Object, List<WorkItemDto>>(ID_WORK_ITEMS_PANEL, createStringResource("PageSelfDashboard.workItems"), GuiStyleConstants.CLASS_OBJECT_WORK_ITEM_ICON, GuiStyleConstants.CLASS_OBJECT_WORK_ITEM_BOX_CSS_CLASSES, true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected SecurityContextAwareCallable<CallableResult<List<WorkItemDto>>> createCallable(Authentication auth, IModel callableParameterModel) {
            return new SecurityContextAwareCallable<CallableResult<List<WorkItemDto>>>(getSecurityEnforcer(), auth) {

                private static final long serialVersionUID = 1L;

                @Override
                public CallableResult<List<WorkItemDto>> callWithContextPrepared() throws Exception {
                    // TODO is this correct? [med]
                    setupContext(application, session);
                    return loadWorkItems();
                }
            };
        }

        @Override
        protected Component getMainComponent(String markupId) {
            ISortableDataProvider provider = new ListDataProvider(this, new PropertyModel<List<WorkItemDto>>(getModel(), CallableResult.F_VALUE));
            return new WorkItemsPanel(markupId, provider, null, 10, WorkItemsPanel.View.DASHBOARD);
        }
    };
    workItemsPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.MY_WORKITEMS);
            return getWorkflowManager().isEnabled() && WebComponentUtil.getElementVisibility(visibilityType);
        }
    });
    add(workItemsPanel);
    AsyncDashboardPanel<Object, List<ProcessInstanceDto>> myRequestsPanel = new AsyncDashboardPanel<Object, List<ProcessInstanceDto>>(ID_REQUESTS_PANEL, createStringResource("PageSelfDashboard.myRequests"), GuiStyleConstants.CLASS_SHADOW_ICON_REQUEST, GuiStyleConstants.CLASS_OBJECT_SERVICE_BOX_CSS_CLASSES, true) {

        private static final long serialVersionUID = 1L;

        @Override
        protected SecurityContextAwareCallable<CallableResult<List<ProcessInstanceDto>>> createCallable(Authentication auth, IModel callableParameterModel) {
            return new SecurityContextAwareCallable<CallableResult<List<ProcessInstanceDto>>>(getSecurityEnforcer(), auth) {

                private static final long serialVersionUID = 1L;

                @Override
                public CallableResult<List<ProcessInstanceDto>> callWithContextPrepared() throws Exception {
                    setupContext(application, session);
                    return loadMyRequests();
                }
            };
        }

        @Override
        protected Component getMainComponent(String markupId) {
            ISortableDataProvider provider = new ListDataProvider(this, new PropertyModel<List<ProcessInstanceDto>>(getModel(), CallableResult.F_VALUE));
            return new ProcessInstancesPanel(markupId, provider, null, 10, ProcessInstancesPanel.View.DASHBOARD, null);
        }
    };
    myRequestsPanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            UserInterfaceElementVisibilityType visibilityType = getComponentVisibility(PredefinedDashboardWidgetId.MY_REQUESTS);
            return getWorkflowManager().isEnabled() && WebComponentUtil.getElementVisibility(visibilityType);
        }
    });
    add(myRequestsPanel);
    initMyAccounts();
    initAssignments();
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) LinksPanel(com.evolveum.midpoint.web.page.self.component.LinksPanel) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) IModel(org.apache.wicket.model.IModel) ProcessInstancesPanel(com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) SecurityContextAwareCallable(com.evolveum.midpoint.web.component.SecurityContextAwareCallable) DashboardSearchPanel(com.evolveum.midpoint.web.page.self.component.DashboardSearchPanel) WorkItemsPanel(com.evolveum.midpoint.web.component.wf.WorkItemsPanel) AsyncDashboardPanel(com.evolveum.midpoint.web.page.admin.home.component.AsyncDashboardPanel) Authentication(org.springframework.security.core.Authentication) PrismObject(com.evolveum.midpoint.prism.PrismObject) CallableResult(com.evolveum.midpoint.web.component.util.CallableResult) AccountCallableResult(com.evolveum.midpoint.web.page.admin.home.dto.AccountCallableResult) Session(org.apache.wicket.Session)

Aggregations

ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)3 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)3 ProcessInstancesPanel (com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel)3 ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)3 WorkItemsPanel (com.evolveum.midpoint.web.component.wf.WorkItemsPanel)2 WorkItemDto (com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 PropertyModel (org.apache.wicket.model.PropertyModel)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 SecurityContextAwareCallable (com.evolveum.midpoint.web.component.SecurityContextAwareCallable)1 CallableResult (com.evolveum.midpoint.web.component.util.CallableResult)1 ItemApprovalHistoryPanel (com.evolveum.midpoint.web.component.wf.processes.itemApproval.ItemApprovalHistoryPanel)1 AsyncDashboardPanel (com.evolveum.midpoint.web.page.admin.home.component.AsyncDashboardPanel)1 AccountCallableResult (com.evolveum.midpoint.web.page.admin.home.dto.AccountCallableResult)1 TaskChangesDto (com.evolveum.midpoint.web.page.admin.server.dto.TaskChangesDto)1 DashboardSearchPanel (com.evolveum.midpoint.web.page.self.component.DashboardSearchPanel)1 LinksPanel (com.evolveum.midpoint.web.page.self.component.LinksPanel)1 Session (org.apache.wicket.Session)1