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

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

Introduction

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

Prototype

public final Component setOutputMarkupId(final boolean output) 

Source Link

Document

Sets whether or not component will output id attribute into the markup.

Usage

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

License:Apache License

private void initPanelLayout(IModel<String> labelModel) {
    final WebMarkupContainer assignments = new WebMarkupContainer(ID_ASSIGNMENTS);
    assignments.setOutputMarkupId(true);
    add(assignments);/*from  ww w .  j ava  2  s . com*/

    Label label = new Label(ID_HEADER, labelModel);
    assignments.add(label);

    InlineMenu assignmentMenu = new InlineMenu(ID_MENU, new Model((Serializable) createAssignmentMenu()));
    assignments.add(assignmentMenu);

    ListView<AssignmentEditorDto> list = new ListView<AssignmentEditorDto>(ID_LIST, assignmentModel) {

        @Override
        protected void populateItem(ListItem<AssignmentEditorDto> item) {
            AssignmentEditorPanel editor = new AssignmentEditorPanel(ID_ROW, item.getModel());
            item.add(editor);
        }
    };
    list.setOutputMarkupId(true);
    assignments.add(list);

    AjaxCheckBox checkAll = new AjaxCheckBox(ID_CHECK_ALL, new Model()) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            List<AssignmentEditorDto> assignmentEditors = assignmentModel.getObject();

            for (AssignmentEditorDto dto : assignmentEditors) {
                dto.setSelected(this.getModelObject());
            }

            target.add(assignments);
        }
    };
    assignments.add(checkAll);

    initModalWindows();
}

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

License:Apache License

private void initLayout() {
    ListView<RefinedAssociationDefinition> associationsPanel = new ListView<RefinedAssociationDefinition>(
            ID_ASSOCIATIONS, refinedAssociationDefinitionsModel) {
        @Override/*from w w w . ja  v  a  2 s .co  m*/
        protected void populateItem(ListItem<RefinedAssociationDefinition> item) {
            GenericMultiValueLabelEditPanel associationReferencesPanel = new GenericMultiValueLabelEditPanel<ObjectReferenceType>(
                    ID_ASSOCIATION_REFERENCE_PANEL, getShadowReferencesModel(item.getModelObject()),
                    Model.of(WebComponentUtil.getAssociationDisplayName(item.getModelObject())), ID_LABEL_SIZE,
                    ID_INPUT_SIZE, true) {
                private static final long serialVersionUID = 1L;

                @Override
                protected boolean isEditButtonEnabled() {
                    return false;
                }

                @Override
                protected void addValuePerformed(AjaxRequestTarget target) {
                    addNewShadowRefValuePerformed(target, item.getModelObject());
                }

                protected void addFirstPerformed(AjaxRequestTarget target) {
                    addNewShadowRefValuePerformed(target, item.getModelObject());
                }

                @Override
                protected IModel<String> createTextModel(final IModel<ObjectReferenceType> model) {
                    return new IModel<String>() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public String getObject() {
                            ObjectReferenceType obj = model.getObject();
                            if (obj == null) {
                                return "";
                            }
                            return WebComponentUtil.getDisplayNameOrName(obj, getPageBase(),
                                    OPERATION_LOAD_SHADOW_DISPLAY_NAME);
                        }
                    };
                }

                @Override
                protected void removeValuePerformed(AjaxRequestTarget target,
                        ListItem<ObjectReferenceType> item) {
                    ObjectReferenceType removedShadowRef = item.getModelObject();
                    ContainerWrapper<ConstructionType> constructionContainerWrapper = ConstructionAssociationPanel.this
                            .getModelObject();
                    ContainerWrapper associationWrapper = constructionContainerWrapper.findContainerWrapper(
                            constructionContainerWrapper.getPath().append(ConstructionType.F_ASSOCIATION));
                    associationWrapper.getValues().forEach(associationValueWrapper -> {
                        if (ValueStatus.DELETED
                                .equals(((ContainerValueWrapper) associationValueWrapper).getStatus())) {
                            return;
                        }
                        PrismContainerValue associationValue = ((ContainerValueWrapper) associationValueWrapper)
                                .getContainerValue();
                        ResourceObjectAssociationType assoc = (ResourceObjectAssociationType) associationValue
                                .asContainerable();
                        if (assoc == null || assoc.getOutbound() == null
                                || assoc.getOutbound().getExpression() == null || ExpressionUtil
                                        .getShadowRefValue(assoc.getOutbound().getExpression()) == null) {
                            return;
                        }
                        List<ObjectReferenceType> shadowRefList = ExpressionUtil
                                .getShadowRefValue(assoc.getOutbound().getExpression());
                        shadowRefList.forEach(shadowRef -> {
                            if (shadowRef.equals(removedShadowRef)) {
                                ((ContainerValueWrapper) associationValueWrapper)
                                        .setStatus(ValueStatus.DELETED);
                            }
                        });
                    });
                    super.removeValuePerformed(target, item);
                }

            };
            associationReferencesPanel.setOutputMarkupId(true);
            item.add(associationReferencesPanel);
        }
    };

    associationsPanel.setOutputMarkupId(true);
    add(associationsPanel);
}

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

