Search in sources :

Example 61 with AjaxSubmitButton

use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.

the class PageSecurityQuestions method initButtons.

public void initButtons(Form mainForm) {
    AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE, createStringResource("PageBase.button.send")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            savePerformed(target);
        }
    };
    mainForm.add(save);
    AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageBase.button.back")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            cancelPerformed();
        }
    };
    mainForm.add(back);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton)

Example 62 with AjaxSubmitButton

use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.

the class PageEmailNonse method initButtons.

private void initButtons(MidpointForm form) {
    AjaxSubmitButton submit = new AjaxSubmitButton(ID_SUBMIT, createStringResource("PageForgetPassword.resetPassword")) {

        private static final long serialVersionUID = 1L;

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

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getFeedbackPanel());
        }
    };
    form.add(submit);
    form.add(createBackButton(ID_BACK_BUTTON));
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton)

Example 63 with AjaxSubmitButton

use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.

the class PageValuePolicy method initButtons.

private void initButtons(MidpointForm mainForm) {
    AjaxButton backButton = new AjaxButton(ID_BACK_BUTTON, createStringResource("PageValuePolicy.button.back")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            redirectBack();
        }
    };
    mainForm.add(backButton);
    AjaxSubmitButton saveButton = new AjaxSubmitButton(ID_SAVE_BUTTON, createStringResource("PageValuePolicy.button.save")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            savePerformed(target);
        }
    };
    mainForm.add(saveButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton)

Example 64 with AjaxSubmitButton

use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.

the class ResourceAssociationEditor method initLayout.

