Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.FormPanel


        initAssetHandlers();
    }

    protected void initWidgets(final String uuid,
                               String formName) {
        form = new FormPanel();
        form.setAction( GWT.getModuleBaseURL() + "asset" );
        form.setEncoding( FormPanel.ENCODING_MULTIPART );
        form.setMethod( FormPanel.METHOD_POST );

        FileUpload up = new FileUpload();
View Full Code Here


        panel.add(mergeTranslation);

        // Because we're going to add a FileUpload widget, we'll need to set
        // the
        // form to use the POST method, and multipart MIME encoding.
        form = new FormPanel();
        form.setStyleName("new-zanata");
        form.setEncoding(FormPanel.ENCODING_MULTIPART);
        form.setMethod(FormPanel.METHOD_POST);
        form.setWidget(panel);
View Full Code Here

        VerticalPanel layout = new VerticalPanel();
        layout.setStyleName("window-content");


        // Create a FormPanel and point it at a service.
        final FormPanel form = new FormPanel();
        String url = Console.getBootstrapContext().getProperty(BootstrapContext.DEPLOYMENT_API);
        form.setAction(url);

        form.setEncoding(FormPanel.ENCODING_MULTIPART);
        form.setMethod(FormPanel.METHOD_POST);

        // Create a panel to hold all of the form widgets.
        VerticalPanel panel = new VerticalPanel();
        panel.getElement().setAttribute("style", "width:100%");
        form.setWidget(panel);

        // Create a FileUpload widget.
        final FileUpload upload = new FileUpload();
        upload.setName("uploadFormElement");
        panel.add(upload);


        final HTML errorMessages = new HTML("Please chose a file!");
        errorMessages.setStyleName("error-panel");
        errorMessages.setVisible(false);
        panel.add(errorMessages);

        // Add a 'submit' button.


        ClickHandler cancelHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                window.hide();
            }
        };

        ClickHandler submitHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                errorMessages.setVisible(false);

                // verify form
                String filename = upload.getFilename();

                if(tabs.getTabBar().getSelectedTab()==1)
                {
                    // unmanaged content
                    if(unmanagedForm.validate().hasErrors())
                    {
                        return;
                    }
                    else
                    {
                        wizard.onCreateUnmanaged(unmanagedForm.getUpdatedEntity());
                    }
                }
                else if(filename!=null && !filename.equals(""))
                {
                    loading = Feedback.loading(
                            Console.CONSTANTS.common_label_plaseWait(),
                            Console.CONSTANTS.common_label_requestProcessed(),
                            new Feedback.LoadingCallback() {
                                @Override
                                public void onCancel() {

                                }
                            });
                    form.submit();
                }
                else
                {
                    errorMessages.setVisible(true);
                }
            }
        };

        DialogueOptions options = new DialogueOptions(
                Console.CONSTANTS.common_label_next(), submitHandler,
                Console.CONSTANTS.common_label_cancel(), cancelHandler);

        // Add an event handler to the form.
        form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
            @Override
            public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {

                getLoading().hide();
View Full Code Here

    {
        VerticalPanel layout = new VerticalPanel();
        layout.setStyleName("window-content");

        // Create a FormPanel and point it at a service.
        final FormPanel form = new FormPanel();
        String url = Console.getBootstrapContext().getProperty(BootstrapContext.DEPLOYMENT_API);
        form.setAction(url);

        form.setEncoding(FormPanel.ENCODING_MULTIPART);
        form.setMethod(FormPanel.METHOD_POST);

        // Create a panel to hold all of the form widgets.
        VerticalPanel panel = new VerticalPanel();
        panel.getElement().setAttribute("style", "width:100%");
        form.setWidget(panel);

        // Create a FileUpload widget.
        final FileUpload upload = new FileUpload();
        upload.setName("uploadFormElement");
        panel.add(upload);


        final HTML errorMessages = new HTML("Please chose a file!");
        errorMessages.setStyleName("error-panel");
        errorMessages.setVisible(false);
        panel.add(errorMessages);

        // Add a 'submit' button.


        ClickHandler cancelHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                window.hide();
            }
        };

        ClickHandler submitHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                errorMessages.setVisible(false);

                // verify form
                String filename = upload.getFilename();
                if(filename!=null && !filename.equals(""))
                {
                    loading = Feedback.loading(
                            Console.CONSTANTS.common_label_plaseWait(),
                            Console.CONSTANTS.common_label_requestProcessed(),
                            new Feedback.LoadingCallback() {
                                @Override
                                public void onCancel() {

                                }
                            });
                    form.submit();
                }
                else
                {
                    errorMessages.setVisible(true);
                }
            }
        };

        DialogueOptions options = new DialogueOptions(
                Console.CONSTANTS.common_label_next(), submitHandler,
                Console.CONSTANTS.common_label_cancel(), cancelHandler);

        // Add an event handler to the form.
        form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
            @Override
            public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {

                getLoading().hide();
View Full Code Here

      }
   }

   @Before
   public void beforeFormPanel() {
      form = new FormPanel();
      assertFalse(form.isAttached());
      RootPanel.get().add(form);
      assertTrue(form.isAttached());
   }