License:Apache License

private void addPrivilegesPanel(WebMarkupContainer body) {
    privilegesNames = getPrivilegesNamesList();
    ListView<String> privilegesListComponent = new ListView<String>(ID_PRIVILEGES_LIST, privilegesNames) {
        private static final long serialVersionUID = 1L;

        @Override/*from  www. j av  a2  s.  c  o  m*/
        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);
}

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

License:Apache License

private void initLayout() {
    setOutputMarkupId(true);//from www. java2s. c  o  m
    ListView<PrismObject<R>> list = new ListView<PrismObject<R>>(ID_LIST, availableRoles) {
        @Override
        protected void populateItem(ListItem<PrismObject<R>> item) {
            item.add(createRoleLink(ID_ITEM, item.getModel()));
        }
    };
    list.setOutputMarkupId(true);
    add(list);

    AjaxLink<String> buttonReset = new AjaxLink<String>(ID_BUTTON_RESET) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            reset();
            target.add(SimpleRoleSelector.this);
        }
    };
    buttonReset.setBody(createStringResource("SimpleRoleSelector.reset"));
    add(buttonReset);
}

From source file:com.evolveum.midpoint.web.component.form.multivalue.MultiValueAutoCompleteTextPanel.java

License:Apache License

private void initLayout(final boolean inputEnabled) {
    WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(new VisibleEnableBehaviour() {

        @Override//from   www.  j a va 2 s .c  o  m
        public boolean isVisible() {
            return getModel().getObject().isEmpty();
        }
    });
    add(placeholderContainer);

    AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addValuePerformed(target);
        }
    };
    placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            if (buttonsDisabled()) {
                return " " + CSS_DISABLED;
            }

            return "";
        }
    }));
    placeholderAdd.setOutputMarkupId(true);
    placeholderAdd.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(placeholderAdd);

    ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

        @Override
        protected void populateItem(final ListItem<T> item) {
            AutoCompleteSettings autoCompleteSettings = new AutoCompleteSettings();
            autoCompleteSettings.setShowListOnEmptyInput(true);
            AutoCompleteTextField<String> autoCompleteEditor = new AutoCompleteTextField<String>(ID_TEXT,
                    createTextModel(item.getModel()), autoCompleteSettings) {

                @Override
                protected Iterator<String> getChoices(String input) {
                    return createAutoCompleteObjectList(input);
                }
            };
            autoCompleteEditor.add(createAutoCompleteValidator());
            autoCompleteEditor.add(new AjaxFormComponentUpdatingBehavior("onchange") {

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            });
            item.add(autoCompleteEditor);

            autoCompleteEditor.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));

            if (!inputEnabled) {
                autoCompleteEditor.add(new AttributeModifier("disabled", "disabled"));
            }
            item.add(autoCompleteEditor);

            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            item.add(buttonGroup);
            initButtons(buttonGroup, item);
        }
    };
    repeater.setOutputMarkupId(true);
    repeater.setOutputMarkupPlaceholderTag(true);
    repeater.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getModel().getObject().isEmpty();
        }
    });
    add(repeater);
}

