Search in sources :

Example 1 with ISortableDataProvider

use of org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider in project midpoint by Evolveum.

the class SubtasksPanel method initLayout.

private void initLayout(boolean workflowsEnabled) {
    List<IColumn<TaskDto, String>> columns = new ArrayList<IColumn<TaskDto, String>>();
    columns.add(PageTasks.createTaskNameColumn(this, "SubtasksPanel.label.name"));
    columns.add(PageTasks.createTaskCategoryColumn(this, "SubtasksPanel.label.category"));
    columns.add(PageTasks.createTaskExecutionStatusColumn(this, "SubtasksPanel.label.executionState"));
    columns.add(PageTasks.createTaskResultStatusColumn(this, "SubtasksPanel.label.result"));
    //columns.add(PageTasks.createTaskDetailColumn(this, "SubtasksPanel.label.detail", workflowsEnabled));
    ISortableDataProvider provider = new ListDataProvider(this, getModel());
    add(new TablePanel<TaskDto>(ID_SUBTASKS_TABLE, provider, columns));
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Example 2 with ISortableDataProvider

use of org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider in project midpoint by Evolveum.

the class DecisionsPanel method initLayout.

protected void initLayout(UserProfileStorage.TableId tableId, int pageSize) {
    List<IColumn<DecisionDto, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.user"), DecisionDto.F_USER));
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.originalActor"), DecisionDto.F_ORIGINAL_ACTOR));
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.stage"), DecisionDto.F_STAGE));
    columns.add(createOutcomeColumn());
    columns.add(new PropertyColumn<DecisionDto, String>(createStringResource("DecisionsPanel.comment"), DecisionDto.F_COMMENT) {

        @Override
        public void populateItem(Item<ICellPopulator<DecisionDto>> item, String componentId, IModel<DecisionDto> rowModel) {
            super.populateItem(item, componentId, rowModel);
            item.add(new AttributeAppender("style", "max-width: 200px; word-wrap: break-word;"));
        }
    });
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.when"), DecisionDto.F_TIME));
    columns.add(new PropertyColumn<>(createStringResource("DecisionsPanel.escalation"), DecisionDto.F_ESCALATION_LEVEL_NUMBER));
    ISortableDataProvider provider = new ListDataProvider<>(this, getModel());
    BoxedTablePanel decisionsTable = new BoxedTablePanel<>(ID_DECISIONS_TABLE, provider, columns, tableId, pageSize);
    add(decisionsTable);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) DecisionDto(com.evolveum.midpoint.web.page.admin.workflow.dto.DecisionDto) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 3 with ISortableDataProvider

use of org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider in project midpoint by Evolveum.

the class MyAccountsPanel method initLayout.

@Override
protected void initLayout() {
    List<IColumn<SimpleAccountDto, String>> columns = new ArrayList<IColumn<SimpleAccountDto, String>>();
    columns.add(new PropertyColumn(createStringResource("MyAccountsPanel.account.name"), "accountName"));
    columns.add(new PropertyColumn(createStringResource("MyAccountsPanel.account.resource"), "resourceName"));
    ISortableDataProvider provider = new ListDataProvider(this, getModel());
    TablePanel accountsTable = new TablePanel<SimpleAccountDto>(ID_ACCOUNTS_TABLE, provider, columns);
    accountsTable.setShowPaging(false);
    add(accountsTable);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) SimpleAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.SimpleAccountDto) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 4 with ISortableDataProvider

use of org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider in project midpoint by Evolveum.

the class MyAssignmentsPanel method initLayout.

private void initLayout() {
    List<IColumn<AssignmentItemDto, String>> columns = new ArrayList<IColumn<AssignmentItemDto, String>>();
    columns.add(new IconColumn<AssignmentItemDto>(null) {

        private static final long serialVersionUID = 1L;

        @Override
        protected IModel<String> createIconModel(final IModel<AssignmentItemDto> rowModel) {
            return new AbstractReadOnlyModel<String>() {

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    AssignmentItemDto item = rowModel.getObject();
                    if (item.getType() == null) {
                        return OperationResultStatusPresentationProperties.FATAL_ERROR.getIcon() + " fa-lg";
                    }
                    return item.getType().getIconCssClass();
                }
            };
        }

        @Override
        protected IModel<String> createTitleModel(final IModel<AssignmentItemDto> rowModel) {
            return new AbstractReadOnlyModel<String>() {

                private static final long serialVersionUID = 1L;

                @Override
                public String getObject() {
                    AssignmentItemDto item = rowModel.getObject();
                    if (item.getType() == null) {
                        return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.error");
                    }
                    switch(item.getType()) {
                        case CONSTRUCTION:
                            return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.accountConstruction");
                        case ORG_UNIT:
                            return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.orgUnit");
                        case ROLE:
                            return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.role");
                        default:
                            return MyAssignmentsPanel.this.getString("MyAssignmentsPanel.type.error");
                    }
                }
            };
        }
    });
    columns.add(new AbstractColumn<AssignmentItemDto, String>(createStringResource("MyAssignmentsPanel.assignment.displayName")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void populateItem(Item<ICellPopulator<AssignmentItemDto>> cellItem, String componentId, final IModel<AssignmentItemDto> rowModel) {
            AssignmentHeaderPanel panel = new AssignmentHeaderPanel(componentId, rowModel);
            panel.add(new AttributeModifier("class", "dash-assignment-header"));
            cellItem.add(panel);
        }
    });
    ISortableDataProvider provider = new ListDataProvider(this, getModel());
    TablePanel accountsTable = new TablePanel<AssignmentItemDto>(ID_ASSIGNMETNS_TABLE, provider, columns);
    accountsTable.setShowPaging(false);
    add(accountsTable);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) IModel(org.apache.wicket.model.IModel) AssignmentHeaderPanel(com.evolveum.midpoint.web.component.assignment.AssignmentHeaderPanel) ArrayList(java.util.ArrayList) ISortableDataProvider(org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider) AttributeModifier(org.apache.wicket.AttributeModifier) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) AssignmentItemDto(com.evolveum.midpoint.web.page.admin.home.dto.AssignmentItemDto) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 5 with ISortableDataProvider

use of org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider 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)5 ISortableDataProvider (org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider)5 ArrayList (java.util.ArrayList)4 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)4 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)2 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)2 IModel (org.apache.wicket.model.IModel)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 SecurityContextAwareCallable (com.evolveum.midpoint.web.component.SecurityContextAwareCallable)1 AssignmentHeaderPanel (com.evolveum.midpoint.web.component.assignment.AssignmentHeaderPanel)1 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)1 CallableResult (com.evolveum.midpoint.web.component.util.CallableResult)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 WorkItemsPanel (com.evolveum.midpoint.web.component.wf.WorkItemsPanel)1 AsyncDashboardPanel (com.evolveum.midpoint.web.page.admin.home.component.AsyncDashboardPanel)1 AccountCallableResult (com.evolveum.midpoint.web.page.admin.home.dto.AccountCallableResult)1 AssignmentItemDto (com.evolveum.midpoint.web.page.admin.home.dto.AssignmentItemDto)1 SimpleAccountDto (com.evolveum.midpoint.web.page.admin.home.dto.SimpleAccountDto)1 TaskDto (com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)1 ProcessInstancesPanel (com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel)1