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

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


public class Issue3962 extends AbstractIssue {
  private FormPanel form;

  @Override
  public Widget createIssue() {
    form = new FormPanel();
    form.addSubmitHandler(new SubmitHandler() {
      public void onSubmit(SubmitEvent event) {
        Window.alert("Form is being submitted.");
        event.cancel();
      }
View Full Code Here


public class Issue3973 extends AbstractIssue {
  private FormPanel form;

  @Override
  public Widget createIssue() {
    form = new FormPanel("_blank");
    form.setAction("http://www.google.com/search");
    form.addSubmitHandler(new SubmitHandler() {
      public void onSubmit(SubmitEvent event) {
        Window.alert("Did you see me?");
        event.cancel();
View Full Code Here

   public HtmlFormModalDialog(String title,
                              final String progressMessage,
                              String actionURL,
                              final OperationWithInput<T> operation)
   {
      super(new FormPanel());
      setText(title);
     
      final FormPanel formPanel = (FormPanel)getContainerPanel();
      formPanel.getElement().getStyle().setProperty("margin", "0px");
      formPanel.getElement().getStyle().setProperty("padding", "0px");
      formPanel.setAction(actionURL);
      setFormPanelEncodingAndMethod(formPanel);
     
      final ProgressIndicator progressIndicator = addProgressIndicator();
     
      ThemedButton okButton = new ThemedButton("OK", new ClickHandler() {
         public void onClick(ClickEvent event) {
            try
            {
               formPanel.submit();
            }
            catch (final JavaScriptException e)
            {
               Scheduler.get().scheduleDeferred(new ScheduledCommand()
               {
                  public void execute()
                  {
                     if ("Access is denied.".equals(
                           StringUtil.notNull(e.getDescription()).trim()))
                     {
                        progressIndicator.onError(
                              "Please use a complete file path.");
                     }
                     else
                     {
                        Debug.log(e.toString());
                        progressIndicator.onError(e.getDescription());
                     }
                  }
               });
            }
            catch (final Exception e)
            {
               Scheduler.get().scheduleDeferred(new ScheduledCommand()
               {
                  public void execute()
                  {
                     Debug.log(e.toString());
                     progressIndicator.onError(e.getMessage());
                  }
               });
            }
         }   
      });
      addOkButton(okButton);
      addCancelButton();
         
      formPanel.addSubmitHandler(new SubmitHandler() {
         public void onSubmit(SubmitEvent event) {          
            if (validate())
            {
               progressIndicator.onProgress(progressMessage);
            }
            else
            {
               event.cancel();
            }
         }
      });
     
      formPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {
         public void onSubmitComplete(SubmitCompleteEvent event) {
           
            String resultsText = event.getResults();
            if (resultsText != null)
            {
View Full Code Here

   {
      try
      {
         for (int i=0; i<previousUpdateCredentialsForms_.size(); i++)
         {
            FormPanel formPanel = previousUpdateCredentialsForms_.get(i);
            RootPanel.get().remove(formPanel);
         }
        
         previousUpdateCredentialsForms_.clear();
      }
View Full Code Here

      safeCleanupPreviousUpdateCredentials();
       
      // create a hidden form panel to submit the update credentials to
      // (we do this so GWT manages the trickiness associated with
      // managing and reading the contents of a hidden iframe)
      final FormPanel updateCredentialsForm = new FormPanel();
      updateCredentialsForm.setMethod(FormPanel.METHOD_GET);
      updateCredentialsForm.setEncoding(FormPanel.ENCODING_URLENCODED);
     
      // form url
      String url = remoteServer_.getApplicationURL("auth-update-credentials");
      updateCredentialsForm.setAction(url);
     
      // request log entry (fake up a json rpc method call to conform
      // to the data format expected by RequestLog
      String requestId = Integer.toString(Random.nextInt());
      String requestData = createRequestData();
      final RequestLogEntry logEntry = RequestLog.log(requestId, requestData);
     
      // form submit complete handler
      updateCredentialsForm.addSubmitCompleteHandler(new SubmitCompleteHandler(){

         public void onSubmitComplete(SubmitCompleteEvent event)
         {
            // parse the results
            String results = event.getResults();             
            RpcResponse response = RpcResponse.parse(event.getResults());
            if (response != null)
            {
               logEntry.logResponse(ResponseType.Normal, results);
               
               // check for error
               RpcError rpcError = response.getError();
               if (rpcError != null)
               {
                  if (rpcError.getCode() == RpcError.METHOD_NOT_FOUND)
                  {
                     requestCallback.onResponseReceived(
                                 new Integer(CREDENTIALS_UPDATE_UNSUPPORTED));
                  }
                  else
                  {
                     requestCallback.onError(new RemoteServerError(rpcError));
                  }
               }
               else // must be a valid response
               {
                  Bool authenticated = response.getResult();
                  if (authenticated.getValue())
                  {
                     requestCallback.onResponseReceived(
                                 new Integer(CREDENTIALS_UPDATE_SUCCESS));
                  }
                  else
                  {
                     requestCallback.onResponseReceived(
                                 new Integer(CREDENTIALS_UPDATE_FAILURE));
                  }
               }
            }
            else // error parsing results
           
               logEntry.logResponse(ResponseType.Error, results);
              
               // form message
               String msg = "Error parsing results: " +
                            (results != null ? results : "(null)");
              
               // we don't expect this so debug log to flag our attention
               Debug.log("UPDATE CREDENTIALS: " + msg);
              
               // return the error
               RpcError rpcError = RpcError.create(RpcError.PARSE_ERROR, msg);
               requestCallback.onError(new RemoteServerError(rpcError));
            }
           
            // remove the hidden form (from both last-ditch list and DOM)
            previousUpdateCredentialsForms_.remove(updateCredentialsForm);
            Scheduler.get().scheduleDeferred(new ScheduledCommand() {
               public void execute()
               {
                  RootPanel.get().remove(updateCredentialsForm);
               }
            });
         }      
      });
    
      // add the (hidden) form panel to the document and last ditch list
      RootPanel.get().add(updateCredentialsForm, -1000, -1000);
      previousUpdateCredentialsForms_.add(updateCredentialsForm);
     
      // submit the form
      updateCredentialsForm.submit();
   }
View Full Code Here

        h.add( img );
        h.add( new HTML( "&nbsp;" ) );
        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( "&nbsp;" ) );
        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

        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.setName( HTMLFileManagerFields.FILE_UPLOAD_FIELD_NAME_IMPORT );
        upload.setHeight("30px");
        panel.add( upload );

        panel.add(new HTML("&nbsp;&nbsp;&nbsp;"));
       
        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( 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

TOP

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

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.