Search in sources :

Example 11 with AjaxSubmitButton

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

the class PageAbstractSelfCredentials method initButtons.

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

        private static final long serialVersionUID = 1L;

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

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            onSavePerformed(target);
        }
    };
    save.add(new VisibleBehaviour(() -> !this.savedPassword));
    mainForm.setDefaultButton(save);
    mainForm.add(save);
    AjaxSubmitButton cancel = new AjaxSubmitButton(ID_CANCEL_BUTTON, createStringResource("PageBase.button.back")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onError(AjaxRequestTarget target) {
            onCancelPerformed();
        }

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

Example 12 with AjaxSubmitButton

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

the class PageAssignmentConflicts method initLayout.

private void initLayout() {
    MidpointForm mainForm = new MidpointForm(ID_MAIN_FORM);
    mainForm.setOutputMarkupId(true);
    add(mainForm);
    RepeatingView conflictsPanel = new RepeatingView(ID_CONFLICTS_PANEL);
    conflictsPanel.setOutputMarkupId(true);
    List<ConflictDto> conflicts = getSessionStorage().getRoleCatalog().getConflictsList();
    for (ConflictDto dto : conflicts) {
        AssignmentConflictPanel panel = new AssignmentConflictPanel(conflictsPanel.newChildId(), Model.of(dto));
        conflictsPanel.add(panel);
    }
    mainForm.add(conflictsPanel);
    AjaxSubmitButton back = new AjaxSubmitButton(ID_BACK, createStringResource("PageAssignmentConflicts.back")) {

        @Override
        public void onSubmit(AjaxRequestTarget target) {
            redirectBack();
        }
    };
    mainForm.add(back);
    AjaxSubmitButton submit = new AjaxSubmitButton(ID_SUBMIT, createStringResource("PageAssignmentConflicts.submit")) {

        @Override
        public void onSubmit(AjaxRequestTarget target) {
            processConflictDecisions();
            redirectBack();
        }
    };
    mainForm.add(submit);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) ConflictDto(com.evolveum.midpoint.web.page.self.dto.ConflictDto) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) AssignmentConflictPanel(com.evolveum.midpoint.web.page.self.component.AssignmentConflictPanel)

Example 13 with AjaxSubmitButton

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

the class PageAssignmentsList method initLayout.