View Full Code Here

   @Test()
   public void submit() {
      // Arrange
      final StringBuilder sb = new StringBuilder();
      FormPanel form = new FormPanel();
      form.addSubmitHandler(new SubmitHandler() {

         public void onSubmit(SubmitEvent event) {
            sb.append("onSubmit");
         }
      });
      form.addSubmitCompleteHandler(new SubmitCompleteHandler() {

         public void onSubmitComplete(SubmitCompleteEvent event) {
            sb.append(" complete : ").append(event.getResults());
         }
      });
View Full Code Here

   @Test(expected = AssertionError.class)
   public void submitThrowsErrorIfNotAttached() {
      // Arrange
      final StringBuilder sb = new StringBuilder();
      FormPanel form = new FormPanel();
      form.addSubmitHandler(new SubmitHandler() {

         public void onSubmit(SubmitEvent event) {
            sb.append("onSubmit");
         }
      });
      form.addSubmitCompleteHandler(new SubmitCompleteHandler() {

         public void onSubmitComplete(SubmitCompleteEvent event) {
            sb.append(" complete : ").append(event.getResults());
         }
      });
View Full Code Here

    {
        VerticalPanel layout = new VerticalPanel();
        layout.getElement().setAttribute("style", "width:95%; margin:15px;");

        // Create a FormPanel and point it at a service.
        final FormPanel form = new FormPanel();
        String url = Console.MODULES.getBootstrapContext().getProperty(BootstrapContext.DEPLOYMENT_API);
        form.setAction(url);

        form.setEncoding(FormPanel.ENCODING_MULTIPART);
        form.setMethod(FormPanel.METHOD_POST);

        // Create a panel to hold all of the form widgets.
        VerticalPanel panel = new VerticalPanel();
        panel.getElement().setAttribute("style", "width:100%");
        form.setWidget(panel);

        // Create a FileUpload widget.
        final FileUpload upload = new FileUpload();
        upload.setName("uploadFormElement");
        panel.add(upload);

        // Add a 'submit' button.


        ClickHandler cancelHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                window.hide();
            }
        };
        ClickHandler submitHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                form.submit();
            }
        };

        DialogueOptions options = new DialogueOptions(
                "Next ››", submitHandler,
                "Cancel", cancelHandler);

        // Add an event handler to the form.
        form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
            @Override
            public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
                String html = event.getResults();

                // Step 1: upload content, retrieve hash value
View Full Code Here

 
  @Inject
  public MainView(final Binder binder) {
    widget = binder.createAndBindUi(this);
    HTMLPanel p = new HTMLPanel("");
    FormPanel fp = new FormPanel();
    FileUpload fu = new FileUpload();
    Button b = new Button();
    b.setText("Upload a Paper");
    p.add(fu);
    p.add(b);
    fp.add(p);
    rwSidebar.add(fp);
  }
View Full Code Here

    {
        VerticalPanel layout = new VerticalPanel();
        layout.getElement().setAttribute("style", "width:95%; margin:15px;");

        // Create a FormPanel and point it at a service.
        final FormPanel form = new FormPanel();
        String url = Console.getBootstrapContext().getProperty(BootstrapContext.DEPLOYMENT_API);
        form.setAction(url);

        form.setEncoding(FormPanel.ENCODING_MULTIPART);
        form.setMethod(FormPanel.METHOD_POST);

        // Create a panel to hold all of the form widgets.
        VerticalPanel panel = new VerticalPanel();
        panel.getElement().setAttribute("style", "width:100%");
        form.setWidget(panel);

        // Create a FileUpload widget.
        final FileUpload upload = new FileUpload();
        upload.setName("uploadFormElement");
        panel.add(upload);

        // Add a 'submit' button.


        ClickHandler cancelHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                window.hide();
            }
        };

        ClickHandler submitHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                loading = Feedback.loading(
                        Console.CONSTANTS.common_label_plaseWait(),
                        Console.CONSTANTS.common_label_requestProcessed(),
                        new Feedback.LoadingCallback() {
                            @Override
                            public void onCancel() {

                            }
                        });
                form.submit();
            }
        };

        DialogueOptions options = new DialogueOptions(
                Console.CONSTANTS.common_label_next(), submitHandler,
                Console.CONSTANTS.common_label_cancel(), cancelHandler);

        // Add an event handler to the form.
        form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
            @Override
            public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {

                getLoading().hide();
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.FormPanel

Copyright © 2018 www.massapicom. 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.