Search in sources :

Example 31 with AjaxSubmitButton

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

the class PageAccount method initButtons.

private void initButtons(Form mainForm) {
    AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE, createStringResource("pageAccount.button.save")) {

        private static final long serialVersionUID = 1L;

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

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getFeedbackPanel());
        }
    };
    save.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            ShadowWrapper wrapper = accountModel.getObject();
            return !wrapper.isProtected();
        }
    });
    mainForm.add(save);
    AjaxButton back = new AjaxButton(ID_BACK, createStringResource("pageAccount.button.back")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            cancelPerformed(target);
        }
    };
    mainForm.add(back);
    AjaxButton editXmlButton = new AjaxButton(ID_EDIT_XML, createStringResource("AbstractObjectMainPanel.editXmlButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            ConfirmationPanel confirmationPanel = new ConfirmationPanel(getMainPopupBodyId(), createStringResource("AbstractObjectMainPanel.confirmEditXmlRedirect")) {

                private static final long serialVersionUID = 1L;

                @Override
                public void yesPerformed(AjaxRequestTarget target) {
                    PageParameters parameters = new PageParameters();
                    parameters.add(PageDebugView.PARAM_OBJECT_ID, accountModel.getObject().getOid());
                    parameters.add(PageDebugView.PARAM_OBJECT_TYPE, "ShadowType");
                    navigateToNext(PageDebugView.class, parameters);
                }
            };
            showMainPopup(confirmationPanel, target);
        }
    };
    editXmlButton.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_CONFIGURATION_URL, AuthorizationConstants.AUTZ_UI_CONFIGURATION_DEBUG_URL) && !accountModel.getObject().isReadOnly();
        }
    });
    mainForm.add(editXmlButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ShadowWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.ShadowWrapper) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) ConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfirmationPanel)

Example 32 with AjaxSubmitButton

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

the class MultiplicityPolicyPanel method initButtons.

private void initButtons(Form mainForm) {
    AjaxSubmitButton cancel = new AjaxSubmitButton(ID_BUTTON_CANCEL, createStringResource("PageBase.button.cancel")) {

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

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

Example 33 with AjaxSubmitButton

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

the class ConfigurationStep method initLayout.

private void initLayout() {
    MidpointForm form = new MidpointForm<>(ID_MAIN, true);
    form.setOutputMarkupId(true);
    add(form);
    form.add(WebComponentUtil.createTabPanel(ID_CONFIGURATION, parentPage, createConfigurationTabs(), null));
    AjaxSubmitButton testConnection = new AjaxSubmitButton(ID_TEST_CONNECTION, createStringResource("ConfigurationStep.button.testConnection")) {

        @Override
        protected void onError(final AjaxRequestTarget target) {
            WebComponentUtil.refreshFeedbacks(form, target);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            testConnectionPerformed(target);
        }
    };
    testConnection.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !parentPage.isReadOnly();
        }
    });
    add(testConnection);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 34 with AjaxSubmitButton

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

the class PageRequestRole method initButtons.

private void initButtons(Form mainForm) {
    AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE_BUTTON, createStringResource("PageBase.button.save")) {

        @Override
        protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            target.add(getFeedbackPanel());
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            onSavePerformed(target);
        }
    };
    mainForm.setDefaultButton(save);
    mainForm.add(save);
    AjaxSubmitButton cancel = new AjaxSubmitButton(ID_CANCEL_BUTTON, createStringResource("PageBase.button.back")) {

        @Override
        protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            target.add(getFeedbackPanel());
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
        //                onCancelPerformed(target);
        }
    };
    mainForm.add(cancel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(org.apache.wicket.markup.html.form.Form)

Example 35 with AjaxSubmitButton

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

the class SearchItemPanel method initPopover.

private void initPopover() {
    WebMarkupContainer popover = new WebMarkupContainer(ID_POPOVER);
    popover.setOutputMarkupId(true);
    add(popover);
    WebMarkupContainer popoverBody = new WebMarkupContainer(ID_POPOVER_BODY);
    popoverBody.setOutputMarkupId(true);
    popover.add(popoverBody);
    ListView values = new ListView<DisplayableValue>(ID_VALUES, new PropertyModel<List<DisplayableValue>>(popoverModel, SearchItem.F_VALUES)) {

        @Override
        protected void populateItem(final ListItem<DisplayableValue> item) {
            item.add(AttributeModifier.replace("style", new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    return item.getIndex() != 0 ? "margin-top: 5px;" : null;
                }
            }));
            SearchPopupPanel fragment = createPopoverFragment(item.getModel());
            fragment.setRenderBodyOnly(true);
            item.add(fragment);
        }
    };
    popoverBody.add(values);
    AjaxSubmitButton update = new AjaxSubmitButton(ID_UPDATE, createStringResource("SearchItemPanel.update")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            updateItemPerformed(target);
        }
    };
    popoverBody.add(update);
    AjaxButton close = new AjaxButton(ID_CLOSE, createStringResource("SearchItemPanel.close")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            closeEditPopoverPerformed(target);
        }
    };
    popoverBody.add(close);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) ListView(org.apache.wicket.markup.html.list.ListView) Form(org.apache.wicket.markup.html.form.Form) ArrayList(java.util.ArrayList) List(java.util.List) ListItem(org.apache.wicket.markup.html.list.ListItem) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

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