Search in sources :

Example 46 with AjaxSubmitButton

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

the class PageDebugView method initButtons.

private void initButtons(final Form mainForm) {
    AjaxSubmitButton saveButton = new AjaxSubmitButton("saveButton", createStringResource("pageDebugView.button.save")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            savePerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(getFeedbackPanel());
        }
    };
    mainForm.add(saveButton);
    AjaxButton backButton = new AjaxButton("backButton", createStringResource("pageDebugView.button.back")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            redirectBack();
        }
    };
    mainForm.add(backButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Form(org.apache.wicket.markup.html.form.Form)

Example 47 with AjaxSubmitButton

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

the class TaskMainPanel method initButtons.

private void initButtons(Form mainForm) {
    WebMarkupContainer buttonPanel = new WebMarkupContainer(ID_BUTTON_PANEL);
    buttonPanel.setOutputMarkupId(true);
    mainForm.add(buttonPanel);
    final TaskButtonsVisibility visibility = new TaskButtonsVisibility();
    AjaxButton backButton = new AjaxButton(ID_BACK, parentPage.createStringResource("pageTaskEdit.button.back")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            parentPage.getController().backPerformed(target);
        }
    };
    backButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visibility.computeBackVisible(parentPage);
        }
    });
    buttonPanel.add(backButton);
    AjaxButton cancelEditingButton = new AjaxButton(ID_CANCEL_EDITING, parentPage.createStringResource("pageTaskEdit.button.cancelEditing")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            parentPage.getController().cancelEditingPerformed(target);
        }
    };
    cancelEditingButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visibility.computeCancelEditVisible(parentPage);
        }
    });
    buttonPanel.add(cancelEditingButton);
    AjaxSubmitButton saveButton = new AjaxSubmitButton(ID_SAVE, parentPage.createStringResource("pageTaskEdit.button.save")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            parentPage.getController().savePerformed(target);
        }

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

        @Override
        public boolean isVisible() {
            return visibility.computeSaveVisible(parentPage);
        }
    });
    mainForm.setDefaultButton(saveButton);
    buttonPanel.add(saveButton);
    AjaxButton editButton = new AjaxButton(ID_EDIT, parentPage.createStringResource("pageTaskEdit.button.edit")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            parentPage.setEdit(true);
            // stops refreshing as well
            parentPage.refresh(target);
            target.add(getMainForm());
        }
    };
    editButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visibility.computeEditVisible(parentPage);
        }
    });
    buttonPanel.add(editButton);
    AjaxButton suspend = new AjaxButton(ID_SUSPEND, parentPage.createStringResource("pageTaskEdit.button.suspend")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            parentPage.getController().suspendPerformed(target);
        }
    };
    suspend.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visibility.computeSuspendVisible(parentPage);
        }
    });
    buttonPanel.add(suspend);
    AjaxButton resume = new AjaxButton(ID_RESUME, parentPage.createStringResource("pageTaskEdit.button.resume")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            parentPage.getController().resumePerformed(target);
        }
    };
    resume.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visibility.computeResumeVisible(parentPage);
        }
    });
    buttonPanel.add(resume);
    AjaxButton runNow = new AjaxButton(ID_RUN_NOW, parentPage.createStringResource("pageTaskEdit.button.runNow")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            parentPage.getController().runNowPerformed(target);
        }
    };
    runNow.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visibility.computeRunNowVisible(parentPage);
        }
    });
    buttonPanel.add(runNow);
    AjaxButton stopApproval = new AjaxButton(ID_STOP_APPROVAL, parentPage.createStringResource("pageTaskEdit.button.stopApprovalProcess")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            parentPage.getController().stopApprovalProcessPerformed(target);
        }
    };
    stopApproval.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visibility.computeStopVisible(parentPage);
        }
    });
    buttonPanel.add(stopApproval);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Form(com.evolveum.midpoint.web.component.form.Form) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 48 with AjaxSubmitButton

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

the class ExportingPanel method initLayout.

