Search in sources :

Example 91 with ListItem

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

the class MultiValueDropDownPanel method initLayout.

private void initLayout(final boolean nullValid, final NonEmptyModel<Boolean> readOnlyModel) {
    WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModel().getObject().isEmpty();
        }
    });
    add(placeholderContainer);
    AjaxLink<Void> placeholderAdd = new AjaxLink<Void>(ID_PLACEHOLDER_ADD) {

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

        @Override
        public String getObject() {
            if (buttonsDisabled()) {
                return " " + CSS_DISABLED;
            }
            return "";
        }
    }));
    placeholderAdd.setOutputMarkupId(true);
    placeholderAdd.setOutputMarkupPlaceholderTag(true);
    placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
    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);
            choice.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
            item.add(choice);
            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            item.add(buttonGroup);
            initButtons(buttonGroup, item, readOnlyModel);
        }
    };
    repeater.setOutputMarkupId(true);
    repeater.setOutputMarkupPlaceholderTag(true);
    repeater.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getModel().getObject().isEmpty();
        }
    });
    add(repeater);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) ListView(org.apache.wicket.markup.html.list.ListView) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ListItem(org.apache.wicket.markup.html.list.ListItem) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 92 with ListItem

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

the class MultiValueTextPanel method initLayout.

private void initLayout(final NonEmptyModel<Boolean> readOnlyModel, final boolean emptyStringToNull) {
    WebMarkupContainer placeholderContainer = new WebMarkupContainer(ID_PLACEHOLDER_CONTAINER);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.setOutputMarkupPlaceholderTag(true);
    placeholderContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModel().getObject().isEmpty();
        }
    });
    add(placeholderContainer);
    AjaxLink<Void> placeholderAdd = new AjaxLink<Void>(ID_PLACEHOLDER_ADD) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addValuePerformed(target);
        }
    };
    placeholderAdd.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
    placeholderAdd.add(new AttributeAppender("class", new IModel<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("blur") {

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    T updatedValue = (T) text.getConvertedInput();
                    List<T> modelObject = MultiValueTextPanel.this.getModelObject();
                    modelObject.set(item.getIndex(), updatedValue);
                    modelObjectUpdatePerformed(target, modelObject);
                }
            });
            text.add(AttributeAppender.replace("placeholder", createEmptyItemPlaceholder()));
            text.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
            text.setConvertEmptyInputStringToNull(emptyStringToNull);
            item.add(text);
            WebMarkupContainer buttonGroup = new WebMarkupContainer(ID_BUTTON_GROUP);
            item.add(buttonGroup);
            initButtons(buttonGroup, item, readOnlyModel);
        }
    };
    repeater.setOutputMarkupId(true);
    repeater.setOutputMarkupPlaceholderTag(true);
    repeater.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getModel().getObject().isEmpty();
        }
    });
    add(repeater);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) IModel(org.apache.wicket.model.IModel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ListView(org.apache.wicket.markup.html.list.ListView) TextField(org.apache.wicket.markup.html.form.TextField) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ListItem(org.apache.wicket.markup.html.list.ListItem) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) AttributeAppender(org.apache.wicket.behavior.AttributeAppender)

Example 93 with ListItem

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

the class ReportMainPanel method createObjectListForColumns.

private WebMarkupContainer createObjectListForColumns(String panelId, PageAdminObjectDetails<ReportType> parentPage) {
    return new BasicMultivalueContainerListPanel<>(panelId, GuiObjectColumnType.class) {

        @Override
        protected MultivalueContainerDetailsPanel<GuiObjectColumnType> getMultivalueContainerDetailsPanel(ListItem<PrismContainerValueWrapper<GuiObjectColumnType>> item) {
            return createDetailsPanelForColumn(ID_ITEM_DETAILS, item);
        }

        @Override
        protected String getContainerNameForNewButton() {
            return getPageBase().createStringResource("GuiObjectListViewType.column").getString();
        }

        @Override
        protected IModel<PrismContainerWrapper<GuiObjectColumnType>> getContainerModel() {
            return PrismContainerWrapperModel.fromContainerWrapper(ReportMainPanel.this.getObjectModel(), ItemPath.create(ReportType.F_OBJECT_COLLECTION, ObjectCollectionReportEngineConfigurationType.F_VIEW, GuiObjectListViewType.F_COLUMN));
        }

        @Override
        protected Component createHeader(String headerId) {
            Label label = new Label(headerId, getPageBase().createStringResource("EngineReportTabPanel.columns"));
            label.add(AttributeAppender.append("style", "padding-bottom:10px; font-size: 16px; font-weight: 600; color: #3c8dbc;"));
            return label;
        }

        @Override
        protected List<IColumn<PrismContainerValueWrapper<GuiObjectColumnType>, String>> createDefaultColumns() {
            return createColumnsForColumns(parentPage);
        }
    };
}
Also used : BasicMultivalueContainerListPanel(com.evolveum.midpoint.gui.impl.component.BasicMultivalueContainerListPanel) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PrismContainerWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper) Label(org.apache.wicket.markup.html.basic.Label) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 94 with ListItem

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

