Example usage for org.apache.wicket.markup.html.list ListView ListView

List of usage examples for org.apache.wicket.markup.html.list ListView ListView

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.list ListView ListView.

Prototype

public ListView(final String id, final List<T> list) 

Source Link

Usage

From source file:com.evolveum.midpoint.gui.api.component.button.DropdownButtonPanel.java

License:Apache License

private void initLayout(DropdownButtonDto model) {

    Label info = new Label(ID_INFO, model.getInfo());
    add(info);/*from  w  w w .ja  v  a  2s.  co m*/

    Label label = new Label(ID_LABEL, model.getLabel());
    add(label);

    WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
    icon.add(AttributeModifier.append("class", model.getIcon()));
    add(icon);

    ListView<InlineMenuItem> li = new ListView<InlineMenuItem>(ID_MENU_ITEM,
            new Model((Serializable) model.getMenuItems())) {

        @Override
        protected void populateItem(ListItem<InlineMenuItem> item) {
            initMenuItem(item);
        }
    };

    add(li);

}

From source file:com.evolveum.midpoint.gui.api.component.PendingOperationPanel.java

License:Apache License

private void initLayout() {
    ListView<PendingOperationType> operation = new ListView<PendingOperationType>(ID_OPERATION, getModel()) {

        private static final long serialVersionUID = 1L;

        @Override//from w w  w . ja v  a  2s .  c o m
        protected void populateItem(ListItem<PendingOperationType> item) {
            item.setRenderBodyOnly(true);

            WebMarkupContainer label = new WebMarkupContainer(ID_LABEL);
            item.add(label);

            Label text = new Label(ID_TEXT, createLabelText(item.getModel()));
            text.setRenderBodyOnly(true);
            label.add(text);

            label.add(AttributeAppender.append("class", createTextClass(item.getModel())));

            label.add(AttributeModifier.replace("title", createTextTooltipModel(item.getModel())));
            label.add(new InfoTooltipBehavior() {

                @Override
                public String getCssClass() {
                    return null;
                }
            });
        }
    };
    add(operation);
}

From source file:com.evolveum.midpoint.gui.api.component.result.OperationResultPanel.java

License:Apache License

private void initParams(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {

    Label paramsLabel = new Label("paramsLabel", parentPage.getString("FeedbackAlertMessageDetails.params"));
    paramsLabel.setOutputMarkupId(true);
    paramsLabel.add(new VisibleEnableBehaviour() {
        private static final long serialVersionUID = 1L;

        @Override/*from   ww  w.ja  v a  2  s . c  om*/
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getParams());
        }
    });

    operationContent.add(paramsLabel);

    ListView<Param> params = new ListView<Param>(ID_PARAMS, createParamsModel(model)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<Param> item) {
            item.add(new Label("paramName", new PropertyModel<Object>(item.getModel(), "name")));
            item.add(new Label("paramValue", new PropertyModel<Object>(item.getModel(), "value")));
        }
    };
    params.setOutputMarkupId(true);
    params.add(new VisibleEnableBehaviour() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getParams());
        }
    });

    operationContent.add(params);

    ListView<OpResult> subresults = new ListView<OpResult>("subresults", createSubresultsModel(model)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<OpResult> item) {
            Panel subresult = new OperationResultPanel("subresult", item.getModel(), getPage());
            subresult.setOutputMarkupId(true);
            item.add(subresult);
        }
    };
    subresults.setOutputMarkupId(true);
    subresults.add(new VisibleEnableBehaviour() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getSubresults());
        }
    });

    operationContent.add(subresults);

}

From source file:com.evolveum.midpoint.gui.api.component.result.OperationResultPanel.java

License:Apache License

private void initContexts(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {

    Label contextsLabel = new Label("contextsLabel",
            parentPage.getString("FeedbackAlertMessageDetails.contexts"));
    contextsLabel.setOutputMarkupId(true);
    contextsLabel.add(new VisibleEnableBehaviour() {
        private static final long serialVersionUID = 1L;

        @Override//from   w  w  w.j ava2s  .c  o m
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getContexts());
        }
    });

    operationContent.add(contextsLabel);

    ListView<Context> contexts = new ListView<Context>("contexts", createContextsModel(model)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<Context> item) {
            item.add(new Label("contextName", new PropertyModel<Object>(item.getModel(), "name")));
            item.add(new Label("contextValue", new PropertyModel<Object>(item.getModel(), "value")));
        }
    };
    contexts.setOutputMarkupId(true);
    contexts.add(new VisibleEnableBehaviour() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return CollectionUtils.isNotEmpty(model.getObject().getContexts());
        }
    });
    operationContent.add(contexts);
}