protected void initLayout(NonEmptyModel<Boolean> readOnlyModel) {
    Label label = new Label(ID_LABEL, new ResourceModel("ResourceAssociationEditor.label.edit"));
    label.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(label);
    DropDownChoice kind = new DropDownChoice<>(ID_KIND, new PropertyModel<>(getModel(), "kind"), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<>(this));
    kind.setNullValid(false);
    kind.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(kind);
    MultiValueTextPanel intent = new MultiValueTextPanel<>(ID_INTENT, new PropertyModel<List<String>>(getModel(), "intent"), readOnlyModel, true);
    intent.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(intent);
    DropDownChoice direction = new DropDownChoice<>(ID_DIRECTION, new PropertyModel<>(getModel(), "direction"), WebComponentUtil.createReadonlyModelFromEnum(ResourceObjectAssociationDirectionType.class), new EnumChoiceRenderer<>(this));
    direction.setNullValid(true);
    direction.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(direction);
    DropDownChoice associationAttribute = new DropDownChoice<>(ID_ASSOCIATION_ATTRIBUTE, new PropertyModel<>(getModel(), "associationAttribute"), new IModel<List<QName>>() {

        @Override
        public List<QName> getObject() {
            return loadObjectReferences(false);
        }
    }, new QNameChoiceRenderer(true));
    associationAttribute.setNullValid(true);
    associationAttribute.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(associationAttribute);
    DropDownChoice valueAttribute = new DropDownChoice<>(ID_VALUE_ATTRIBUTE, new PropertyModel<>(getModel(), "valueAttribute"), new IModel<List<QName>>() {

        @Override
        public List<QName> getObject() {
            return loadObjectReferences(false);
        }
    }, new QNameChoiceRenderer(true));
    valueAttribute.setNullValid(true);
    valueAttribute.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(valueAttribute);
    CheckBox explicitRefIntegrity = new CheckBox(ID_EXPLICIT_REF_INTEGRITY, new PropertyModel<>(getModel(), "explicitReferentialIntegrity"));
    explicitRefIntegrity.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(explicitRefIntegrity);
    QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_ASSOCIATION_ATTRIBUTE_PANEL, new PropertyModel<>(getModel(), "ref"), "SchemaHandlingStep.association.tooltip.associationLocalPart", "SchemaHandlingStep.association.tooltip.associationNamespace", true, true) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(parentStep.getAssociationList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }
    };
    nonSchemaRefPanel.setOutputMarkupId(true);
    nonSchemaRefPanel.setOutputMarkupPlaceholderTag(true);
    nonSchemaRefPanel.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(nonSchemaRefPanel);
    TextField displayName = new TextField<>(ID_DISPLAY_NAME, new PropertyModel<String>(getModel(), "displayName"));
    displayName.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(parentStep.getAssociationList());
        }
    });
    displayName.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(displayName);
    TextArea description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), "description"));
    description.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(description);
    AjaxLink<Void> limitations = new AjaxLink<Void>(ID_BUTTON_LIMITATIONS) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            limitationsEditPerformed(target);
        }
    };
    add(limitations);
    CheckBox exclusiveStrong = new CheckBox(ID_EXCLUSIVE_STRONG, new PropertyModel<>(getModel(), "exclusiveStrong"));
    exclusiveStrong.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(exclusiveStrong);
    CheckBox tolerant = new CheckBox(ID_TOLERANT, new PropertyModel<>(getModel(), "tolerant"));
    tolerant.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(tolerant);
    MultiValueTextPanel tolerantVP = new MultiValueTextPanel<>(ID_TOLERANT_VP, new PropertyModel<List<String>>(getModel(), "tolerantValuePattern"), readOnlyModel, true);
    tolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(tolerantVP);
    MultiValueTextPanel intolerantVP = new MultiValueTextPanel<>(ID_INTOLERANT_VP, new PropertyModel<List<String>>(getModel(), "intolerantValuePattern"), readOnlyModel, true);
    intolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(intolerantVP);
    DropDownChoice fetchStrategy = new DropDownChoice<>(ID_FETCH_STRATEGY, new PropertyModel<>(getModel(), "fetchStrategy"), WebComponentUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<>(this));
    fetchStrategy.setNullValid(true);
    fetchStrategy.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(fetchStrategy);
    AttributeEditorUtils.addMatchingRuleFields(this, readOnlyModel);
    VisibleEnableBehaviour showIfEditingOrOutboundExists = AttributeEditorUtils.createShowIfEditingOrOutboundExists(getModel(), readOnlyModel);
    TextField outboundLabel = new TextField<>(ID_OUTBOUND_LABEL, new IModel<String>() {

        @Override
        public String getObject() {
            ResourceObjectAssociationType association = getModel().getObject();
            if (association == null) {
                return null;
            }
            return MappingTypeDto.createMappingLabel(association.getOutbound(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified"));
        }
    });
    outboundLabel.setOutputMarkupId(true);
    outboundLabel.setEnabled(false);
    outboundLabel.add(showIfEditingOrOutboundExists);
    add(outboundLabel);
    AjaxSubmitButton outbound = new AjaxSubmitButton(ID_BUTTON_OUTBOUND) {

        private static final long serialVersionUID = 1L;

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

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(parentStep.getPageBase().getFeedbackPanel());
        }
    };
    outbound.setOutputMarkupId(true);
    outbound.add(showIfEditingOrOutboundExists);
    add(outbound);
    AjaxSubmitLink deleteOutbound = new AjaxSubmitLink(ID_DELETE_OUTBOUND) {

        private static final long serialVersionUID = 1L;

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

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(parentStep.getPageBase().getFeedbackPanel());
        }
    };
    deleteOutbound.setOutputMarkupId(true);
    deleteOutbound.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
    add(deleteOutbound);
    MultiValueTextEditPanel inbound = new MultiValueTextEditPanel<MappingType>(ID_INBOUND, new PropertyModel<>(getModel(), "inbound"), null, false, true, readOnlyModel) {

        @Override
        protected IModel<String> createTextModel(final IModel<MappingType> model) {
            return new Model<String>() {

                @Override
                public String getObject() {
                    return MappingTypeDto.createMappingLabel(model.getObject(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified"));
                }
            };
        }

        @Override
        protected MappingType createNewEmptyItem() {
            return WizardUtil.createEmptyMapping();
        }

        @Override
        protected void performAddValueHook(AjaxRequestTarget target, MappingType added) {
            target.add(parentStep.getAssociationList());
            // because of marking duplicates
            target.add(parentStep.getAttributeList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }

        @Override
        protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<MappingType> item) {
            target.add(parentStep.getAssociationList());
            // because of marking duplicates
            target.add(parentStep.getAttributeList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }

        @Override
        protected void editPerformed(AjaxRequestTarget target, MappingType object) {
            inboundEditPerformed(target, object);
        }
    };
    inbound.setOutputMarkupId(true);
    add(inbound);
    Label kindTooltip = new Label(ID_T_KIND);
    kindTooltip.add(new InfoTooltipBehavior());
    add(kindTooltip);
    Label intentTooltip = new Label(ID_T_INTENT);
    intentTooltip.add(new InfoTooltipBehavior());
    add(intentTooltip);
    Label directionTooltip = new Label(ID_T_DIRECTION);
    directionTooltip.add(new InfoTooltipBehavior());
    add(directionTooltip);
    Label assAttributeTooltip = new Label(ID_T_ASSOCIATION_ATTRIBUTE);
    assAttributeTooltip.add(new InfoTooltipBehavior());
    add(assAttributeTooltip);
    Label valueAttributeTooltip = new Label(ID_T_VALUE_ATTRIBUTE);
    valueAttributeTooltip.add(new InfoTooltipBehavior());
    add(valueAttributeTooltip);
    Label integrityTooltip = new Label(ID_T_EXPLICIT_REF_INTEGRITY);
    integrityTooltip.add(new InfoTooltipBehavior());
    add(integrityTooltip);
    Label limitationsTooltip = new Label(ID_T_LIMITATIONS);
    limitationsTooltip.add(new InfoTooltipBehavior());
    add(limitationsTooltip);
    Label exclusiveStrongTooltip = new Label(ID_T_EXCLUSIVE_STRONG);
    exclusiveStrongTooltip.add(new InfoTooltipBehavior());
    add(exclusiveStrongTooltip);
    Label tolerantTooltip = new Label(ID_T_TOLERANT);
    tolerantTooltip.add(new InfoTooltipBehavior());
    add(tolerantTooltip);
    Label tolerantVPTooltip = new Label(ID_T_TOLERANT_VP);
    tolerantVPTooltip.add(new InfoTooltipBehavior());
    add(tolerantVPTooltip);
    Label intolerantVPTooltip = new Label(ID_T_INTOLERANT_VP);
    intolerantVPTooltip.add(new InfoTooltipBehavior());
    add(intolerantVPTooltip);
    Label fetchTooltip = new Label(ID_T_FETCH);
    fetchTooltip.add(new InfoTooltipBehavior());
    add(fetchTooltip);
    Label matchingRuleTooltip = new Label(ID_T_MATCHING_RULE);
    matchingRuleTooltip.add(new InfoTooltipBehavior());
    add(matchingRuleTooltip);
    Label outboundTooltip = new Label(ID_T_OUTBOUND);
    outboundTooltip.add(new InfoTooltipBehavior());
    add(outboundTooltip);
    Label inboundTooltip = new Label(ID_T_INBOUND);
    inboundTooltip.add(new InfoTooltipBehavior());
    add(inboundTooltip);
    initModals(readOnlyModel);
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) AjaxSubmitLink(org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink) MultiValueTextEditPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel) EmptyOnChangeAjaxFormUpdatingBehavior(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) MultiValueTextPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel) QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) QNameEditorPanel(com.evolveum.midpoint.web.component.input.QNameEditorPanel) NonEmptyModel(com.evolveum.midpoint.gui.api.model.NonEmptyModel) PageResourceWizard(com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 65 with AjaxSubmitButton

use of com.evolveum.midpoint.web.component.AjaxSubmitButton in project midpoint by Evolveum.

the class ExpressionVariableEditorDialog method initLayout.

public void initLayout(WebMarkupContainer content) {
    Form form = new MidpointForm(ID_MAIN_FORM);
    form.setOutputMarkupId(true);
    content.add(form);
    // TODO - shouldn't this be some AutoCompleteField? If yer, where do we
    // get value?
    TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_VARIABLE + ".name.localPart"), createStringResource("ExpressionVariableEditor.label.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(name);
    TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_VARIABLE + ".description"), createStringResource("ExpressionVariableEditor.label.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(description);
    TextFormGroup path = new TextFormGroup(ID_PATH, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_PATH), createStringResource("ExpressionVariableEditor.label.path"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(path);
    DropDownFormGroup objectReference = new DropDownFormGroup<>(ID_OBJECT_REFERENCE, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_VARIABLE + ".objectRef"), new IModel<List<ObjectReferenceType>>() {

        @Override
        public List<ObjectReferenceType> getObject() {
            return WebModelServiceUtils.createObjectReferenceList(ObjectType.class, getPageBase(), objectMap);
        }
    }, new ObjectReferenceChoiceRenderer(objectMap), createStringResource("ExpressionVariableEditor.label.objectRef"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(objectReference);
    TextAreaFormGroup value = new TextAreaFormGroup(ID_VALUE, new PropertyModel<>(model, ExpressionVariableDefinitionTypeDto.F_VALUE), createStringResource("ExpressionVariableEditor.label.value"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(value);
    AjaxSubmitButton cancel = new AjaxSubmitButton(ID_BUTTON_CANCEL, createStringResource("ExpressionVariableEditor.button.cancel")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            cancelPerformed(target);
        }
    };
    form.add(cancel);
    AjaxSubmitButton save = new AjaxSubmitButton(ID_BUTTON_SAVE, createStringResource("ExpressionVariableEditor.button.apply")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            savePerformed(target);
        }
    };
    form.add(save);
}
Also used : ObjectReferenceChoiceRenderer(com.evolveum.midpoint.web.component.input.ObjectReferenceChoiceRenderer) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) TextFormGroup(com.evolveum.midpoint.web.component.form.TextFormGroup) DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) TextAreaFormGroup(com.evolveum.midpoint.web.component.form.TextAreaFormGroup) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)67 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)65 Form (org.apache.wicket.markup.html.form.Form)27 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)23 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)23 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)20 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)12 ArrayList (java.util.ArrayList)9 List (java.util.List)8 Label (org.apache.wicket.markup.html.basic.Label)8 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)7 ListItem (org.apache.wicket.markup.html.list.ListItem)5 CheckFormGroup (com.evolveum.midpoint.web.component.form.CheckFormGroup)4 AceEditor (com.evolveum.midpoint.web.component.AceEditor)3 Form (com.evolveum.midpoint.web.component.form.Form)3 QNameChoiceRenderer (com.evolveum.midpoint.web.component.input.QNameChoiceRenderer)3 TextPanel (com.evolveum.midpoint.web.component.input.TextPanel)3 FeedbackAlerts (com.evolveum.midpoint.web.component.message.FeedbackAlerts)3 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3