Search in sources :

Example 26 with VisibleEnableBehaviour

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

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

the class ActionsExecutedInformationPanel method initLayout.

protected void initLayout() {
    WebMarkupContainer tableLinesContainer = new WebMarkupContainer(ID_OBJECTS_TABLE_LINES_CONTAINER);
    ListView tableLines = new ListView<ActionsExecutedObjectsTableLineDto>(ID_OBJECTS_TABLE_LINES, new AbstractReadOnlyModel<List<ActionsExecutedObjectsTableLineDto>>() {

        @Override
        public List<ActionsExecutedObjectsTableLineDto> getObject() {
            final ActionsExecutedInformationDto modelObject = getModelObject();
            if (modelObject == null) {
                return new ArrayList<>();
            }
            if (showResultingActionsOnly) {
                return modelObject.getUniqueObjectsTableLines();
            } else {
                return modelObject.getObjectsTableLines();
            }
        }
    }) {

        protected void populateItem(final ListItem<ActionsExecutedObjectsTableLineDto> item) {
            item.add(new Label(ID_OBJECT_TYPE, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    String key = item.getModelObject().getObjectTypeLocalizationKey();
                    if (key != null) {
                        return createStringResource(key).getString();
                    } else {
                        return item.getModelObject().getObjectType().getLocalPart();
                    }
                }
            }));
            item.add(new Label(ID_OPERATION, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    return createStringResource(item.getModelObject().getOperation()).getString();
                }
            }));
            item.add(new Label(ID_CHANNEL, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    String channel = item.getModelObject().getChannel();
                    if (channel != null && !channel.isEmpty()) {
                        String key = "Channel." + channel;
                        return createStringResource(key).getString();
                    } else {
                        return "";
                    }
                }
            }));
            item.add(new Label(ID_SUCCESS_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_SUCCESS_COUNT)));
            item.add(new Label(ID_LAST_SUCCESS_OBJECT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_OBJECT)));
            item.add(new Label(ID_LAST_SUCCESS_TIMESTAMP, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_LAST_SUCCESS_TIMESTAMP)));
            item.add(new Label(ID_FAILURE_COUNT, new PropertyModel<String>(item.getModel(), ActionsExecutedObjectsTableLineDto.F_FAILURE_COUNT)));
        }
    };
    tableLinesContainer.add(tableLines);
    tableLinesContainer.setOutputMarkupId(true);
    add(tableLinesContainer);
    final Label showResultingActionsOnlyLabel = new Label(ID_SHOW_RESULTING_ACTIONS_ONLY_LABEL, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return showResultingActionsOnly ? createStringResource("ActionsExecutedInformationPanel.showingResultingActionsOnly").getString() : createStringResource("ActionsExecutedInformationPanel.showingAllActions").getString();
        }
    });
    showResultingActionsOnlyLabel.setOutputMarkupId(true);
    add(showResultingActionsOnlyLabel);
    add(new AjaxFallbackLink<String>(ID_SHOW_RESULTING_ACTIONS_ONLY_LINK) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            showResultingActionsOnly = !showResultingActionsOnly;
            ajaxRequestTarget.add(ActionsExecutedInformationPanel.this);
        }
    });
    add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject() != null;
        }
    });
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ActionsExecutedInformationDto(com.evolveum.midpoint.web.page.admin.server.dto.ActionsExecutedInformationDto) Label(org.apache.wicket.markup.html.basic.Label) PropertyModel(org.apache.wicket.model.PropertyModel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListView(org.apache.wicket.markup.html.list.ListView) ArrayList(java.util.ArrayList) List(java.util.List) ListItem(org.apache.wicket.markup.html.list.ListItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 28 with VisibleEnableBehaviour

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

the class RoleMemberPanel method initSearch.

@Override
protected void initSearch(Form form) {
    List<QName> allowedTypes = WebComponentUtil.createFocusTypeList();
    allowedTypes.add(FocusType.COMPLEX_TYPE);
    DropDownChoice<QName> typeSelect = createDropDown(ID_OBJECT_TYPE, Model.of(FocusType.COMPLEX_TYPE), allowedTypes, new QNameChoiceRenderer());
    add(typeSelect);
    DropDownChoice<OrgType> tenant = createDropDown(ID_TENANT, new Model(), createTenantList(), new ObjectTypeChoiceRenderer<OrgType>());
    add(tenant);
    tenant.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isRole();
        }
    });
    DropDownChoice<OrgType> project = createDropDown(ID_PROJECT, new Model(), createProjectList(), new ObjectTypeChoiceRenderer<OrgType>());
    add(project);
    project.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isRole();
        }
    });
    CheckBoxPanel includeIndirectMembers = new CheckBoxPanel(ID_INDIRECT_MEMBERS, new Model<Boolean>(false)) {

        private static final long serialVersionUID = 1L;

        public void onUpdate(AjaxRequestTarget target) {
            refreshTable(target);
        }
    };
    add(includeIndirectMembers);
    // TODO shouldn't we hide also the label?
    includeIndirectMembers.add(new VisibleBehaviour(this::isRole));
}
Also used : QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) QName(javax.xml.namespace.QName) CheckBoxPanel(com.evolveum.midpoint.web.component.data.column.CheckBoxPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 29 with VisibleEnableBehaviour

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

the class SynchronizationInformationPanel method initLayout.

protected void initLayout(final boolean useAfter) {
    WebMarkupContainer titleBefore = new WebMarkupContainer(ID_TITLE_BEFORE);
    titleBefore.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !useAfter;
        }
    });
    add(titleBefore);
    WebMarkupContainer titleAfter = new WebMarkupContainer(ID_TITLE_AFTER);
    titleAfter.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return useAfter;
        }
    });
    add(titleAfter);
    Label aProtected = new Label(ID_PROTECTED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_PROTECTED));
    add(aProtected);
    Label noSync = new Label(ID_NO_SYNCHRONIZATION_POLICY, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_NO_SYNCHRONIZATION_POLICY));
    add(noSync);
    Label syncDisabled = new Label(ID_SYNCHRONIZATION_DISABLED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_SYNCHRONIZATION_DISABLED));
    add(syncDisabled);
    Label notAppl = new Label(ID_NOT_APPLICABLE_FOR_TASK, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_NOT_APPLICABLE_FOR_TASK));
    add(notAppl);
    Label deleted = new Label(ID_DELETED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_DELETED));
    add(deleted);
    Label disputed = new Label(ID_DISPUTED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_DISPUTED));
    add(disputed);
    Label linked = new Label(ID_LINKED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_LINKED));
    add(linked);
    Label unlinked = new Label(ID_UNLINKED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_UNLINKED));
    add(unlinked);
    Label unmatched = new Label(ID_UNMATCHED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_UNMATCHED));
    add(unmatched);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 30 with VisibleEnableBehaviour

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

