Search in sources :

Example 51 with AjaxSubmitButton

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

the class RunReportPopupPanel method initLayout.

protected void initLayout() {
    Form<?> mainForm = new MidpointForm<>(ID_MAIN_FORM);
    add(mainForm);
    FeedbackAlerts feedback = new FeedbackAlerts(ID_POPUP_FEEDBACK);
    ReportObjectsListPanel table = new ReportObjectsListPanel(ID_TABLE, getModel()) {

        private final boolean checkViewAfterInitialize = true;

        @Override
        public Component getFeedbackPanel() {
            return feedback;
        }

        @Override
        protected boolean checkViewAfterInitialize() {
            if (checkViewAfterInitialize) {
                return true;
            }
            return super.checkViewAfterInitialize();
        }
    };
    table.setOutputMarkupId(true);
    mainForm.add(table);
    feedback.setFilter(new ComponentFeedbackMessageFilter(table) {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean accept(FeedbackMessage message) {
            return true;
        }
    });
    feedback.setOutputMarkupId(true);
    mainForm.add(feedback);
    AjaxSubmitButton runButton = new AjaxSubmitButton(ID_RUN_BUTTON, createStringResource("runReportPopupContent.button.run")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onError(AjaxRequestTarget target) {
            FeedbackAlerts feedback = (FeedbackAlerts) getForm().get(ID_POPUP_FEEDBACK);
            target.add(feedback);
        }

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            runConfirmPerformed(target);
        }
    };
    runButton.setOutputMarkupId(true);
    runButton.add(new VisibleBehaviour(() -> isRunnable));
    mainForm.add(runButton);
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, createStringResource("userBrowserDialog.button.cancelButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            getPageBase().hideMainPopup(target);
        }
    };
    cancelButton.setOutputMarkupId(true);
    mainForm.add(cancelButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ComponentFeedbackMessageFilter(org.apache.wicket.feedback.ComponentFeedbackMessageFilter) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) FeedbackAlerts(com.evolveum.midpoint.web.component.message.FeedbackAlerts) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) FeedbackMessage(org.apache.wicket.feedback.FeedbackMessage)

Example 52 with AjaxSubmitButton

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

the class ImportReportPopupPanel method initLayout.

protected void initLayout() {
    Form<?> mainForm = new MidpointForm<>(ID_MAIN_FORM);
    add(mainForm);
    FeedbackAlerts feedback = new FeedbackAlerts(ID_POPUP_FEEDBACK);
    feedback.setOutputMarkupId(true);
    mainForm.add(feedback);
    Model<String> nameModel = Model.of("");
    TextPanel nameField = new TextPanel(ID_NAME_FOR_DATA, nameModel);
    nameField.setOutputMarkupId(true);
    mainForm.add(nameField);
    Model<String> fileStringModel = Model.of("");
    TextAreaPanel fileStringField = new TextAreaPanel(ID_FILE_AS_NAME, fileStringModel, 5);
    fileStringField.setOutputMarkupId(true);
    mainForm.add(fileStringField);
    AjaxSubmitButton importButton = new AjaxSubmitButton(ID_IMPORT_BUTTON, createStringResource("PageReports.button.import")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            importConfirmPerformed(target, nameModel, fileStringModel);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            FeedbackAlerts feedback = (FeedbackAlerts) getForm().get(ID_POPUP_FEEDBACK);
            target.add(feedback);
        }
    };
    mainForm.add(importButton);
    AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON, createStringResource("userBrowserDialog.button.cancelButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            ImportReportPopupPanel.this.getPageBase().hideMainPopup(target);
        }
    };
    cancelButton.setOutputMarkupId(true);
    mainForm.add(cancelButton);
    FileUploadField choseFile = new FileUploadField(ID_CHOSE_FILE);
    mainForm.add(choseFile);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) FeedbackAlerts(com.evolveum.midpoint.web.component.message.FeedbackAlerts) TextPanel(com.evolveum.midpoint.web.component.input.TextPanel) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) TextAreaPanel(com.evolveum.midpoint.web.component.input.TextAreaPanel) FileUploadField(org.apache.wicket.markup.html.form.upload.FileUploadField)

Example 53 with AjaxSubmitButton

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

the class InternalsTracesPanel method onInitialize.

