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

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


  }
  private Command getDownloadCommand() {
    return downLoadCommand = downLoadCommand != null ? downLoadCommand : new Command(){
      @Override
      public void execute() {
        final FormPanel fp = new FormPanel();
        RootPanel.get().add(fp);
        fp.setAction("./vkgwtdesigner/vksync");
        fp.setMethod(FormPanel.METHOD_POST);
        fp.setEncoding(FormPanel.ENCODING_MULTIPART);
        final VerticalPanel dialog = new VerticalPanel();
        fp.setWidget(dialog);
        dialog.add(new Hidden("op", "downLoadLayoutFile"));
        dialog.add(new Hidden("downloadString", VkStateHelper.getInstance().getLoadSaveHelper().getSaveString()));
        fp.submit();
        fp.addSubmitCompleteHandler(new SubmitCompleteHandler() {
          @Override
          public void onSubmitComplete(SubmitCompleteEvent event) {
            new Timer() {
              @Override
              public void run() {
                fp.removeFromParent();
              }}.schedule(5000);
          }
        });
      }
    };
View Full Code Here


  private Command getOpenUsingFileCommand() {
    return openCommand = openCommand != null ? openCommand : new Command(){
      @Override
      public void execute() {
        final DialogBox origDialog = new DialogBox();
        final FormPanel fp = new FormPanel();
        fp.setAction("./vkgwtdesigner/vksync");
        fp.setMethod(FormPanel.METHOD_POST);
        fp.setEncoding(FormPanel.ENCODING_MULTIPART);
        fp.addSubmitCompleteHandler(new SubmitCompleteHandler() {
          @Override
          public void onSubmitComplete(SubmitCompleteEvent event) {
            VkStateHelper.getInstance().getLoadSaveHelper().loadApplication(event.getResults());
            origDialog.hide();
          }
        });
        origDialog.setWidget(fp);
        final VerticalPanel dialog = new VerticalPanel();
        fp.setWidget(dialog);
        origDialog.setText("Upload Layout File");
        dialog.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
        dialog.setWidth("100%");
        DOM.setStyleAttribute(origDialog.getElement(), "zIndex", Integer.toString(Integer.MAX_VALUE));
        FileUpload fu = new FileUpload();
        fu.setName("file");
        dialog.add(fu);
        dialog.add(new Hidden("op", "upLoadLayoutFile"));
        HorizontalPanel buttonsPanel = new HorizontalPanel();
        dialog.add(buttonsPanel);
        Button saveButton = new Button("Submit");
        buttonsPanel.add(saveButton);
        saveButton.addClickHandler(new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            fp.submit();
          }
        });
        Button cancelButton = new Button("Cancel");
        buttonsPanel.add(cancelButton);
        cancelButton.addClickHandler(new ClickHandler() {
View Full Code Here

    attributesList.add(4, UPLOAD_IMAGE);
    return attributesList;
  }
  private void createUploadImageDialog(final VkImage image) {
    final DialogBox origDialog = new DialogBox();
    final FormPanel fp = new FormPanel();
    fp.setAction("./vkgwtdesigner/vksync");
    fp.setMethod(FormPanel.METHOD_POST);
    fp.setEncoding(FormPanel.ENCODING_MULTIPART);
    fp.addSubmitCompleteHandler(new SubmitCompleteHandler() {
      @Override
      public void onSubmitComplete(SubmitCompleteEvent event) {
        String results = event.getResults();
        if(results.equals(SC_LENGTH_REQUIRED))
          Window.alert("File size was greater than 1MB");
        else if (results.equals(SC_BAD_REQUEST)) {
          Window.alert("File Upload failed");
          origDialog.hide();
        } else {
          image.setUrl(results);
          origDialog.hide();
        }
      }
    });
    origDialog.setWidget(fp);
    final VerticalPanel dialog = new VerticalPanel();
    fp.setWidget(dialog);
    origDialog.setText("Upload Image");
    dialog.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
    dialog.setWidth("100%");
    DOM.setStyleAttribute(origDialog.getElement(), "zIndex", Integer.toString(Integer.MAX_VALUE));
    FileUpload fu = new FileUpload();
    fu.setName("file");
    dialog.add(fu);
    dialog.add(new Hidden("op", "imgUpload"));
    HorizontalPanel buttonsPanel = new HorizontalPanel();
    dialog.add(buttonsPanel);
    Button saveButton = new Button("Submit");
    buttonsPanel.add(saveButton);
    saveButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        fp.submit();
      }
    });
    Button cancelButton = new Button("Cancel");
    buttonsPanel.add(cancelButton);
    cancelButton.addClickHandler(new ClickHandler() {
View Full Code Here

    exportPanel.add(instructions);
    return exportPanel;
  }
 
  private Widget createFileUploadForm() {
    fileUploadForm = new FormPanel();
    fileUploadForm.setAction("/import");
    fileUploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    fileUploadForm.setMethod(FormPanel.METHOD_POST);

    VerticalPanel fileUploadPanel = new VerticalPanel();
View Full Code Here

    });
    return fileUploadForm;
  }

  private Widget createProgressForm() {
    progressForm = new FormPanel();
    progressForm.setAction("/import");
    progressForm.setEncoding(FormPanel.ENCODING_URLENCODED);
    progressForm.setMethod(FormPanel.METHOD_POST);

    VerticalPanel progressPanel = new VerticalPanel();
View Full Code Here

        return horiz;
    }

    private Widget newImportWidget() {

        final FormPanel uploadFormPanel = new FormPanel();
        uploadFormPanel.setAction( GWT.getModuleBaseURL() + "backup" );
        uploadFormPanel.setEncoding( FormPanel.ENCODING_MULTIPART );
        uploadFormPanel.setMethod( FormPanel.METHOD_POST );

        HorizontalPanel panel = new HorizontalPanel();
        uploadFormPanel.setWidget( panel );

        final FileUpload upload = new FileUpload();
        upload.setHeight("30px");
        upload.setName( HTMLFileManagerFields.FILE_UPLOAD_FIELD_NAME_IMPORT );
        panel.add( upload );

        Button ok = new Button( constants.Import() );
        ok.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent sender) {
                doImportFile( uploadFormPanel );
            }

            private void doImportFile(final FormPanel uploadFormPanel) {
                if ( Window.confirm( constants.ImportConfirm() ) ) {
                    LoadingPopup.showMessage( constants.ImportingInProgress() );
                    uploadFormPanel.submit();
                }
            }
        } );

        panel.add(new HTML("   "));

        panel.add( ok );

        uploadFormPanel.addSubmitCompleteHandler( new SubmitCompleteHandler() {

            public void onSubmitComplete(SubmitCompleteEvent event) {
                if ( event.getResults().indexOf( "OK" ) > -1 ) {
                    Window.alert( constants.ImportDone() );
                    History.newItem( " " );
                    Window.Location.reload();
                } else {
                    ErrorPopup.showMessage( constants.ImportFailed() );
                }
                LoadingPopup.close();
            }
        } );

        uploadFormPanel.addSubmitHandler( new SubmitHandler() {

            public void onSubmit(SubmitEvent event) {
                String fileName = upload.getFilename();
                if ( fileName.length() == 0 ) {
                    Window.alert( constants.NoExportFilename() );
View Full Code Here

        h.add( img );
        h.add( new HTML( " " ) );
        h.add( new Label( name ) );
        if ( edit != null ) h.add( edit );

        FormPanel f = newForm( null );

        f.add( h );
        layout.add( f );
    }
View Full Code Here

                          Widget content) {
        HorizontalPanel h = new HorizontalPanel();
        h.add( img );
        h.add( new HTML( " " ) );
        h.add( content );
        FormPanel f = newForm( null );
        f.add( h );
        layout.add( f );
    }
View Full Code Here

        f.add( h );
        layout.add( f );
    }

    private FormPanel newForm(final String hdr) {
        FormPanel fp = new FormPanel();
        fp.setWidth( "100%" );
        fp.addStyleName( "guvnor-FormPanel" );
        if ( hdr != null ) {
            fp.setTitle( hdr );
        }
        return fp;
    }
View Full Code Here

        return fp;
    }

    public void endSection() {

        FormPanel f = newForm( this.sectionName );

        f.add( this.currentTable );

        this.layout.add( f );
        this.sectionName = null;
    }
View Full Code Here

TOP

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

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.