Search in sources :

Example 1 with TaskChangesDto

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskChangesDto in project midpoint by Evolveum.

the class TaskWfParentPanel method getComponentsToUpdate.

public Collection<Component> getComponentsToUpdate() {
    TaskDto curr = parentPage.getCurrentTaskDto();
    TaskDto prev = parentPage.getPreviousTaskDto();
    List<TaskChangesDto> prevList = prev != null ? prev.getChangesCategorizationList() : null;
    List<TaskChangesDto> currList = curr.getChangesCategorizationList();
    boolean changesChanged = prev == null || !prevList.equals(currList);
    List<Component> rv = new ArrayList<>();
    if (changesChanged) {
        rv.add(changesContainer);
    } else {
        for (int i = 0; i < currList.size(); i++) {
            currList.get(i).applyFoldingFrom(prevList.get(i));
        }
    }
    rv.add(processInstancesPanel);
    return rv;
}
Also used : ArrayList(java.util.ArrayList) Component(org.apache.wicket.Component) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto) TaskChangesDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskChangesDto)

Example 2 with TaskChangesDto

use of com.evolveum.midpoint.web.page.admin.server.dto.TaskChangesDto 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)

Aggregations

TaskChangesDto (com.evolveum.midpoint.web.page.admin.server.dto.TaskChangesDto)2 ArrayList (java.util.ArrayList)2 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 TaskDto (com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)1 ProcessInstancesPanel (com.evolveum.midpoint.web.page.admin.workflow.ProcessInstancesPanel)1 ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)1 List (java.util.List)1 Component (org.apache.wicket.Component)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)1 PropertyModel (org.apache.wicket.model.PropertyModel)1