private void initLayout() {
    MidpointForm form = new MidpointForm<>(ID_MAIN_FORM, true);
    MessagePanel warningMessage = new MessagePanel(ID_WARNING_MESSAGE, MessagePanel.MessagePanelType.WARN, getWarningMessageModel());
    warningMessage.setOutputMarkupId(true);
    warningMessage.add(new VisibleBehaviour(() -> getWarningMessageModel() != null));
    form.add(warningMessage);
    FeedbackAlerts feedbackList = new FeedbackAlerts(ID_FEEDBACK);
    feedbackList.setOutputMarkupId(true);
    feedbackList.setOutputMarkupPlaceholderTag(true);
    form.add(feedbackList);
    TextPanel<String> nameField = new TextPanel<>(ID_NAME, nameModel);
    form.add(nameField);
    BoxedTablePanel<SelectableBean<Integer>> table = createTable(ID_TABLE, dataTable);
    form.add(table);
    AjaxSubmitButton exportSelected = new AjaxSubmitButton(ID_EXPORT, getPageBase().createStringResource("ExportingPopupPanel.exportSelected")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onSubmit(AjaxRequestTarget target) {
            performSelectedColumns(table);
            if (exportedColumnsIndex.isEmpty()) {
                LOGGER.warn("None columns selected");
                getPageBase().warn(getPageBase().createStringResource("ExportingPanel.message.error.selectColumn").getString());
                target.add(feedbackList);
                return;
            }
            ((PageBase) getPage()).hideMainPopup(target);
            exportPerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    form.add(exportSelected);
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL, new StringResourceModel("Button.cancel", this, null)) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            cancelPerformed(target);
        }
    };
    form.add(cancelButton);
    add(form);
}
Also used : AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) TextPanel(com.evolveum.midpoint.web.component.input.TextPanel) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) FeedbackAlerts(com.evolveum.midpoint.web.component.message.FeedbackAlerts) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) MessagePanel(com.evolveum.midpoint.gui.api.component.result.MessagePanel) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 49 with AjaxSubmitButton

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

the class PageResourceVisualization method initLayout.

private void initLayout() {
    MidpointForm<?> form = new MidpointForm<>(ID_FORM);
    add(form);
    WebMarkupContainer dotContainer = new WebMarkupContainer(ID_DOT_CONTAINER);
    dotContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visualizationModel.getObject().getSvg() == null;
        }
    });
    form.add(dotContainer);
    TextArea<String> dot = new TextArea<>(ID_DOT, new PropertyModel<>(visualizationModel, ResourceVisualizationDto.F_DOT));
    dotContainer.add(dot);
    Label error = new Label(ID_ERROR, new PropertyModel<String>(visualizationModel, ResourceVisualizationDto.F_EXCEPTION_AS_STRING));
    dotContainer.add(error);
    Label svg = new Label(ID_SVG, new PropertyModel<String>(visualizationModel, ResourceVisualizationDto.F_SVG));
    svg.setEscapeModelStrings(false);
    svg.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visualizationModel.getObject().getSvg() != null;
        }
    });
    form.add(svg);
    AjaxSubmitButton back = new AjaxSubmitButton(ID_BACK) {

        @Override
        public void onSubmit(AjaxRequestTarget ajaxRequestTarget) {
            redirectBack();
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getFeedbackPanel());
        }
    };
    form.add(back);
}
Also used : AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) TextArea(org.apache.wicket.markup.html.form.TextArea) Label(org.apache.wicket.markup.html.basic.Label) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 50 with AjaxSubmitButton

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

the class ReportMainPanel method initLayoutSaveAndRunButton.

private void initLayoutSaveAndRunButton(PageAdminObjectDetails<ReportType> parentPage) {
    AjaxSubmitButton saveAndRunButton = new AjaxSubmitButton(ID_SAVE_AND_RUN, parentPage.createStringResource("pageReport.button.saveAndRun")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            ((PageReport) getDetailsPage()).saveAndRunPerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(parentPage.getFeedbackPanel());
        }
    };
    saveAndRunButton.add(getVisibilityForSaveAndRunButton());
    saveAndRunButton.setOutputMarkupId(true);
    saveAndRunButton.setOutputMarkupPlaceholderTag(true);
    getMainForm().add(saveAndRunButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) PageReport(com.evolveum.midpoint.web.page.admin.reports.PageReport)

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