Examples of AjaxButton


Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

            repoFrom.add(new Label("repoUrl", "Repository URL"));
            repoFrom.add(new TextField("repoNameText", new PropertyModel(this,
                    "repoName")).setRequired(true));
            repoFrom.add(new TextField("repoUrlText", new PropertyModel(this,
                    "repoUrl")).setRequired(true));
            repoFrom.add(new AjaxButton("save", repoFrom)
            {

                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?> form)
                {
View Full Code Here

Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

    // event and throttle it down to once per second

    AjaxFormValidatingBehavior.addToAllFormComponents(form, "keydown", Duration.ONE_SECOND);

    // add a button that can be used to submit the form via ajax
    form.add(new AjaxButton("ajax-button", form)
    {
      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        // repaint the feedback panel so that it is hidden
View Full Code Here

Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

    form.add(new TextField("text", new PropertyModel(this, "text")));

    form.add(new Button("button"));

    form.add(new AjaxButton("ajaxButton")
    {
      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        MockFormSubmitsPage.this.onAjaxButtonSubmit(target, form);
View Full Code Here

Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

                target.add(recipients);
                target.add(recipientsContainer);
            }
        });

        AjaxButton submit = new IndicatingAjaxButton("apply", new Model<String>(getString("submit"))) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                notificationTO.setAbout(about.buildSearchCond());
                notificationTO.setRecipients(checkRecipients.getModelObject() ? recipients.buildSearchCond() : null);

                try {
                    if (createFlag) {
                        restClient.createNotification(notificationTO);
                    } else {
                        restClient.updateNotification(notificationTO);
                    }
                    info(getString("operation_succeeded"));

                    Configuration callerPage = (Configuration) pageRef.getPage();
                    callerPage.setModalResult(true);

                    window.close(target);
                } catch (SyncopeClientCompositeErrorException scee) {
                    error(getString("error") + ":" + scee.getMessage());
                    target.add(feedbackPanel);
                }
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {

                target.add(feedbackPanel);
            }
        };

        final AjaxButton cancel = new IndicatingAjaxButton("cancel", new ResourceModel("cancel")) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                window.close(target);
            }
        };

        cancel.setDefaultFormProcessing(false);

        String allowedRoles = createFlag
                ? xmlRolesReader.getAllAllowedRoles("Notification", "create")
                : xmlRolesReader.getAllAllowedRoles("Notification", "update");
        MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, allowedRoles);
View Full Code Here

Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

        // Roles panel
        //--------------------------------
        form.add(new MembershipsPanel("memberships", userTO, mode == Mode.TEMPLATE, null, getPageReference()));
        //--------------------------------

        final AjaxButton submit = getOnSubmit();

        if (mode == Mode.ADMIN) {
            String allowedRoles = userTO.getId() == 0
                    ? xmlRolesReader.getAllAllowedRoles("Users", "create")
                    : xmlRolesReader.getAllAllowedRoles("Users", "update");
            MetaDataRoleAuthorizationStrategy.authorize(submit, RENDER, allowedRoles);
        }

        fragment.add(form);
        form.add(submit);
        form.setDefaultButton(submit);

        final AjaxButton cancel = new AjaxButton("cancel", new ResourceModel("cancel")) {

            private static final long serialVersionUID = 530608535790823587L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                window.close(target);
            }

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

        cancel.setDefaultFormProcessing(false);
        form.add(cancel);

        return form;
    }