From source file:com.evolveum.midpoint.gui.api.page.PageBase.java

License:Apache License

private void initTitleLayout() {
    WebMarkupContainer pageTitleContainer = new WebMarkupContainer(ID_PAGE_TITLE_CONTAINER);
    pageTitleContainer.add(createUserStatusBehaviour(true));
    add(pageTitleContainer);/*from   ww w.  j av  a 2 s .  c o  m*/

    WebMarkupContainer pageTitle = new WebMarkupContainer(ID_PAGE_TITLE);
    pageTitleContainer.add(pageTitle);
    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 getSessionStorage().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();
                }
            });
        }
    };
    add(breadcrumbs);
}

From source file:com.evolveum.midpoint.gui.impl.component.MultivalueContainerListPanelWithDetailsPanel.java

License:Apache License

protected void initDetailsPanel() {
    WebMarkupContainer details = new WebMarkupContainer(ID_DETAILS);
    details.setOutputMarkupId(true);/*  www .j av a  2s.  co  m*/
    details.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return itemDetailsVisible;
        }
    });

    add(details);

    ListView<ContainerValueWrapper<C>> itemDetailsView = new ListView<ContainerValueWrapper<C>>(
            MultivalueContainerListPanelWithDetailsPanel.ID_ITEMS_DETAILS,
            new IModel<List<ContainerValueWrapper<C>>>() {
                private static final long serialVersionUID = 1L;

                @Override
                public List<ContainerValueWrapper<C>> getObject() {
                    return detailsPanelItemsList;
                }
            }) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<ContainerValueWrapper<C>> item) {
            MultivalueContainerDetailsPanel<C> detailsPanel = getMultivalueContainerDetailsPanel(item);
            item.add(detailsPanel);
            detailsPanel.setOutputMarkupId(true);

        }

    };

    itemDetailsView.setOutputMarkupId(true);
    details.add(itemDetailsView);

    AjaxButton doneButton = new AjaxButton(ID_DONE_BUTTON,
            createStringResource("MultivalueContainerListPanel.doneButton")) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            itemDetailsVisible = false;
            refreshTable(ajaxRequestTarget);
            ajaxRequestTarget.add(MultivalueContainerListPanelWithDetailsPanel.this);
        }
    };
    details.add(doneButton);

    AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON,
            createStringResource("MultivalueContainerListPanel.cancelButton")) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            itemDetailsVisible = false;
            ajaxRequestTarget.add(MultivalueContainerListPanelWithDetailsPanel.this);
        }
    };
    details.add(cancelButton);
}

From source file:com.evolveum.midpoint.gui.impl.page.admin.configuration.component.NotificationConfigTabPanel.java

License:Apache License