protected void onInitialize() {
    super.onInitialize();
    setOutputMarkupId(true);
    Form form = new MidpointForm<>(ID_FORM);
    form.setOutputMarkupId(true);
    add(form);
    ListView<InternalOperationClasses> tracesTable = new ListView<InternalOperationClasses>(ID_TRACES_TABLE, Arrays.asList(InternalOperationClasses.values())) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<InternalOperationClasses> item) {
            InternalOperationClasses operationClass = item.getModelObject();
            CheckFormGroup checkFormGroup = new CheckFormGroup(ID_TRACE_TOGGLE, new PropertyModel<>(tracesMap, operationClass.getKey()), createStringResource("InternalOperationClasses." + operationClass.getKey()), LABEL_SIZE, INPUT_SIZE);
            item.add(checkFormGroup);
        }
    };
    form.add(tracesTable);
    AjaxSubmitButton update = new AjaxSubmitButton(ID_UPDATE_TRACES, createStringResource("PageBase.button.update")) {

        private static final long serialVersionUID = 1L;

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

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(getPageBase().getFeedbackPanel());
        }
    };
    form.add(update);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InternalOperationClasses(com.evolveum.midpoint.schema.internals.InternalOperationClasses) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) ListView(org.apache.wicket.markup.html.list.ListView) Form(org.apache.wicket.markup.html.form.Form) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) ListItem(org.apache.wicket.markup.html.list.ListItem) CheckFormGroup(com.evolveum.midpoint.web.component.form.CheckFormGroup)

Example 54 with AjaxSubmitButton

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

the class DefinitionStagesPanel method initLayout.

private void initLayout() {
    List<ITab> tabs = new ArrayList<>();
    createTabs(tabs);
    tabPanel = WebComponentUtil.createTabPanel(ID_TAB_PANEL, parentPage, tabs, null);
    add(tabPanel);
    AjaxSubmitButton addNewStage = new AjaxSubmitButton(ID_ADD_NEW_STAGE, createStringResource("StageDefinitionPanel.addNewStageButton")) {

        @Override
        public void onSubmit(AjaxRequestTarget target) {
            super.onSubmit(target);
            addPerformed(target);
        }
    };
    add(addNewStage);
    // use the same isVisible for all buttons to avoid changing buttons' placement (especially dangerous is "delete stage" one)
    // we also don't use isEnabled as it seems to have no visual effect
    VisibleEnableBehaviour visibleIfMoreTabs = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return getModelObject().size() > 1;
        }
    };
    AjaxSubmitButton moveLeft = new AjaxSubmitButton(ID_MOVE_STAGE_LEFT, createStringResource("StageDefinitionPanel.moveStageLeftButton")) {

        @Override
        public void onSubmit(AjaxRequestTarget target) {
            super.onSubmit(target);
            moveLeftPerformed(target);
        }
    };
    moveLeft.add(visibleIfMoreTabs);
    add(moveLeft);
    AjaxSubmitButton moveRight = new AjaxSubmitButton(ID_MOVE_STAGE_RIGHT, createStringResource("StageDefinitionPanel.moveStageRightButton")) {

        @Override
        public void onSubmit(AjaxRequestTarget target) {
            super.onSubmit(target);
            moveRightPerformed(target);
        }
    };
    moveRight.add(visibleIfMoreTabs);
    add(moveRight);
    AjaxSubmitButton delete = new AjaxSubmitButton(ID_DELETE_STAGE, createStringResource("StageDefinitionPanel.deleteStageButton")) {

        @Override
        public void onSubmit(AjaxRequestTarget target) {
            super.onSubmit(target);
            deletePerformed(target);
        }
    };
    delete.add(visibleIfMoreTabs);
    add(delete);
    setOutputMarkupId(true);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) ArrayList(java.util.ArrayList) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab)

Example 55 with AjaxSubmitButton

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

the class PageCertDefinition method initButtons.

private void initButtons(final Form mainForm) {
    AjaxButton backButton = new AjaxButton(ID_BACK_BUTTON, createStringResource("PageCertDefinition.button.back")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            redirectBack();
        }
    };
    mainForm.add(backButton);
    AjaxSubmitButton saveButton = new AjaxSubmitButton(ID_SAVE_BUTTON, createStringResource("PageCertDefinition.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)

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