the class TaskApprovalsTabPanel method initLayout.

private void initLayout(final IModel<TaskDto> taskDtoModel) {
    childPanel = new TaskWfChildPanel(ID_WORKFLOW_CHILD_PANEL, taskDtoModel, parentPage);
    childPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return taskDtoModel.getObject().isWorkflowChild();
        }
    });
    add(childPanel);
    parentPanel = new TaskWfParentPanel(ID_WORKFLOW_PARENT_PANEL, taskDtoModel, parentPage);
    parentPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return taskDtoModel.getObject().isWorkflowParent();
        }
    });
    add(parentPanel);
}
Also used : VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)183 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)116 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)101 Label (org.apache.wicket.markup.html.basic.Label)89 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)51 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)44 List (java.util.List)32 ListItem (org.apache.wicket.markup.html.list.ListItem)29 PropertyModel (org.apache.wicket.model.PropertyModel)29 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)26 ArrayList (java.util.ArrayList)25 Form (org.apache.wicket.markup.html.form.Form)25 ListView (org.apache.wicket.markup.html.list.ListView)25 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)23 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)19 AttributeModifier (org.apache.wicket.AttributeModifier)18 IModel (org.apache.wicket.model.IModel)17 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)16 TextField (org.apache.wicket.markup.html.form.TextField)16 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)15