Search in sources :

Example 41 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project midpoint by Evolveum.

the class MultiValueAutoCompleteTextPanel method initLayout.

private void initLayout(final boolean inputEnabled, 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) {
            AutoCompleteSettings autoCompleteSettings = new AutoCompleteSettings();
            autoCompleteSettings.setShowListOnEmptyInput(true);
            autoCompleteSettings.setMaxHeightInPx(200);
            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("change") {

                @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, 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) AttributeModifier(org.apache.wicket.AttributeModifier) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AutoCompleteSettings(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings) AutoCompleteTextField(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField) ListView(org.apache.wicket.markup.html.list.ListView) 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 42 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior 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 43 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project midpoint by Evolveum.

the class ResourceTypeAssignmentPopupTabPanel method initParametersPanel.

@Override
protected void initParametersPanel(Fragment parametersPanel) {
    initModels();
    WebMarkupContainer kindContainer = new WebMarkupContainer(ID_KIND_CONTAINER);
    kindContainer.setOutputMarkupId(true);
    parametersPanel.add(kindContainer);
    DropDownChoicePanel<ShadowKindType> kindSelector = WebComponentUtil.createEnumPanel(ShadowKindType.class, ID_KIND, WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), Model.of(), ResourceTypeAssignmentPopupTabPanel.this, true);
    kindSelector.setOutputMarkupId(true);
    kindSelector.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            kindValueUpdatePerformed(target);
        }
    });
    kindSelector.getBaseFormComponent().add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return getSelectedObjectsList() != null && getSelectedObjectsList().size() > 0;
        }
    });
    kindSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    kindSelector.setOutputMarkupPlaceholderTag(true);
    kindContainer.add(kindSelector);
    WebMarkupContainer intentContainer = new WebMarkupContainer(ID_INTENT_CONTAINER);
    intentContainer.setOutputMarkupId(true);
    parametersPanel.add(intentContainer);
    DropDownChoicePanel<String> intentSelector = new DropDownChoicePanel<String>(ID_INTENT, Model.of(), intentValues, true);
    intentSelector.getBaseFormComponent().add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return getKindValue() != null && getSelectedObjectsList() != null && getSelectedObjectsList().size() > 0;
        }
    });
    intentSelector.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            intentValueUpdatePerformed(target);
        }
    });
    intentSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    intentSelector.setOutputMarkupId(true);
    intentSelector.setOutputMarkupPlaceholderTag(true);
    intentContainer.add(intentSelector);
    WebMarkupContainer associationContainer = new WebMarkupContainer(ID_ASSOCIATION_CONTAINER);
    associationContainer.setOutputMarkupId(true);
    associationContainer.add(new VisibleBehaviour(() -> isEntitlementAssignment()));
    parametersPanel.add(associationContainer);
    DropDownChoicePanel<ResourceAssociationDefinition> associationSelector = new DropDownChoicePanel<>(ID_ASSOCIATION, Model.of(), associationValuesModel, new IChoiceRenderer<ResourceAssociationDefinition>() {

        private static final long serialVersionUID = 1L;

        @Override
        public Object getDisplayValue(ResourceAssociationDefinition refinedAssociationDefinition) {
            return WebComponentUtil.getAssociationDisplayName(refinedAssociationDefinition);
        }

        @Override
        public String getIdValue(ResourceAssociationDefinition refinedAssociationDefinition, int index) {
            return Integer.toString(index);
        }

        @Override
        public ResourceAssociationDefinition getObject(String id, IModel<? extends List<? extends ResourceAssociationDefinition>> choices) {
            return StringUtils.isNotBlank(id) ? choices.getObject().get(Integer.parseInt(id)) : null;
        }
    }, true);
    associationSelector.setOutputMarkupId(true);
    associationSelector.getBaseFormComponent().add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return getSelectedObjectsList() != null && getSelectedObjectsList().size() > 0 && getKindValue() != null && StringUtils.isNotEmpty(getIntentValue());
        }
    });
    associationSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    associationSelector.setOutputMarkupPlaceholderTag(true);
    associationContainer.add(associationSelector);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) ResourceAssociationDefinition(com.evolveum.midpoint.schema.processor.ResourceAssociationDefinition) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) EmptyOnChangeAjaxFormUpdatingBehavior(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior) ShadowKindType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 44 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project midpoint by Evolveum.

the class ItemPathPanel method initItemPathPanel.

