Examples of AjaxSubmitLink


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

                .getFormComponent(), dataStoreNamePanel.getFormComponent(), dataStoreInfoId);
        paramsForm.add(storeNameValidator);

        paramsForm.add(new BookmarkablePageLink("cancel", StorePage.class));

        paramsForm.add(new AjaxSubmitLink("save", paramsForm) {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onError(AjaxRequestTarget target, Form form) {
                super.onError(target, form);
View Full Code Here

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

       
        form.setDefaultButton(submitLink);
    }

    private Component chooserButton(Form form) {
        AjaxSubmitLink link =  new AjaxSubmitLink("chooser") {
            @Override
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                dialog.setTitle(new ParamResourceModel("chooseDirectory", this));
                dialog.showOkCancel(target, new GeoServerDialog.DialogDelegate() {

                    @Override
                    protected Component getContents(String id) {
                        // use what the user currently typed
                      File file = null;
                      if(!dirField.getInput().trim().equals("")) {
                        file = new File(dirField.getInput());
                        if(!file.exists())
                            file = null;
                      }
                       
                        GeoServerFileChooser chooser = new GeoServerFileChooser(id, new Model(file));
                        chooser.setFilter(new Model(new ExtensionFileFilter(".shp")));
                        return chooser;
                    }

                    @Override
                    protected boolean onSubmit(AjaxRequestTarget target, Component contents) {
                        GeoServerFileChooser chooser = (GeoServerFileChooser) contents;
                        directory = ((File) chooser.getModelObject()).getAbsolutePath();
                        // clear the raw input of the field won't show the new model value
                        dirField.clearInput();
                        target.addComponent(dirField);
                        return true;
                    }
                   
                    @Override
                    public void onClose(AjaxRequestTarget target) {
                        // update the field with the user chosen value
                        target.addComponent(dirField);
                    }
                   
                });
               
            }
           
        };
        // otherwise the link won't trigger when the form contents are not valid
        link.setDefaultFormProcessing(false);
        return link;
    }
View Full Code Here

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

            ResourceModel titleModel = new ResourceModel(titleKey);
            String title = String.valueOf(titleModel.getObject());
            choice.add(new SimpleAttributeModifier("title", title));
        }

        final AjaxSubmitLink refreshTablesLink = new AjaxSubmitLink("refresh", storeEditForm) {
            private static final long serialVersionUID = 1L;

            /**
             * We're not doing any validation here, just want to perform the same attempt to get to
             * the list of connection parameters than at {@link #onSumbit}
             */
            @Override
            protected void onError(AjaxRequestTarget target, Form form) {
                onSubmit(target, form);
            }

            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form form) {

                final String server = serverComponent.getValue();
                final String port = portComponent.getValue();
                final String instance = instanceComponent.getValue();
                final String user = userComponent.getValue();
                final String password = passwordComponent.getValue();

                final ISessionPoolFactory sessionFac = getSessionFactory();

                List<String> rasterColumns;
                try {
                    rasterColumns = getRasterColumns(server, port, instance, user, password,
                            sessionFac);
                } catch (IllegalArgumentException e) {
                    rasterColumns = Collections.emptyList();
                    String message = "Refreshing raster tables list: " + e.getMessage();
                    storeEditForm.error(message);
                    target.addComponent(storeEditForm);// refresh
                }

                choice.setChoices(rasterColumns);
                target.addComponent(choice);
                // do nothing else, so we return to the same page...
            }
        };
        add(refreshTablesLink);
        {
            final String titleKey = RESOURCE_KEY_PREFIX + ".refresh.title";
            ResourceModel titleModel = new ResourceModel(titleKey);
            String title = String.valueOf(titleModel.getObject());
            refreshTablesLink.add(new SimpleAttributeModifier("title", title));
        }
    }
View Full Code Here

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

            public Page createPage() {
                return new DemoRequestResponse(requestModel);
            }
        });

        demoRequestsForm.add(new AjaxSubmitLink("submit", demoRequestsForm) {
            @Override
            public void onSubmit(AjaxRequestTarget target, Form testWfsPostForm) {
                responseWindow.show(target);
            }
View Full Code Here

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

        );
        width.add(NumberValidator.minimum(0));
        width.setOutputMarkupId(true);
        add(width);

        add(new AjaxSubmitLink("verifyImage") {
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                if (logo.getModelObjectAsString() != null) {
                    try {
                        URL url = new URL(logo.getModelObjectAsString());
                        URLConnection conn = url.openConnection();
View Full Code Here

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

       
        return parser.getValidationErrors();
    }

    AjaxSubmitLink copyLink() {
        return new AjaxSubmitLink("copy") {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                // we need to force validation or the value won't be converted
                styles.processInput();
View Full Code Here

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

     * Submit link that will forward to the {@link DialogDelegate}
     *
     * @return
     */
    AjaxSubmitLink sumbitLink(Component contents) {
        AjaxSubmitLink link = new AjaxSubmitLink("submit") {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                if (delegate.onSubmit(target, (Component) this.getModelObject())) {
                    window.close(target);
                    delegate = null;
                }
            }
           
            @Override
            protected void onError(AjaxRequestTarget target, Form form) {
                delegate.onError(target, form);
            }

        };
        link.setModel(new Model(contents));
        return link;
    }
View Full Code Here

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

        public ContentsPage(Component contents) {
            Form form = new Form("form");
            add(form);
            form.add(contents);
            AjaxSubmitLink submit = sumbitLink(contents);
            form.add(submit);
            form.add(cancelLink());
            form.setDefaultButton(submit);
        }
View Full Code Here

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

  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndContainedLink page = new MockPageWithFormAndContainedLink(mockPojo);
    page.addLink(new AjaxSubmitLink("link")
    {
      private static final long serialVersionUID = 1L;

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

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

  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndLink page = new MockPageWithFormAndLink(mockPojo);
    AjaxSubmitLink link = new AjaxSubmitLink("link", page.getForm())
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
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.