the class TestConnectionMessagesPanel method initLayout.

private void initLayout() {
    setOutputMarkupId(true);
    WebMarkupContainer messagesPanel = new WebMarkupContainer(ID_MESSAGES_PANEL);
    messagesPanel.setOutputMarkupId(true);
    add(messagesPanel);
    ListView<ConnectorStruct> connectorView = new ListView<ConnectorStruct>(ID_CONNECTOR_MESSAGES_PANEL, connectorResourceResults) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<ConnectorStruct> item) {
            Label connectorNameLabel = new Label(ID_CONNECTOR_NAME, item.getModelObject().connectorName);
            item.add(connectorNameLabel);
            RepeatingView connectorResultView = new RepeatingView(ID_CONNECTOR_MESSAGES);
            List<OpResult> resultsDto = item.getModelObject().connectorResultsDto;
            if (resultsDto != null) {
                initResultsPanel(connectorResultView, resultsDto, parentPage);
            }
            item.add(connectorResultView);
        }
    };
    messagesPanel.add(connectorView);
    RepeatingView resultView = new RepeatingView(ID_RESOURCE_MESSAGES);
    if (modelResourceResults.getObject() != null) {
        initResultsPanel(resultView, modelResourceResults.getObject(), parentPage);
    }
    resultView.setOutputMarkupId(true);
    messagesPanel.add(resultView);
}
Also used : ListView(org.apache.wicket.markup.html.list.ListView) OpResult(com.evolveum.midpoint.gui.api.component.result.OpResult) Label(org.apache.wicket.markup.html.basic.Label) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) ListItem(org.apache.wicket.markup.html.list.ListItem) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 95 with ListItem

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

the class InternalsTracesPanel method onInitialize.

protected void onInitialize() {
    super.onInitialize();
    setOutputMarkupId(true);
    Form form = new MidpointForm<>(ID_FORM);
    form.setOutputMarkupId(true);
    add(form);
    ListView<InternalOperationClasses> tracesTable = new ListView<InternalOperationClasses>(ID_TRACES_TABLE, Arrays.asList(InternalOperationClasses.values())) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<InternalOperationClasses> item) {
            InternalOperationClasses operationClass = item.getModelObject();
            CheckFormGroup checkFormGroup = new CheckFormGroup(ID_TRACE_TOGGLE, new PropertyModel<>(tracesMap, operationClass.getKey()), createStringResource("InternalOperationClasses." + operationClass.getKey()), LABEL_SIZE, INPUT_SIZE);
            item.add(checkFormGroup);
        }
    };
    form.add(tracesTable);
    AjaxSubmitButton update = new AjaxSubmitButton(ID_UPDATE_TRACES, createStringResource("PageBase.button.update")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            updateTraces(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    form.add(update);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InternalOperationClasses(com.evolveum.midpoint.schema.internals.InternalOperationClasses) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) ListView(org.apache.wicket.markup.html.list.ListView) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) ListItem(org.apache.wicket.markup.html.list.ListItem) CheckFormGroup(com.evolveum.midpoint.web.component.form.CheckFormGroup)

Aggregations

ListItem (org.apache.wicket.markup.html.list.ListItem)131 ListView (org.apache.wicket.markup.html.list.ListView)107 Label (org.apache.wicket.markup.html.basic.Label)82 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)73 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)72 IModel (org.apache.wicket.model.IModel)44 List (java.util.List)42 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)40 ArrayList (java.util.ArrayList)38 PropertyModel (org.apache.wicket.model.PropertyModel)28 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)23 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)23 TextField (org.apache.wicket.markup.html.form.TextField)17 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)14 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)14 QName (javax.xml.namespace.QName)13 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)13 Model (org.apache.wicket.model.Model)12 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)11 AttributeModifier (org.apache.wicket.AttributeModifier)11