Search in sources :

Example 6 with ListView

use of org.apache.wicket.markup.html.list.ListView 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 7 with ListView

use of org.apache.wicket.markup.html.list.ListView in project midpoint by Evolveum.

the class TaskBasicTabPanel method initLayoutBasic.

private void initLayoutBasic() {
    // Name
    WebMarkupContainer nameContainer = new WebMarkupContainer(ID_NAME_CONTAINER);
    RequiredTextField<String> name = new RequiredTextField<>(ID_NAME, new PropertyModel<String>(taskDtoModel, TaskDto.F_NAME));
    name.add(parentPage.createEnabledIfEdit(new ItemPath(TaskType.F_NAME)));
    name.add(new AttributeModifier("style", "width: 100%"));
    name.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    nameContainer.add(name);
    nameContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_NAME)));
    add(nameContainer);
    // Description
    WebMarkupContainer descriptionContainer = new WebMarkupContainer(ID_DESCRIPTION_CONTAINER);
    TextArea<String> description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(taskDtoModel, TaskDto.F_DESCRIPTION));
    description.add(parentPage.createEnabledIfEdit(new ItemPath(TaskType.F_DESCRIPTION)));
    //        description.add(new AttributeModifier("style", "width: 100%"));
    //        description.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    descriptionContainer.add(description);
    descriptionContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_DESCRIPTION)));
    add(descriptionContainer);
    // OID
    Label oid = new Label(ID_OID, new PropertyModel(getObjectWrapperModel(), ID_OID));
    add(oid);
    // Identifier
    WebMarkupContainer identifierContainer = new WebMarkupContainer(ID_IDENTIFIER_CONTAINER);
    identifierContainer.add(new Label(ID_IDENTIFIER, new PropertyModel(taskDtoModel, TaskDto.F_IDENTIFIER)));
    identifierContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_TASK_IDENTIFIER)));
    add(identifierContainer);
    // Category
    WebMarkupContainer categoryContainer = new WebMarkupContainer(ID_CATEGORY_CONTAINER);
    categoryContainer.add(new Label(ID_CATEGORY, WebComponentUtil.createCategoryNameModel(this, new PropertyModel(taskDtoModel, TaskDto.F_CATEGORY))));
    categoryContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_CATEGORY)));
    add(categoryContainer);
    // Parent
    WebMarkupContainer parentContainer = new WebMarkupContainer(ID_PARENT_CONTAINER);
    final LinkPanel parent = new LinkPanel(ID_PARENT, new PropertyModel<String>(taskDtoModel, TaskDto.F_PARENT_TASK_NAME)) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            String oid = taskDtoModel.getObject().getParentTaskOid();
            if (oid != null) {
                PageParameters parameters = new PageParameters();
                parameters.add(OnePageParameterEncoder.PARAMETER, oid);
                getPageBase().navigateToNext(PageTaskEdit.class, parameters);
            }
        }
    };
    parentContainer.add(parent);
    parentContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_PARENT)));
    add(parentContainer);
    // Owner
    WebMarkupContainer ownerContainer = new WebMarkupContainer(ID_OWNER_CONTAINER);
    final LinkPanel owner = new LinkPanel(ID_OWNER, new PropertyModel<String>(taskDtoModel, TaskDto.F_OWNER_NAME)) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            String oid = taskDtoModel.getObject().getOwnerOid();
            if (oid != null) {
                PageParameters parameters = new PageParameters();
                parameters.add(OnePageParameterEncoder.PARAMETER, oid);
                getPageBase().navigateToNext(PageUser.class, parameters);
            }
        }
    };
    ownerContainer.add(owner);
    ownerContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_OWNER_REF)));
    add(ownerContainer);
    // Handler URI
    ListView<String> handlerUriContainer = new ListView<String>(ID_HANDLER_URI_CONTAINER, new PropertyModel(taskDtoModel, TaskDto.F_HANDLER_URI_LIST)) {

        @Override
        protected void populateItem(ListItem<String> item) {
            item.add(new Label(ID_HANDLER_URI, item.getModelObject()));
        }
    };
    handlerUriContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_HANDLER_URI), new ItemPath(TaskType.F_OTHER_HANDLERS_URI_STACK)));
    add(handlerUriContainer);
    // Execution
    WebMarkupContainer executionContainer = new WebMarkupContainer(ID_EXECUTION_CONTAINER);
    Label execution = new Label(ID_EXECUTION, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskDtoExecutionStatus executionStatus = taskDtoModel.getObject().getExecution();
            if (executionStatus != TaskDtoExecutionStatus.CLOSED) {
                return getString(TaskDtoExecutionStatus.class.getSimpleName() + "." + executionStatus.name());
            } else {
                return getString(TaskDtoExecutionStatus.class.getSimpleName() + "." + executionStatus.name() + ".withTimestamp", new AbstractReadOnlyModel<String>() {

                    @Override
                    public String getObject() {
                        if (taskDtoModel.getObject().getCompletionTimestamp() != null) {
                            // todo correct formatting
                            return new Date(taskDtoModel.getObject().getCompletionTimestamp()).toLocaleString();
                        } else {
                            return "?";
                        }
                    }
                });
            }
        }
    });
    executionContainer.add(execution);
    Label node = new Label(ID_NODE, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            TaskDto dto = taskDtoModel.getObject();
            if (!TaskDtoExecutionStatus.RUNNING.equals(dto.getExecution())) {
                return null;
            }
            return parentPage.getString("pageTaskEdit.message.node", dto.getExecutingAt());
        }
    });
    executionContainer.add(node);
    executionContainer.add(parentPage.createVisibleIfAccessible(new ItemPath(TaskType.F_EXECUTION_STATUS), new ItemPath(TaskType.F_NODE_AS_OBSERVED)));
    add(executionContainer);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) TextArea(org.apache.wicket.markup.html.form.TextArea) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) Label(org.apache.wicket.markup.html.basic.Label) PropertyModel(org.apache.wicket.model.PropertyModel) TaskDtoExecutionStatus(com.evolveum.midpoint.web.page.admin.server.dto.TaskDtoExecutionStatus) RequiredTextField(org.apache.wicket.markup.html.form.RequiredTextField) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) AttributeModifier(org.apache.wicket.AttributeModifier) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Date(java.util.Date) LinkPanel(com.evolveum.midpoint.web.component.data.column.LinkPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListView(org.apache.wicket.markup.html.list.ListView) ListItem(org.apache.wicket.markup.html.list.ListItem) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 8 with ListView

use of org.apache.wicket.markup.html.list.ListView in project midpoint by Evolveum.

the class DelegationEditorPanel method addPrivilegesPanel.

private void addPrivilegesPanel(WebMarkupContainer body) {
    privilegesNames = getPrivilegesNamesList();
    ListView<String> privilegesListComponent = new ListView<String>(ID_PRIVILEGES_LIST, privilegesNames) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<String> item) {
            Label privilageNameLabel = new Label(ID_PRIVILEGE, item.getModel());
            item.add(privilageNameLabel);
        }
    };
    privilegesListComponent.setOutputMarkupId(true);
    privilegesListComponent.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            if (!UserDtoStatus.ADD.equals(getModelObject().getStatus())) {
                return true;
            }
            return false;
        }
    });
    body.addOrReplace(privilegesListComponent);
}
Also used : ListView(org.apache.wicket.markup.html.list.ListView) Label(org.apache.wicket.markup.html.basic.Label) ListItem(org.apache.wicket.markup.html.list.ListItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 9 with ListView

use of org.apache.wicket.markup.html.list.ListView in project midpoint by Evolveum.

the class PageAuditLogDetails method initEventPanel.

private void initEventPanel(WebMarkupContainer eventPanel) {
    WebMarkupContainer eventDetailsPanel = new WebMarkupContainer(ID_EVENT_DETAILS_PANEL);
    eventDetailsPanel.setOutputMarkupId(true);
    eventPanel.addOrReplace(eventDetailsPanel);
    final Label identifier = new Label(ID_PARAMETERS_EVENT_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_IDENTIFIER));
    identifier.setOutputMarkupId(true);
    eventDetailsPanel.add(identifier);
    final Label timestamp = new Label(ID_PARAMETERS_TIMESTAMP, new PropertyModel(recordModel, ID_PARAMETERS_TIMESTAMP));
    timestamp.setOutputMarkupId(true);
    eventDetailsPanel.add(timestamp);
    final Label sessionIdentifier = new Label(ID_PARAMETERS_SESSION_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_SESSION_IDENTIFIER));
    sessionIdentifier.setOutputMarkupId(true);
    eventDetailsPanel.add(sessionIdentifier);
    final Label taskIdentifier = new Label(ID_PARAMETERS_TASK_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_TASK_IDENTIFIER));
    taskIdentifier.setOutputMarkupId(true);
    eventDetailsPanel.add(taskIdentifier);
    final Label taskOID = new Label(ID_PARAMETERS_TASK_OID, new PropertyModel(recordModel, ID_PARAMETERS_TASK_OID));
    taskOID.setOutputMarkupId(true);
    eventDetailsPanel.add(taskOID);
    final Label hostIdentifier = new Label(ID_PARAMETERS_HOST_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_HOST_IDENTIFIER));
    hostIdentifier.setOutputMarkupId(true);
    eventDetailsPanel.add(hostIdentifier);
    final Label nodeIdentifier = new Label(ID_PARAMETERS_NODE_IDENTIFIER, new PropertyModel(recordModel, ID_PARAMETERS_NODE_IDENTIFIER));
    nodeIdentifier.setOutputMarkupId(true);
    eventDetailsPanel.add(nodeIdentifier);
    final Label remoteHostAddress = new Label(ID_PARAMETERS_REMOTE_HOST_ADDRESS, new PropertyModel(recordModel, ID_PARAMETERS_REMOTE_HOST_ADDRESS));
    remoteHostAddress.setOutputMarkupId(true);
    eventDetailsPanel.add(remoteHostAddress);
    final Label initiatorRef = new Label(ID_PARAMETERS_EVENT_INITIATOR, new Model<>(WebModelServiceUtils.resolveReferenceName(recordModel.getObject().getInitiatorRef(), this, createSimpleTask(ID_PARAMETERS_EVENT_INITIATOR), new OperationResult(ID_PARAMETERS_EVENT_INITIATOR))));
    initiatorRef.setOutputMarkupId(true);
    eventDetailsPanel.add(initiatorRef);
    final Label targetRef = new Label(ID_PARAMETERS_EVENT_TARGET, new Model<>(WebModelServiceUtils.resolveReferenceName(recordModel.getObject().getTargetRef(), this, createSimpleTask(ID_PARAMETERS_EVENT_TARGET), new OperationResult(ID_PARAMETERS_EVENT_TARGET))));
    targetRef.setOutputMarkupId(true);
    eventDetailsPanel.add(targetRef);
    IModel<String> targetOwnerRefModel = new IModel<String>() {

        @Override
        public String getObject() {
            return WebModelServiceUtils.resolveReferenceName(recordModel.getObject().getTargetOwnerRef(), PageAuditLogDetails.this, createSimpleTask(OPERATION_RESOLVE_REFERENCE_NAME), new OperationResult(OPERATION_RESOLVE_REFERENCE_NAME));
        }

        @Override
        public void setObject(String s) {
        }

        @Override
        public void detach() {
        }
    };
    final Label targetOwnerRef = new Label(ID_PARAMETERS_EVENT_TARGET_OWNER, targetOwnerRefModel);
    targetOwnerRef.setOutputMarkupId(true);
    eventDetailsPanel.add(targetOwnerRef);
    final Label eventType = new Label(ID_PARAMETERS_EVENT_TYPE, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_TYPE));
    eventType.setOutputMarkupId(true);
    eventDetailsPanel.add(eventType);
    final Label eventStage = new Label(ID_PARAMETERS_EVENT_STAGE, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_STAGE));
    eventStage.setOutputMarkupId(true);
    eventDetailsPanel.add(eventStage);
    final Label channel = new Label(ID_PARAMETERS_CHANNEL, new PropertyModel(recordModel, ID_PARAMETERS_CHANNEL));
    channel.setOutputMarkupId(true);
    eventDetailsPanel.add(channel);
    final Label eventOutcome = new Label(ID_PARAMETERS_EVENT_OUTCOME, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_OUTCOME));
    eventOutcome.setOutputMarkupId(true);
    eventDetailsPanel.add(eventOutcome);
    final Label eventResult = new Label(ID_PARAMETERS_EVENT_RESULT, new PropertyModel(recordModel, ID_PARAMETERS_EVENT_RESULT));
    eventResult.setOutputMarkupId(true);
    eventDetailsPanel.add(eventResult);
    final Label parameter = new Label(ID_PARAMETERS_PARAMETER, new PropertyModel(recordModel, ID_PARAMETERS_PARAMETER));
    parameter.setOutputMarkupId(true);
    eventDetailsPanel.add(parameter);
    final Label message = new Label(ID_PARAMETERS_MESSAGE, new PropertyModel(recordModel, ID_PARAMETERS_MESSAGE));
    message.setOutputMarkupId(true);
    eventDetailsPanel.add(message);
    ListView<AuditEventRecordItemValueDto> additionalItemsList = new ListView<AuditEventRecordItemValueDto>(ID_ADDITIONAL_ITEM_LINE, new AbstractReadOnlyModel<List<AuditEventRecordItemValueDto>>() {

        @Override
        public List<AuditEventRecordItemValueDto> getObject() {
            List<AuditEventRecordItemValueDto> rv = new ArrayList<>();
            for (AuditEventRecordItemType item : getSortedItems()) {
                String currentName = getDisplayName(item.getName());
                if (item instanceof AuditEventRecordPropertyType) {
                    for (String value : ((AuditEventRecordPropertyType) item).getValue()) {
                        rv.add(new AuditEventRecordItemValueDto(currentName, value));
                        currentName = null;
                    }
                } else if (item instanceof AuditEventRecordReferenceType) {
                    for (AuditEventRecordReferenceValueType value : ((AuditEventRecordReferenceType) item).getValue()) {
                        rv.add(new AuditEventRecordItemValueDto(currentName, value.getTargetName() != null ? value.getTargetName().getOrig() : value.getOid()));
                        currentName = null;
                    }
                } else {
                // should not occur
                }
            }
            return rv;
        }

        // TODO take locale into account when sorting
        private List<AuditEventRecordItemType> getSortedItems() {
            AuditEventRecordType record = recordModel.getObject();
            List<AuditEventRecordItemType> rv = new ArrayList<>();
            rv.addAll(record.getProperty());
            rv.addAll(record.getReference());
            rv.sort((a, b) -> {
                // explicitly enumerated are shown first; others are sorted by display name
                int index_a = EXTENSION_ITEMS_ORDER.indexOf(a.getName());
                int index_b = EXTENSION_ITEMS_ORDER.indexOf(b.getName());
                if (index_a != -1 && index_b != -1) {
                    return Integer.compare(index_a, index_b);
                } else if (index_a != -1) {
                    return -1;
                } else if (index_b != -1) {
                    return 1;
                }
                String name_a = getDisplayName(a.getName());
                String name_b = getDisplayName(b.getName());
                return String.CASE_INSENSITIVE_ORDER.compare(name_a, name_b);
            });
            return rv;
        }

        private String getDisplayName(String nameKey) {
            // null should not occur so we don't try to be nice when displaying it
            return nameKey != null ? createStringResource(nameKey).getString() : "(null)";
        }
    }) {

        @Override
        protected void populateItem(ListItem<AuditEventRecordItemValueDto> item) {
            item.add(new Label(ID_ITEM_NAME, new PropertyModel<String>(item.getModel(), AuditEventRecordItemValueDto.F_NAME)));
            item.add(new Label(ID_ITEM_VALUE, new PropertyModel<String>(item.getModel(), AuditEventRecordItemValueDto.F_VALUE)));
        }
    };
    WebMarkupContainer additionalItemsContainer = new WebMarkupContainer(ID_ADDITIONAL_ITEMS);
    additionalItemsContainer.add(additionalItemsList);
    additionalItemsContainer.add(new VisibleBehaviour(() -> !additionalItemsList.getModelObject().isEmpty()));
    eventDetailsPanel.add(additionalItemsContainer);
}
Also used : AuditEventRecordItemValueDto(com.evolveum.midpoint.web.page.admin.reports.dto.AuditEventRecordItemValueDto) java.util(java.util) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) PageAdminConfiguration(com.evolveum.midpoint.web.page.admin.configuration.PageAdminConfiguration) AuditEventRecordProvider(com.evolveum.midpoint.web.page.admin.reports.dto.AuditEventRecordProvider) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) AuthorizationConstants(com.evolveum.midpoint.security.api.AuthorizationConstants) Trace(com.evolveum.midpoint.util.logging.Trace) UserProfileStorage(com.evolveum.midpoint.web.session.UserProfileStorage) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) WebModelServiceUtils(com.evolveum.midpoint.gui.api.util.WebModelServiceUtils) ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxEventBehavior(org.apache.wicket.ajax.AjaxEventBehavior) IModel(org.apache.wicket.model.IModel) ListView(org.apache.wicket.markup.html.list.ListView) com.evolveum.midpoint.xml.ns._public.common.audit_3(com.evolveum.midpoint.xml.ns._public.common.audit_3) Label(org.apache.wicket.markup.html.basic.Label) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) ListItem(org.apache.wicket.markup.html.list.ListItem) Model(org.apache.wicket.model.Model) WebComponentUtil(com.evolveum.midpoint.gui.api.util.WebComponentUtil) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) AuditEventRecordItemValueDto(com.evolveum.midpoint.web.page.admin.reports.dto.AuditEventRecordItemValueDto) DateLabelComponent(com.evolveum.midpoint.web.component.DateLabelComponent) WorkflowConstants(com.evolveum.midpoint.wf.api.WorkflowConstants) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) PropertyModel(org.apache.wicket.model.PropertyModel) ObjectDeltaOperationPanel(com.evolveum.midpoint.gui.api.component.delta.ObjectDeltaOperationPanel) Item(org.apache.wicket.markup.repeater.Item) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) AuditLogStorage(com.evolveum.midpoint.web.session.AuditLogStorage) PageDescriptor(com.evolveum.midpoint.web.application.PageDescriptor) AuthorizationAction(com.evolveum.midpoint.web.application.AuthorizationAction) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) IModel(org.apache.wicket.model.IModel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Label(org.apache.wicket.markup.html.basic.Label) PropertyModel(org.apache.wicket.model.PropertyModel) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ListView(org.apache.wicket.markup.html.list.ListView) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 10 with ListView

use of org.apache.wicket.markup.html.list.ListView in project midpoint by Evolveum.

the class PageBase method initTitleLayout.

private void initTitleLayout(WebMarkupContainer mainHeader) {
    WebMarkupContainer pageTitleContainer = new WebMarkupContainer(ID_PAGE_TITLE_CONTAINER);
    pageTitleContainer.add(createUserStatusBehaviour(true));
    mainHeader.add(pageTitleContainer);
    WebMarkupContainer pageTitle = new WebMarkupContainer(ID_PAGE_TITLE);
    pageTitleContainer.add(pageTitle);
    String environmentName = "";
    if (deploymentInfoModel != null && deploymentInfoModel.getObject() != null && StringUtils.isNotEmpty(deploymentInfoModel.getObject().getName())) {
        environmentName = deploymentInfoModel.getObject().getName();
    }
    Model<String> deploymentNameModel = new Model<String>(StringUtils.isNotEmpty(environmentName) ? environmentName + ": " : "");
    Label deploymentName = new Label(ID_DEPLOYMENT_NAME, deploymentNameModel);
    deploymentName.add(new VisibleEnableBehaviour() {

        public boolean isVisible() {
            return StringUtils.isNotEmpty(deploymentNameModel.getObject());
        }
    });
    deploymentName.setRenderBodyOnly(true);
    pageTitle.add(deploymentName);
    Label pageTitleReal = new Label(ID_PAGE_TITLE_REAL, createPageTitleModel());
    pageTitleReal.setRenderBodyOnly(true);
    pageTitle.add(pageTitleReal);
    ListView breadcrumbs = new ListView<Breadcrumb>(ID_BREADCRUMB, new AbstractReadOnlyModel<List<Breadcrumb>>() {

        private static final long serialVersionUID = 1L;

        @Override
        public List<Breadcrumb> getObject() {
            return getBreadcrumbs();
        }
    }) {

        @Override
        protected void populateItem(ListItem<Breadcrumb> item) {
            final Breadcrumb dto = item.getModelObject();
            AjaxLink bcLink = new AjaxLink(ID_BC_LINK) {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    redirectBackToBreadcrumb(dto);
                }
            };
            item.add(bcLink);
            bcLink.add(new VisibleEnableBehaviour() {

                private static final long serialVersionUID = 1L;

                @Override
                public boolean isEnabled() {
                    return dto.isUseLink();
                }
            });
            WebMarkupContainer bcIcon = new WebMarkupContainer(ID_BC_ICON);
            bcIcon.add(new VisibleEnableBehaviour() {

                private static final long serialVersionUID = 1L;

                @Override
                public boolean isVisible() {
                    return dto.getIcon() != null && dto.getIcon().getObject() != null;
                }
            });
            bcIcon.add(AttributeModifier.replace("class", dto.getIcon()));
            bcLink.add(bcIcon);
            Label bcName = new Label(ID_BC_NAME, dto.getLabel());
            bcLink.add(bcName);
            item.add(new VisibleEnableBehaviour() {

                private static final long serialVersionUID = 1L;

                @Override
                public boolean isVisible() {
                    return dto.isVisible();
                }
            });
        }
    };
    mainHeader.add(breadcrumbs);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) Breadcrumb(com.evolveum.midpoint.web.component.breadcrumbs.Breadcrumb) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListView(org.apache.wicket.markup.html.list.ListView) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) StringResourceModel(org.apache.wicket.model.StringResourceModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ListItem(org.apache.wicket.markup.html.list.ListItem) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Aggregations

ListView (org.apache.wicket.markup.html.list.ListView)52 ListItem (org.apache.wicket.markup.html.list.ListItem)49 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)37 Label (org.apache.wicket.markup.html.basic.Label)37 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)31 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)25 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)25 List (java.util.List)19 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)17 PropertyModel (org.apache.wicket.model.PropertyModel)15 TextField (org.apache.wicket.markup.html.form.TextField)13 ArrayList (java.util.ArrayList)12 Form (org.apache.wicket.markup.html.form.Form)10 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)9 AttributeModifier (org.apache.wicket.AttributeModifier)8 Model (org.apache.wicket.model.Model)8 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)7 IModel (org.apache.wicket.model.IModel)7 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)5 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)5