From source file:com.evolveum.midpoint.web.component.form.multivalue.MultiValueDropDownPanel.java

License:Apache License

private void initLayout(final boolean nullValid) {
    WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(new VisibleEnableBehaviour() {

        @Override/* ww w  . j  a v  a  2  s  .c  o  m*/
        public boolean isVisible() {
            return getModel().getObject().isEmpty();
        }
    });
    add(placeholderContainer);

    AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addValuePerformed(target);
        }
    };
    placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            if (buttonsDisabled()) {
                return " " + CSS_DISABLED;
            }

            return "";
        }
    }));
    placeholderAdd.setOutputMarkupId(true);
    placeholderAdd.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(placeholderAdd);

    ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

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

            DropDownChoice choice = new DropDownChoice<>(ID_INPUT, createDropDownItemModel(item.getModel()),
                    createChoiceList(), createRenderer());
            choice.setNullValid(nullValid);
            item.add(choice);

            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            item.add(buttonGroup);
            initButtons(buttonGroup, item);
        }
    };
    repeater.setOutputMarkupId(true);
    repeater.setOutputMarkupPlaceholderTag(true);
    repeater.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getModel().getObject().isEmpty();
        }
    });
    add(repeater);
}

From source file:com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel.java

License:Apache License

private void initLayout(final boolean inputEnabled) {
    WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(new VisibleEnableBehaviour() {

        @Override//from   w w w  .j a va  2 s . c o m
        public boolean isVisible() {
            return getModel().getObject().isEmpty();
        }
    });
    add(placeholderContainer);

    AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addValuePerformed(target);
        }
    };
    placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            if (buttonsDisabled()) {
                return " " + CSS_DISABLED;
            }

            return "";
        }
    }));
    placeholderAdd.setOutputMarkupId(true);
    placeholderAdd.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(placeholderAdd);

    ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

        @Override
        protected void populateItem(final ListItem<T> item) {
            TextField text = new TextField<>(ID_TEXT, createTextModel(item.getModel()));
            text.add(new AjaxFormComponentUpdatingBehavior("onblur") {

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            });
            text.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));

            if (!inputEnabled) {
                text.add(new AttributeModifier("disabled", "disabled"));
            }
            item.add(text);

            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            item.add(buttonGroup);
            initButtons(buttonGroup, item);
        }
    };
    repeater.setOutputMarkupId(true);
    repeater.setOutputMarkupPlaceholderTag(true);
    repeater.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getModel().getObject().isEmpty();
        }
    });
    add(repeater);
}

From source file:com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel.java

License:Apache License

protected void initPanelLayout() {
    WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(new VisibleEnableBehaviour() {

        @Override/*from w  w  w .ja  v  a  2s  . c  om*/
        public boolean isVisible() {
            return getModel().getObject().isEmpty();
        }
    });
    add(placeholderContainer);

    AjaxLink placeholderAdd = new AjaxLink(ID_PLACEHOLDER_ADD) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addValuePerformed(target);
        }
    };
    placeholderAdd.add(new AttributeAppender("class", new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            if (buttonsDisabled()) {
                return " " + CSS_DISABLED;
            }

            return "";
        }
    }));
    placeholderAdd.setOutputMarkupId(true);
    placeholderAdd.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(placeholderAdd);

    ListView repeater = new ListView<T>(ID_REPEATER, getModel()) {

        @Override
        protected void populateItem(final ListItem<T> item) {
            TextField text = new TextField<>(ID_TEXT, createTextModel(item.getModel()));
            text.add(new AjaxFormComponentUpdatingBehavior("onblur") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            });
            text.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));
            item.add(text);

            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            item.add(buttonGroup);
            initButtons(buttonGroup, item);
        }
    };
    repeater.setOutputMarkupId(true);
    repeater.setOutputMarkupPlaceholderTag(true);
    repeater.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getModel().getObject().isEmpty();
        }
    });
    add(repeater);
}

