Search in sources :

Example 6 with ListDataProvider

use of com.evolveum.midpoint.web.component.util.ListDataProvider in project midpoint by Evolveum.

the class TaskResultTabPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel, final PageBase pageBase) {
    SortableDataProvider<OperationResult, String> provider = new ListDataProvider<>(this, new PropertyModel<List<OperationResult>>(taskDtoModel, TaskDto.F_OP_RESULT));
    TablePanel resultTablePanel = new TablePanel<>(ID_OPERATION_RESULT, provider, initResultColumns());
    resultTablePanel.setStyle("padding-top: 0px;");
    resultTablePanel.setShowPaging(false);
    resultTablePanel.setOutputMarkupId(true);
    add(resultTablePanel);
    add(new AjaxFallbackLink(ID_SHOW_RESULT) {

        public void onClick(AjaxRequestTarget target) {
            OperationResult opResult = taskDtoModel.getObject().getTaskOperationResult();
            OperationResultPanel body = new OperationResultPanel(pageBase.getMainPopupBodyId(), new Model<>(OpResult.getOpResult(pageBase, opResult)), pageBase);
            body.setOutputMarkupId(true);
            pageBase.showMainPopup(body, target);
        }
    });
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) OperationResultPanel(com.evolveum.midpoint.gui.api.component.result.OperationResultPanel) AjaxFallbackLink(org.apache.wicket.ajax.markup.html.AjaxFallbackLink) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ArrayList(java.util.ArrayList) List(java.util.List) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 7 with ListDataProvider

use of com.evolveum.midpoint.web.component.util.ListDataProvider in project midpoint by Evolveum.

the class TaskSubtasksAndThreadsTabPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel) {
    WebMarkupContainer threadsConfigurationPanel = new WebMarkupContainer(ID_THREADS_CONFIGURATION_PANEL);
    add(threadsConfigurationPanel);
    threadsConfigurationPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return taskDtoModel.getObject().configuresWorkerThreads();
        }
    });
    final TextField<Integer> workerThreads = new TextField<>(ID_WORKER_THREADS, new PropertyModel<Integer>(taskDtoModel, TaskDto.F_WORKER_THREADS));
    workerThreads.setOutputMarkupId(true);
    workerThreads.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return parentPage.isEdit();
        }
    });
    threadsConfigurationPanel.add(workerThreads);
    VisibleEnableBehaviour hiddenWhenEditingOrNoSubtasks = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !parentPage.isEdit() && !taskDtoModel.getObject().getSubtasks().isEmpty();
        }
    };
    Label subtasksLabel = new Label(ID_SUBTASKS_LABEL, new ResourceModel("pageTaskEdit.subtasksLabel"));
    subtasksLabel.add(hiddenWhenEditingOrNoSubtasks);
    add(subtasksLabel);
    SubtasksPanel subtasksPanel = new SubtasksPanel(ID_SUBTASKS_PANEL, new PropertyModel<List<TaskDto>>(taskDtoModel, TaskDto.F_SUBTASKS), parentPage.getWorkflowManager().isEnabled());
    subtasksPanel.add(hiddenWhenEditingOrNoSubtasks);
    add(subtasksPanel);
    VisibleEnableBehaviour hiddenWhenNoSubtasks = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            TaskDto taskDto = taskDtoModel.getObject();
            return taskDto != null && !taskDto.getTransientSubtasks().isEmpty();
        }
    };
    Label workerThreadsTableLabel = new Label(ID_WORKER_THREADS_TABLE_LABEL, new ResourceModel("TaskStatePanel.workerThreads"));
    workerThreadsTableLabel.add(hiddenWhenNoSubtasks);
    add(workerThreadsTableLabel);
    List<IColumn<WorkerThreadDto, String>> columns = new ArrayList<>();
    columns.add(new PropertyColumn(createStringResourceStatic(this, "TaskStatePanel.subtaskName"), WorkerThreadDto.F_NAME));
    columns.add(new EnumPropertyColumn<WorkerThreadDto>(createStringResourceStatic(this, "TaskStatePanel.subtaskState"), WorkerThreadDto.F_EXECUTION_STATUS));
    columns.add(new PropertyColumn(createStringResourceStatic(this, "TaskStatePanel.subtaskObjectsProcessed"), WorkerThreadDto.F_PROGRESS));
    ISortableDataProvider<WorkerThreadDto, String> threadsProvider = new ListDataProvider<>(this, new AbstractReadOnlyModel<List<WorkerThreadDto>>() {

        @Override
        public List<WorkerThreadDto> getObject() {
            List<WorkerThreadDto> rv = new ArrayList<>();
            TaskDto taskDto = taskDtoModel.getObject();
            if (taskDto != null) {
                for (TaskDto subtaskDto : taskDto.getTransientSubtasks()) {
                    rv.add(new WorkerThreadDto(subtaskDto));
                }
            }
            return rv;
        }
    });
    TablePanel<WorkerThreadDto> workerThreadsTablePanel = new TablePanel<>(ID_WORKER_THREADS_TABLE, threadsProvider, columns);
    workerThreadsTablePanel.add(hiddenWhenNoSubtasks);
    add(workerThreadsTablePanel);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) EnumPropertyColumn(com.evolveum.midpoint.web.component.data.column.EnumPropertyColumn) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) Label(org.apache.wicket.markup.html.basic.Label) ArrayList(java.util.ArrayList) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) SubtasksPanel(com.evolveum.midpoint.web.page.admin.server.subtasks.SubtasksPanel) TextField(org.apache.wicket.markup.html.form.TextField) ResourceModel(org.apache.wicket.model.ResourceModel) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WorkerThreadDto(com.evolveum.midpoint.web.page.admin.server.dto.WorkerThreadDto) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 8 with ListDataProvider

use of com.evolveum.midpoint.web.component.util.ListDataProvider 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 9 with ListDataProvider

use of com.evolveum.midpoint.web.component.util.ListDataProvider 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 10 with ListDataProvider

use of com.evolveum.midpoint.web.component.util.ListDataProvider 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)

Aggregations

ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)22 ArrayList (java.util.ArrayList)15 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)15 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)12 List (java.util.List)11 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)11 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)8 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)8 Label (org.apache.wicket.markup.html.basic.Label)8 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)7 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)6 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)5 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)5 ISortableDataProvider (org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider)5 Item (org.apache.wicket.markup.repeater.Item)5 ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)4 DataView (org.apache.wicket.markup.repeater.data.DataView)4 IModel (org.apache.wicket.model.IModel)4 PropertyModel (org.apache.wicket.model.PropertyModel)4 NavigatorPanel (com.evolveum.midpoint.web.component.data.paging.NavigatorPanel)3