protected void initLayout() {

    PropertyWrapperFromContainerWrapperModel<MailConfigurationType, NotificationConfigurationType> mailConfig = new PropertyWrapperFromContainerWrapperModel<MailConfigurationType, NotificationConfigurationType>(
            getModel().getObject(), NotificationConfigurationType.F_MAIL);

    add(createHeader(ID_MAIL_CONFIG_HEADER,
            mailConfig.getObject().getItemDefinition().getTypeName().getLocalPart() + ".details"));

    Form form = new Form<>("form");

    mailConfigType = new RealValueFromSingleValuePropertyWrapperModel<MailConfigurationType>(mailConfig)
            .getObject();//from   www  . ja  v a 2 s .  c o m

    if (mailConfigType == null) {
        mailConfigType = new MailConfigurationType();
        ((PrismPropertyValue<MailConfigurationType>) mailConfig.getObject().getValues().get(0).getValue())
                .setValue(mailConfigType);
    }

    add(new TextFormGroup(ID_DEFAULT_FROM, new PropertyModel<String>(mailConfigType, "defaultFrom"),
            createStringResource(
                    mailConfig.getObject().getItemDefinition().getTypeName().getLocalPart() + ".defaultFrom"),
            "", getInputCssClass(), false, true));

    add(new TextFormGroup(ID_REDIRECT_TO_FILE, new PropertyModel<String>(mailConfigType, "redirectToFile"),
            createStringResource(mailConfig.getObject().getItemDefinition().getTypeName().getLocalPart()
                    + ".redirectToFile"),
            "", getInputCssClass(), false, true));

    add(new TextFormGroup(ID_LOG_TO_FILE, new PropertyModel<String>(mailConfigType, "logToFile"),
            createStringResource(
                    mailConfig.getObject().getItemDefinition().getTypeName().getLocalPart() + ".logToFile"),
            "", getInputCssClass(), false, true));

    add(new TriStateFormGroup(ID_DEBUG, new PropertyModel<Boolean>(mailConfigType, "debug"),
            createStringResource(
                    mailConfig.getObject().getItemDefinition().getTypeName().getLocalPart() + ".debug"),
            "", getInputCssClass(), false, true));

    add(createHeader(ID_MAIL_SERVER_CONFIG_HEADER,
            MailServerConfigurationType.COMPLEX_TYPE.getLocalPart() + ".details"));

    add(initServersTable());

    add(createHeader(ID_FILE_CONFIG_HEADER, FileConfigurationType.COMPLEX_TYPE.getLocalPart() + ".details"));

    PropertyWrapperFromContainerWrapperModel<FileConfigurationType, NotificationConfigurationType> fileConfig = new PropertyWrapperFromContainerWrapperModel<FileConfigurationType, NotificationConfigurationType>(
            getModel().getObject(), NotificationConfigurationType.F_FILE);

    WebMarkupContainer files = new WebMarkupContainer(ID_FILE_CONFIG);
    files.setOutputMarkupId(true);
    add(files);

    ListView<ValueWrapper<FileConfigurationType>> values = new ListView<ValueWrapper<FileConfigurationType>>(
            "values", new PropertyModel<>(fileConfig, "values")) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<ValueWrapper<FileConfigurationType>> item) {

            FileConfigurationType fileConfigType = item.getModelObject().getValue().getRealValue();

            item.add(createHeader(ID_VALUE_HEADER,
                    fileConfigType == null || fileConfigType.getName() == null
                            || fileConfigType.getName().isEmpty()
                                    ? (FileConfigurationType.COMPLEX_TYPE.getLocalPart() + ".details")
                                    : fileConfigType.getName()));

            AjaxLink removeButton = new AjaxLink(ID_REMOVE_BUTTON) {
                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    ((PrismPropertyValue<FileConfigurationType>) item.getModelObject().getValue())
                            .setValue(null);
                    item.getParent().remove(item.getId());
                    target.add(files);
                }
            };
            item.add(removeButton);

            TextFormGroup name = new TextFormGroup(ID_FILE_NAME,
                    fileConfigType != null ? new PropertyModel<String>(fileConfigType, "name") : Model.of(""),
                    createStringResource(fileConfigType == null ? ""
                            : (fileConfigType.COMPLEX_TYPE.getLocalPart() + ".name")),
                    "", getInputCssClass(), false, true);
            name.getField().add(new OnChangeAjaxBehavior() {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    ((FileConfigurationType) item.getModelObject().getValue().getRealValue())
                            .setName(name.getModelObject());
                }
            });
            item.add(name);

            TextFormGroup file = new TextFormGroup(ID_FILE_PATH,
                    fileConfigType != null ? new PropertyModel<String>(fileConfigType, "file") : Model.of(""),
                    createStringResource(fileConfigType == null ? ""
                            : (fileConfigType.COMPLEX_TYPE.getLocalPart() + ".file")),
                    "", getInputCssClass(), false, true);
            file.getField().add(new OnChangeAjaxBehavior() {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    ((FileConfigurationType) item.getModelObject().getValue().getRealValue())
                            .setFile(file.getModelObject());
                }
            });
            item.add(file);

            item.add(new VisibleEnableBehaviour() {

                @Override
                public boolean isVisible() {
                    return fileConfigType != null;
                }
            });
        }
    };
    values.add(new AttributeModifier("class", "col-md-6"));
    values.setReuseItems(true);
    files.add(values);

    AjaxLink addButton = new AjaxLink(ID_ADD_BUTTON) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            ValueWrapper<FileConfigurationType> newValue = fileConfig.getObject().createAddedValue();
            ((PrismPropertyValue<FileConfigurationType>) newValue.getValue())
                    .setValue(new FileConfigurationType());
            fileConfig.getObject().getValues().add(newValue);
            target.add(files);
        }
    };
    add(addButton);

}