View Full Code Here

Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

        // Resource security panel
        //--------------------------------
        form.add(new ResourceSecurityPanel("security", resourceTO));
        //--------------------------------

        final AjaxButton submit = new IndicatingAjaxButton("apply", new ResourceModel("submit", "submit")) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                final ResourceTO resourceTO = (ResourceTO) form.getDefaultModelObject();

                boolean accountIdError = false;

                if (resourceTO.getUmapping() == null || resourceTO.getUmapping().getItems().isEmpty()) {
                    resourceTO.setUmapping(null);
                } else {
                    int uAccountIdCount = 0;
                    for (MappingItemTO item : resourceTO.getUmapping().getItems()) {
                        if (item.isAccountid()) {
                            uAccountIdCount++;
                        }
                    }
                    accountIdError = uAccountIdCount != 1;
                }

                if (resourceTO.getRmapping() == null || resourceTO.getRmapping().getItems().isEmpty()) {
                    resourceTO.setRmapping(null);
                } else {
                    int rAccountIdCount = 0;
                    for (MappingItemTO item : resourceTO.getRmapping().getItems()) {
                        if (item.isAccountid()) {
                            rAccountIdCount++;
                        }
                    }
                    accountIdError |= rAccountIdCount != 1;
                }

                if (accountIdError) {
                    error(getString("accountIdValidation"));
                    target.add(feedbackPanel);
                } else {
                    try {
                        if (createFlag) {
                            restClient.create(resourceTO);
                        } else {
                            restClient.update(resourceTO);
                        }

                        ((Resources) pageRef.getPage()).setModalResult(true);
                        window.close(target);
                    } catch (Exception e) {
                        LOG.error("Failure managing resource {}", resourceTO, e);
                        error(getString("error") + ": " + e.getMessage());
                        target.add(feedbackPanel);
                    }
                }
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
                target.add(feedbackPanel);
            }
        };

        form.add(submit);
        form.setDefaultButton(submit);

        final AjaxButton cancel = new IndicatingAjaxButton("cancel", new ResourceModel("cancel")) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                window.close(target);
            }

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

        cancel.setDefaultFormProcessing(false);
        form.add(cancel);

        add(form);

        MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, xmlRolesReader.getAllAllowedRoles("Resources",
View Full Code Here

Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

            }
        }


        private void addButtons() {
            AjaxButton okButton = new AjaxButton(ID_OK_BUTTON) {
                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(AjaxRequestTarget target, Form<?> form) {
                    boolean succeeded = actionExecutor.executeActionAndProcessResults(target, form);
                    if(succeeded) {
                        // the Wicket ajax callbacks will have just started to hide the veil
                        // we now show it once more, so that a veil continues to be shown until the
                        // new page is rendered.
                        target.appendJavaScript("isisShowVeil();\n");
                    } else {
                        if (actionPromptIfAny != null) {
                           
                            final StringBuilder builder = new StringBuilder();

                            // ensure any jGrowl errors are shown
                            // (normally would be flushed when traverse to next page).
                            String errorMessagesIfAny = JGrowlUtil.asJGrowlCalls(IsisContext.getMessageBroker());
                            builder.append(errorMessagesIfAny);
                           
                            // resize, to show any feedback messages.
                            builder.append("Wicket.Window.get().autoSizeWindow();\n");

                            // append the JS to the response.
                            String buf = builder.toString();
                            target.appendJavaScript(buf);
                            target.add(form);
                        }
                    }
                };

                /**
                 * On validation error
                 */
                @Override
                protected void onError(AjaxRequestTarget target, Form<?> form) {
                    super.onError(target, form);
                    if(actionPromptIfAny != null) {
                        // resize, to show any feedback messages.
                        target.appendJavaScript("Wicket.Window.get().autoSizeWindow();");
                    }
                    target.add(form);
                }
            };
            okButton.add(new JGrowlBehaviour());
            add(okButton);
           
            AjaxButton cancelButton = new AjaxButton(ID_CANCEL_BUTTON) {
                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit(final AjaxRequestTarget target, Form<?> form) {
                    if(actionPromptIfAny != null) {
                        actionPromptIfAny.close(target);
                    }
                };
            };
            // so can submit with invalid content (eg mandatory params missing)
            cancelButton.setDefaultFormProcessing(false);
            add(cancelButton);
           
            // TODO: hide cancel button if dialogs disabled, as not yet implemented.
            if(ActionPromptModalWindow.isActionPromptModalDialogDisabled()) {
                cancelButton.setVisible(false);
            }
        }
View Full Code Here

Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

        final WebMarkupContainer attributesContainer = new WebMarkupContainer("derAttrContainer");

        attributesContainer.setOutputMarkupId(true);
        add(attributesContainer);

        AjaxButton addAttributeBtn = new IndicatingAjaxButton("addAttributeBtn", new ResourceModel("addAttributeBtn")) {

            private static final long serialVersionUID = -4804368561204623354L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                entityTO.getDerivedAttributes().add(new AttributeTO());
                target.add(attributesContainer);
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
                target.add(attributesContainer);
            }
        };

        add(addAttributeBtn.setDefaultFormProcessing(Boolean.FALSE));

        final ListView<AttributeTO> attributes = new ListView<AttributeTO>("attributes",
                new PropertyModel<List<? extends AttributeTO>>(entityTO, "derivedAttributes")) {

            private static final long serialVersionUID = 9101744072914090143L;
View Full Code Here

Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

        });
        form.add(reportletClass);

        propertiesContainer.add(buildPropView());

        final AjaxButton submit = new AjaxButton("apply", new ResourceModel("apply")) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                final BeanWrapper wrapper = PropertyAccessorFactory
                        .forBeanPropertyAccess(ReportletConfModalPage.this.reportletConf);
                wrapper.setPropertyValue("name", name.getField().getInput());

                // Iterate over properties in order to find UserSearchPanel instances and manually update
                // this.reportletConf with select search criteria - this is needed because UserSearchPanel
                // does not comply with usual Wicket model paradigm.
                for (Iterator<Component> itor = ReportletConfModalPage.this.propView.visitChildren(); itor.hasNext();) {
                    Component component = itor.next();
                    if (component instanceof UserSearchPanel) {
                        // using component.getDefaultModelObjectAsString() to fetch field name (set above)
                        wrapper.setPropertyValue(component.getDefaultModelObjectAsString(),
                                ((UserSearchPanel) component).buildSearchCond());
                    }
                }

                ((ReportModalPage) pageRef.getPage())
                        .setModalReportletConf(ReportletConfModalPage.this.reportletConf);
                window.close(target);
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
                target.add(feedbackPanel);
            }
        };
        form.add(submit);

        final AjaxButton cancel = new ClearIndicatingAjaxButton("cancel", new ResourceModel("cancel"), pageRef) {

            private static final long serialVersionUID = -958724007591692537L;

            @Override
            protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
                window.close(target);
            }
        };

        cancel.setDefaultFormProcessing(false);
        form.add(cancel);
    }
View Full Code Here

Examples of org.apache.wicket.ajax.markup.html.form.AjaxButton

        form.get("cancel").setVisible(false);
    }

    @Override
    protected AjaxButton getOnSubmit() {
        AjaxButton submit = super.getOnSubmit();
        submit.setVisible(false);
        return submit;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.