private void initItemPathPanel() {
    WebMarkupContainer itemPathPanel = new WebMarkupContainer(ID_ITEM_PATH);
    itemPathPanel.setOutputMarkupId(true);
    add(itemPathPanel);
    itemPathPanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !getModelObject().isPathDefined();
        }
    });
    WebMarkupContainer namespaceModeContainer = new WebMarkupContainer(ID_NAMESPACE_MODE_CONTAINER);
    namespaceModeContainer.setOutputMarkupId(true);
    namespaceModeContainer.add(new VisibleBehaviour(() -> ItemPathPanelMode.NAMESPACE_MODE.equals(panelMode)));
    itemPathPanel.add(namespaceModeContainer);
    ItemPathSegmentPanel itemDefPanel = new ItemPathSegmentPanel(ID_DEFINITION, getModel()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected Map<QName, Collection<ItemDefinition<?>>> getSchemaDefinitionMap() {
            return initNamspaceDefinitionMap();
        }

        @Override
        protected void onUpdateAutoCompletePanel(AjaxRequestTarget target) {
            ItemPathPanel.this.onUpdate(ItemPathPanel.this.getModelObject());
        }
    };
    itemDefPanel.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    itemDefPanel.setOutputMarkupId(true);
    namespaceModeContainer.add(itemDefPanel);
    AjaxButton plusButton = new AjaxButton(ID_PLUS) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            refreshItemPathPanel(new ItemPathDto(ItemPathPanel.this.getModelObject()), true, target);
        }
    };
    plusButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            if (getModelObject().getParentPath() == null || getModelObject().getParentPath().toItemPath() == null) {
                return true;
            }
            return (getModelObject().getParentPath().getItemDef() instanceof PrismContainerDefinition);
        }
    });
    plusButton.setOutputMarkupId(true);
    namespaceModeContainer.add(plusButton);
    AjaxButton minusButton = new AjaxButton(ID_MINUS) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            ItemPathDto path = ItemPathPanel.this.getModelObject();
            refreshItemPathPanel(path, false, target);
        }
    };
    minusButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return getModelObject().getParentPath() != null && getModelObject().getParentPath().toItemPath() != null;
        }
    });
    minusButton.setOutputMarkupId(true);
    namespaceModeContainer.add(minusButton);
    DropDownChoicePanel<QName> namespacePanel = new DropDownChoicePanel<>(ID_NAMESPACE, new PropertyModel<>(getModel(), "objectType"), new ListModel<>(WebComponentUtil.createObjectTypeList()), new QNameChoiceRenderer());
    namespacePanel.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            refreshItemPath(ItemPathPanel.this.getModelObject(), target);
        }
    });
    namespacePanel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return getModelObject().getParentPath() == null || getModelObject().getParentPath().toItemPath() == null;
        }
    });
    namespacePanel.setOutputMarkupId(true);
    namespaceModeContainer.add(namespacePanel);
    TextPanel<String> itemPathTextField = new TextPanel<String>(ID_ITEM_PATH_TEXT_FIELD, new PropertyModel<>(getModel(), "pathStringValue"));
    itemPathTextField.add(new VisibleBehaviour(() -> switchToTextFieldEnabled && ItemPathPanelMode.TEXT_MODE.equals(panelMode)));
    itemPathTextField.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    itemPathPanel.add(itemPathTextField);
    AjaxButton switchButton = new AjaxButton(ID_SWITCH_TO_TEXT_FIELD_BUTTON) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            switchButtonClickPerformed(target);
        }
    };
    switchButton.setOutputMarkupId(true);
    switchButton.add(AttributeAppender.append("title", new LoadableModel<String>() {

        @Override
        protected String load() {
            return ItemPathPanelMode.NAMESPACE_MODE.equals(panelMode) ? getPageBase().createStringResource("ItemPathPanel.switchToTextModeTitle").getString() : getPageBase().createStringResource("ItemPathPanel.switchToNamespaceModeTitle").getString();
        }
    }));
    switchButton.add(new VisibleBehaviour(() -> switchToTextFieldEnabled));
    itemPathPanel.add(switchButton);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) QName(javax.xml.namespace.QName) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) TextPanel(com.evolveum.midpoint.web.component.input.TextPanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) Collection(java.util.Collection) PrismContainerDefinition(com.evolveum.midpoint.prism.PrismContainerDefinition) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 45 with AjaxFormComponentUpdatingBehavior

use of org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior in project midpoint by Evolveum.

the class TypedAssignablePanel method initAssignmentParametersPanel.