public void initLayout() {
    setOutputMarkupId(true);
    MidpointForm mainForm = new MidpointForm(ID_FORM);
    mainForm.setOutputMarkupId(true);
    add(mainForm);
    AssignmentTablePanel panel = new AssignmentTablePanel<UserType>(ID_ASSIGNMENT_TABLE_PANEL, assignmentsModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected List<InlineMenuItem> createAssignmentMenu() {
            List<InlineMenuItem> items = new ArrayList<>();
            InlineMenuItem item = new InlineMenuItem(createStringResource("PageAssignmentsList.deleteAllItemsFromShoppingCart")) {

                private static final long serialVersionUID = 1L;

                @Override
                public InlineMenuItemAction initAction() {
                    return new InlineMenuItemAction() {

                        private static final long serialVersionUID = 1L;

                        @Override
                        public void onClick(AjaxRequestTarget target) {
                            getModelObject().forEach(assignmentEditorDto -> assignmentEditorDto.setSelected(true));
                            deleteAssignmentPerformed(target, null);
                        }
                    };
                }
            };
            items.add(item);
            return items;
        }

        @Override
        public IModel<String> getLabel() {
            return createStringResource("PageAssignmentsList.assignmentsToRequest");
        }

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

        @Override
        protected void reloadMainFormButtons(AjaxRequestTarget target) {
            Component requestButton = PageAssignmentsList.this.get(createComponentPath(ID_FORM, ID_REQUEST_BUTTON));
            if (requestButton != null) {
                refreshRequestButton(requestButton);
            }
            target.add(getFeedbackPanel());
            target.add(requestButton);
        }
    };
    mainForm.add(panel);
    UserSelectionButton targetUserPanel = new UserSelectionButton(ID_TARGET_USER_PANEL, new IModel<List<UserType>>() {

        @Override
        public List<UserType> getObject() {
            return WebComponentUtil.loadTargetUsersListForShoppingCart(OPERATION_LOAD_ASSIGNMENT_TARGET_USER_OBJECT, PageAssignmentsList.this);
        }
    }, true, createStringResource("AssignmentCatalogPanel.selectTargetUser")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected String getUserButtonLabel() {
            return getTargetUserSelectionButtonLabel(getModelObject());
        }

        @Override
        protected void onDeleteSelectedUsersPerformed(AjaxRequestTarget target) {
            super.onDeleteSelectedUsersPerformed(target);
            getSessionStorage().getRoleCatalog().setTargetUserOidsList(new ArrayList<>());
            targetUserChangePerformed(target);
        }

        @Override
        protected void multipleUsersSelectionPerformed(AjaxRequestTarget target, List<UserType> usersList) {
            if (CollectionUtils.isNotEmpty(usersList)) {
                List<String> usersOidsList = new ArrayList<>();
                usersList.forEach(user -> usersOidsList.add(user.getOid()));
                getSessionStorage().getRoleCatalog().setTargetUserOidsList(usersOidsList);
            }
            targetUserChangePerformed(target);
        }
    };
    targetUserPanel.setOutputMarkupId(true);
    mainForm.add(targetUserPanel);
    TextArea<String> descriptionInput = new TextArea<>(ID_DESCRIPTION, descriptionModel);
    descriptionInput.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            getSessionStorage().getRoleCatalog().setRequestDescription(getDescriptionComponent().getValue());
        }
    });
    mainForm.add(descriptionInput);
    AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageAssignmentDetails.backButton")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            redirectBack();
        }
    };
    mainForm.add(back);
    AjaxButton requestAssignments = new AjaxButton(ID_REQUEST_BUTTON, createStringResource("PageAssignmentsList.requestButton")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (getSessionStorage().getRoleCatalog().getTargetUserOidsList() == null || getSessionStorage().getRoleCatalog().getTargetUserOidsList().size() <= 1) {
                onSingleUserRequestPerformed(target);
            } else {
                onMultiUserRequestPerformed(target);
            }
        }
    };
    requestAssignments.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return isRequestButtonEnabled();
        }
    });
    mainForm.add(requestAssignments);
    refreshRequestButton(requestAssignments);
    AjaxSubmitButton resolveAssignments = new AjaxSubmitButton(ID_RESOLVE_CONFLICTS_BUTTON, createStringResource("PageAssignmentsList.resolveConflicts")) {

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

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            PageAssignmentsList.this.navigateToNext(PageAssignmentConflicts.class);
        }
    };
    resolveAssignments.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getSessionStorage().getRoleCatalog().isMultiUserRequest() && !areConflictsResolved();
        }
    });
    mainForm.add(resolveAssignments);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) UserSelectionButton(com.evolveum.midpoint.web.component.assignment.UserSelectionButton) TextArea(org.apache.wicket.markup.html.form.TextArea) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) AssignmentTablePanel(com.evolveum.midpoint.web.component.assignment.AssignmentTablePanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component)

Example 14 with AjaxSubmitButton

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

the class PageAbstractFlow method initCaptchaAndButtons.

private void initCaptchaAndButtons(WebMarkupContainer content) {
    CaptchaPanel captcha = new CaptchaPanel(ID_CAPTCHA, this);
    captcha.setOutputMarkupId(true);
    content.add(captcha);
    AjaxSubmitButton register = new AjaxSubmitButton(ID_SUBMIT_REGISTRATION, createStringResource("PageSelfRegistration.register")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onError(AjaxRequestTarget target) {
            showErrors(target);
        }

        protected void onSubmit(AjaxRequestTarget target) {
            doRegistration(target);
        }
    };
    content.add(register);
    AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageSelfRegistration.back")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            setResponsePage(PageLogin.class);
        }
    };
    back.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return isBackButtonVisible();
        }
    });
    content.add(back);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) CaptchaPanel(com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 15 with AjaxSubmitButton

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

the class ProgressPanel method initButtons.

private void initButtons(final MidpointForm progressForm) {
    AjaxSubmitButton abortButton = new AjaxSubmitButton(ID_ABORT, createStringResource("pageAdminFocus.button.abort")) {

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

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    configureButton(abortButton);
    abortButton.add(new VisibleBehaviour(() -> isAbortVisible()));
    progressForm.add(abortButton);
    AjaxSubmitButton backButton = new AjaxSubmitButton(ID_BACK, createStringResource("pageAdminFocus.button.back")) {

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

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    backButton.setVisible(false);
    configureButton(backButton);
    progressForm.add(backButton);
    AjaxSubmitButton continueEditingButton = new AjaxSubmitButton(ID_CONTINUE_EDITING, createStringResource("pageAdminFocus.button.continueEditing")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            ProgressReportingAwarePage page = (ProgressReportingAwarePage) getPage();
            page.continueEditing(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    continueEditingButton.setVisible(false);
    configureButton(continueEditingButton);
    progressForm.add(continueEditingButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour)

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