From source file:com.evolveum.midpoint.web.component.assignment.ACAttributePanel.java

License:Apache License

@Override
protected void initLayout() {
    Label attributeLabel = new Label(ID_ATTRIBUTE_LABEL, new PropertyModel(getModel(), ACAttributeDto.F_NAME));
    add(attributeLabel);//ww  w.j a va2  s.  co  m

    WebMarkupContainer required = new WebMarkupContainer(ID_REQUIRED);
    required.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            ACAttributeDto dto = getModel().getObject();
            PrismPropertyDefinition def = dto.getDefinition();

            return def.isMandatory();
        }
    });
    add(required);

    WebMarkupContainer hasOutbound = new WebMarkupContainer(ID_HAS_OUTBOUND);
    hasOutbound.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return hasOutbound();
        }
    });
    add(hasOutbound);

    ListView<ACValueConstructionDto> values = new ListView<ACValueConstructionDto>(ID_VALUES,
            new PropertyModel<List<ACValueConstructionDto>>(getModel(), ACAttributeDto.F_VALUES)) {

        @Override
        protected void populateItem(ListItem<ACValueConstructionDto> listItem) {
            Form form = findParent(Form.class);
            listItem.add(new ACAttributeValuePanel(ID_VALUE, listItem.getModel(), form));
        }
    };
    add(values);
}

From source file:com.evolveum.midpoint.web.component.assignment.ApplicablePolicyConfigPanel.java

License:Apache License

private void initLayout() {
    ListView<ObjectReferenceType> policyGroupsPanel = new ListView<ObjectReferenceType>(ID_POLICY_GROUPS,
            policyGroupsListModel) {//  ww  w  .  j  av a  2  s  .  c  o  m
        @Override
        protected void populateItem(ListItem<ObjectReferenceType> listItem) {
            ApplicablePolicyGroupPanel groupPanel = new ApplicablePolicyGroupPanel(ID_POLICY_GROUP_PANEL,
                    listItem.getModel(), ApplicablePolicyConfigPanel.this.getModel());
            groupPanel.setOutputMarkupId(true);
            listItem.add(groupPanel);
        }
    };
    policyGroupsPanel.setOutputMarkupId(true);
    add(policyGroupsPanel);
}

From source file:com.evolveum.midpoint.web.component.assignment.ApplicablePolicyGroupPanel.java

License:Apache License

private void initLayout() {
    Label policyGroupName = new Label(ID_POLICY_GROUP_NAME, Model.of(WebComponentUtil
            .getDisplayNameOrName(getModelObject(), getPageBase(), OPERATION_LOAD_POLICY_GROUP_NAME)));
    policyGroupName.setOutputMarkupId(true);
    add(policyGroupName);/* www. j  a v a  2  s. co m*/

    ListView<PrismObject<AbstractRoleType>> policiesPanel = new ListView<PrismObject<AbstractRoleType>>(
            ID_POLICIES_CONTAINER, policiesListModel) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<PrismObject<AbstractRoleType>> listItem) {
            PrismObject<AbstractRoleType> abstractRole = listItem.getModelObject();
            CheckBoxPanel policyCheckBox = new CheckBoxPanel(ID_POLICY_CHECK_BOX,
                    getCheckboxModel(abstractRole), null, // visibility
                    Model.of(WebComponentUtil.getDisplayNameOrName(abstractRole)), // label
                    null // tooltip
            ) {
                private static final long serialVersionUID = 1L;

                @Override
                public void onUpdate(AjaxRequestTarget target) {
                    onPolicyAddedOrRemoved(listItem.getModelObject(), getValue());
                }
            };
            policyCheckBox.setOutputMarkupId(true);
            listItem.add(policyCheckBox);
        }
    };
    policiesPanel.setOutputMarkupId(true);
    add(policiesPanel);
}