protected void initAssignmentParametersPanel() {
    DropDownChoicePanel<ObjectTypes> typeSelect = new DropDownChoicePanel<>(ID_TYPE, typeModel, Model.ofList(getObjectTypesList()), new EnumChoiceRenderer<>());
    typeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(get(ID_TABLES_CONTAINER));
            target.add(addOrReplace(createCountContainer()));
        }
    });
    typeSelect.setOutputMarkupId(true);
    add(typeSelect);
    WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER);
    relationContainer.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return TypedAssignablePanel.this.isRelationPanelVisible() && !ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
        }
    });
    relationContainer.setOutputMarkupId(true);
    add(relationContainer);
    DropDownChoicePanel<RelationTypes> relationSelector = WebComponentUtil.createEnumPanel(RelationTypes.class, ID_RELATION, WebComponentUtil.createReadonlyModelFromEnum(RelationTypes.class), Model.of(RelationTypes.MEMBER), TypedAssignablePanel.this, false);
    relationSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    relationSelector.setOutputMarkupId(true);
    relationSelector.setOutputMarkupPlaceholderTag(true);
    relationContainer.add(relationSelector);
    WebMarkupContainer kindContainer = new WebMarkupContainer(ID_KIND_CONTAINER);
    kindContainer.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
        }
    });
    kindContainer.setOutputMarkupId(true);
    add(kindContainer);
    DropDownChoicePanel kindSelector = WebComponentUtil.createEnumPanel(ShadowKindType.class, ID_KIND, WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), Model.of(ShadowKindType.ACCOUNT), TypedAssignablePanel.this, false);
    kindSelector.setOutputMarkupId(true);
    kindSelector.getBaseFormComponent().add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName()) && getSelectedResourceCount() > 0;
        }
    });
    kindSelector.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(TypedAssignablePanel.this);
        }
    });
    kindSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    kindSelector.setOutputMarkupPlaceholderTag(true);
    kindContainer.add(kindSelector);
    WebMarkupContainer intentContainer = new WebMarkupContainer(ID_INTENT_CONTAINER);
    intentContainer.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
        }
    });
    intentContainer.setOutputMarkupId(true);
    add(intentContainer);
    DropDownChoicePanel<?> intentSelector = new DropDownChoicePanel<>(ID_INTENT, intentValueModel, intentValues);
    intentSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    intentSelector.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(TypedAssignablePanel.this);
        }
    });
    intentSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
    intentSelector.setOutputMarkupId(true);
    intentSelector.setOutputMarkupPlaceholderTag(true);
    intentSelector.getBaseFormComponent().add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return ResourceType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName()) && getSelectedResourceCount() > 0;
        }
    });
    intentContainer.add(intentSelector);
    WebMarkupContainer orgTreeViewContainer = new WebMarkupContainer(ID_ORG_TREE_VIEW_CONTAINER);
    orgTreeViewContainer.setOutputMarkupId(true);
    orgTreeViewContainer.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            boolean res = OrgType.COMPLEX_TYPE.equals(typeModel.getObject().getTypeQName());
            return res;
        }
    });
    add(orgTreeViewContainer);
    CheckBox orgTreeViewCheckbox = new CheckBox(ID_ORG_TREE_VIEW, orgTreeViewModel);
    orgTreeViewCheckbox.add(new AjaxEventBehavior("change") {

        @Override
        protected void onEvent(AjaxRequestTarget ajaxRequestTarget) {
            orgTreeViewModel.setObject(!orgTreeViewModel.getObject());
            ajaxRequestTarget.add(TypedAssignablePanel.this);
        }
    });
    orgTreeViewCheckbox.setOutputMarkupId(true);
    orgTreeViewContainer.add(orgTreeViewCheckbox);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) RelationTypes(com.evolveum.midpoint.schema.constants.RelationTypes) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) AjaxEventBehavior(org.apache.wicket.ajax.AjaxEventBehavior) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) EmptyOnChangeAjaxFormUpdatingBehavior(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior) CheckBox(org.apache.wicket.markup.html.form.CheckBox) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)55 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)54 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)27 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)25 TextField (org.apache.wicket.markup.html.form.TextField)20 Label (org.apache.wicket.markup.html.basic.Label)18 List (java.util.List)17 IModel (org.apache.wicket.model.IModel)17 ArrayList (java.util.ArrayList)16 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)16 ListItem (org.apache.wicket.markup.html.list.ListItem)13 ListView (org.apache.wicket.markup.html.list.ListView)13 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)10 ComponentFeedbackMessageFilter (org.apache.wicket.feedback.ComponentFeedbackMessageFilter)9 CheckBox (org.apache.wicket.markup.html.form.CheckBox)8 Form (org.apache.wicket.markup.html.form.Form)8 FeedbackPanel (org.apache.wicket.markup.html.panel.FeedbackPanel)8 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)7 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)6 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)5