From source file:com.evolveum.midpoint.web.component.ObjectPolicyConfigurationEditor.java

License:Apache License

@Override
protected void initLayout() {

    final Label label = new Label(ID_LABEL, createStringResource("objectPolicyConfigurationEditor.label"));
    add(label);/*from ww w.  j av a  2 s  . c o  m*/

    ListView repeater = new ListView<ObjectPolicyConfigurationTypeDto>(ID_REPEATER, getModel()) {

        @Override
        protected void populateItem(final ListItem item) {
            WebMarkupContainer textWrapper = new WebMarkupContainer(ID_TEXT_WRAPPER);
            textWrapper.add(AttributeAppender.prepend("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (item.getIndex() > 0) {
                        return OFFSET_CLASS + " " + CLASS_MULTI_VALUE;
                    }

                    return null;
                }
            }));
            item.add(textWrapper);

            TextField name = new TextField<>(ID_NAME, createNameModel(item.getModel()));
            name.setOutputMarkupId(true);
            name.add(new AjaxFormComponentUpdatingBehavior("onblur") {
                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                }
            });
            name.setEnabled(false);
            name.add(AttributeAppender.replace("placeholder",
                    createStringResource("objectPolicyConfigurationEditor.name.placeholder")));
            textWrapper.add(name);

            FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ComponentFeedbackMessageFilter(name));
            textWrapper.add(feedback);

            AjaxLink edit = new AjaxLink(ID_BUTTON_EDIT) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    editPerformed(target, item);
                }
            };
            textWrapper.add(edit);

            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            buttonGroup.add(AttributeAppender.append("class", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    if (item.getIndex() > 0) {
                        return CLASS_MULTI_VALUE;
                    }

                    return null;
                }
            }));
            item.add(buttonGroup);
            initButtons(buttonGroup, item);
        }
    };

    initDialog();
    repeater.setOutputMarkupId(true);
    add(repeater);
}

From source file:com.evolveum.midpoint.web.component.prism.ContainerValuePanel.java

License:Apache License

private <IW extends ItemWrapper> WebMarkupContainer addOrReplaceProperties(
        IModel<ContainerValueWrapper<C>> model, final Form form, ItemVisibilityHandler isPanalVisible,
        boolean isToBeReplaced) {
    isVisibleShowMoreButton = false;// w  w w .ja v a  2  s .com

    WebMarkupContainer propertiesLabel = new WebMarkupContainer(ID_PROPERTIES_LABEL);
    propertiesLabel.setOutputMarkupId(true);

    ListView<IW> properties = new ListView<IW>("properties", new PropertyModel<>(model, "properties")) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<IW> item) {
            item.setOutputMarkupId(true);
            if (item.getModelObject() instanceof PropertyOrReferenceWrapper) {
                PrismPropertyPanel propertyPanel = new PrismPropertyPanel("property", item.getModel(), form,
                        isPanalVisible, pageBase);
                propertyPanel.setOutputMarkupId(true);
                propertyPanel.add(new VisibleEnableBehaviour() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public boolean isVisible() {
                        if (!model.getObject().isExpanded()) {
                            return false;
                        }
                        return propertyPanel.isVisible();
                    }
                });
                item.add(propertyPanel);
                item.add(AttributeModifier.append("class",
                        createStyleClassModel((IModel<ItemWrapper>) item.getModel())));
                if (propertyPanel.isVisible(isPanalVisible)
                        || ((PropertyOrReferenceWrapper) item.getModel().getObject()).isOnlyHide()) {
                    isVisibleShowMoreButton = true;
                }
                return;
            }
            WebMarkupContainer property = new WebMarkupContainer("property");
            item.add(new VisibleEnableBehaviour() {
                @Override
                public boolean isVisible() {
                    return false;
                }
            });
            item.add(property);
        }
    };
    properties.setReuseItems(true);
    properties.setOutputMarkupId(true);
    if (isToBeReplaced) {
        replace(propertiesLabel);
        propertiesLabel.add(properties);
    } else {
        add(propertiesLabel);
        propertiesLabel.add(properties);
    }
    return propertiesLabel;
}