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

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


        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("   "));
       
        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


        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

    final FileUpload fileUpload = new FileUpload();

    @Override
    public void create(final PTInstruction create, final UIService uiService) {
        wrappedFormPanel = new FormPanel();
        init(create, uiService, wrappedFormPanel);

        wrappedFormPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
        wrappedFormPanel.setMethod(FormPanel.METHOD_POST);
        final VerticalPanel panel = new VerticalPanel();
View Full Code Here

    public AssetAttachmentFileWidget() {
    }

    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

    }

    public static Widget newImportWidget(final Command afterCreatedEvent,
                                         final FormStylePopup parent) {

        final FormPanel uploadFormPanel = new FormPanel();
        uploadFormPanel.setAction( GWT.getModuleBaseURL() + "package" );
        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.CLASSIC_DRL_IMPORT );
        panel.add( upload );

        panel.add( new Label( constants.upload() ) );
        ImageButton ok = new ImageButton( "images/upload.gif",
                                          constants.Import() ); //NON-NLS
        ClickListener okClickListener = new ClickListener() {
            public void onClick(Widget sender) {
                if ( Window.confirm( constants.ImportMergeWarning() ) ) {
                    LoadingPopup.showMessage( constants.ImportingDRLPleaseWait() );
                    uploadFormPanel.submit();
                }
            }

        };
        ok.addClickListener( okClickListener );

        panel.add( ok );

        final FormStylePopup packageNamePopup = new FormStylePopup( "images/package_large.png",
                                                                    constants.PackageName() );
        HorizontalPanel packageNamePanel = new HorizontalPanel();
        packageNamePopup.addRow( new Label( constants.ImportedDRLContainsNoNameForThePackage() ) );

        final TextBox packageName = new TextBox();
        packageNamePanel.add( new Label( constants.PackageName() + ":" ) );
        packageNamePanel.add( packageName );
        Button uploadWithNameButton = new Button( constants.OK() );
        uploadWithNameButton.addClickListener( okClickListener );
        packageNamePanel.add( uploadWithNameButton );
        packageNamePopup.addRow( packageNamePanel );

        uploadFormPanel.addFormHandler( new FormHandler() {
            public void onSubmitComplete(FormSubmitCompleteEvent event) {
                if ( event.getResults().indexOf( "OK" ) > -1 ) { //NON-NLS
                    Window.alert( constants.PackageWasImportedSuccessfully() );
                    afterCreatedEvent.execute();
                    parent.hide();
                    if ( packageNamePopup != null ) {
                        packageNamePopup.hide();
                    }
                } else if ( event.getResults().indexOf( "Missing package name." ) > -1 ) {
                    LoadingPopup.close();
                    packageNamePopup.show();
                } else {
                    ErrorPopup.showMessage( Format.format( constants.UnableToImportIntoThePackage0(),
                                                           event.getResults() ) );
                }
                LoadingPopup.close();
            }

            public void onSubmit(FormSubmitEvent event) {
                if ( upload.getFilename().length() == 0 ) {
                    Window.alert( constants.YouDidNotChooseADrlFileToImport() );
                    event.setCancelled( true );
                } else if ( !upload.getFilename().endsWith( ".drl" ) ) { //NON-NLS
                    Window.alert( constants.YouCanOnlyImportDrlFiles() );
                    event.setCancelled( true );
                } else if ( packageName.getText() != null && !packageName.getText().equals( "" ) ) {
                    uploadFormPanel.setAction( uploadFormPanel.getAction() + "?packageName=" + packageName.getText() );
                }

            }
        } );
View Full Code Here

    }

    public static Widget newImportWidget(final Command afterCreatedEvent,
                                         final FormStylePopup parent) {

        final FormPanel uploadFormPanel = new FormPanel();
        uploadFormPanel.setAction( GWT.getModuleBaseURL() + "package" );
        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.CLASSIC_DRL_IMPORT );
        panel.add( upload );

        panel.add( new Label( constants.upload() ) );
        ImageButton ok = new ImageButton( "images/upload.gif",
                                          constants.Import() ); //NON-NLS
        ClickListener okClickListener = new ClickListener() {
            public void onClick(Widget sender) {
                if ( Window.confirm( constants.ImportMergeWarning() ) ) {
                    LoadingPopup.showMessage( constants.ImportingDRLPleaseWait() );
                    uploadFormPanel.submit();
                }
            }

        };
        ok.addClickListener( okClickListener );

        panel.add( ok );

        final FormStylePopup packageNamePopup = new FormStylePopup( "images/package_large.png",
                                                                    constants.PackageName() );
        HorizontalPanel packageNamePanel = new HorizontalPanel();
        packageNamePopup.addRow( new Label( constants.ImportedDRLContainsNoNameForThePackage() ) );

        final TextBox packageName = new TextBox();
        packageNamePanel.add( new Label( constants.PackageName() + ":" ) );
        packageNamePanel.add( packageName );
        Button uploadWithNameButton = new Button( constants.OK() );
        uploadWithNameButton.addClickListener( okClickListener );
        packageNamePanel.add( uploadWithNameButton );
        packageNamePopup.addRow( packageNamePanel );

        uploadFormPanel.addFormHandler( new FormHandler() {
            public void onSubmitComplete(FormSubmitCompleteEvent event) {
                if ( event.getResults().indexOf( "OK" ) > -1 ) { //NON-NLS
                    Window.alert( constants.PackageWasImportedSuccessfully() );
                    afterCreatedEvent.execute();
                    parent.hide();
                    if ( packageNamePopup != null ) {
                        packageNamePopup.hide();
                    }
                } else if ( event.getResults().indexOf( "Missing package name." ) > -1 ) {
                    LoadingPopup.close();
                    packageNamePopup.show();
                } else {
                    ErrorPopup.showMessage( Format.format( constants.UnableToImportIntoThePackage0(),
                                                           event.getResults() ) );
                }
                LoadingPopup.close();
            }

            public void onSubmit(FormSubmitEvent event) {
                if ( upload.getFilename().length() == 0 ) {
                    Window.alert( constants.YouDidNotChooseADrlFileToImport() );
                    event.setCancelled( true );
                } else if ( !upload.getFilename().endsWith( ".drl" ) ) { //NON-NLS
                    Window.alert( constants.YouCanOnlyImportDrlFiles() );
                    event.setCancelled( true );
                } else if ( packageName.getText() != null && !packageName.getText().equals( "" ) ) {
                    uploadFormPanel.setAction( uploadFormPanel.getAction() + "?packageName=" + packageName.getText() );
                }

            }
        } );
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 );
        panel.add( upload );

        //panel.add( new Label( "import:" ) );
        Button ok = new Button(constants.Import());
        ok.addClickListener( new ClickListener() {
            public void onClick(Widget sender) {
                doImportFile( uploadFormPanel );
            }

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

        panel.add( ok );

        uploadFormPanel.addFormHandler( new FormHandler() {
            public void onSubmitComplete(FormSubmitCompleteEvent event) {
                if ( event.getResults().indexOf( "OK" ) > -1 ) {
                    Window.alert(constants.ImportDone());
                    History.newItem(" ");
                    Window.Location.reload();
View Full Code Here

    }

    //NOTE: this is not used as it was flawed. Its ok to leave the code, GWT will compile it out anyway.
    private Widget newImportPackageWidget(final CheckBox overWriteCheckBox) {

        final FormPanel uploadFormPanel = new FormPanel();
        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 );
        panel.add( upload );

        panel.add( new Label( constants.Import() + ":" ) );
        ImageButton ok = new ImageButton( "images/upload.gif" );
        ok.addClickListener( new ClickListener() {
            public void onClick(Widget sender) {
                uploadFormPanel.setAction( GWT.getModuleBaseURL() + "backup?packageImport=true&importAsNew=" + !overWriteCheckBox.isChecked() );
                doImportFile( uploadFormPanel );
            }

            private void doImportFile(final FormPanel uploadFormPanel) {
                if ( (overWriteCheckBox.isChecked() && Window.confirm(constants.ImportPackageConfirm())) || !overWriteCheckBox.isChecked() ) {
                    LoadingPopup.showMessage(constants.ImportingPackage());
                    uploadFormPanel.submit();
                }
            }
        } );

        panel.add( ok );

        uploadFormPanel.addFormHandler( new FormHandler() {
            public void onSubmitComplete(FormSubmitCompleteEvent event) {
                if ( event.getResults().indexOf( "OK" ) > -1 ) { //NON-NLS
                    Window.alert(constants.PackageImportDone());
                } else {
                    ErrorPopup.showMessage(constants.PackageImportFailed());
View Full Code Here

    }

    public static Widget newImportWidget(final Command afterCreatedEvent,
                                         final FormStylePopup parent) {

        final FormPanel uploadFormPanel = new FormPanel();
        uploadFormPanel.setAction( GWT.getModuleBaseURL() + "package" );
        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.CLASSIC_DRL_IMPORT );
        panel.add( upload );

        panel.add( new Label( constants.upload() ) );
        ImageButton ok = new ImageButton( "images/upload.gif",
                                          constants.Import() ); //NON-NLS
       
        ClickHandler okClickHandler = new ClickHandler() {
      public void onClick(ClickEvent arg0) {
                if ( Window.confirm( constants.ImportMergeWarning() ) ) {
                    uploadFormPanel.submit();
                }     
            }         
        };
        ok.addClickHandler(okClickHandler);      

        panel.add( ok );

        final FormStylePopup packageNamePopup = new FormStylePopup( "images/package_large.png",
                                                                    constants.PackageName() );
        HorizontalPanel packageNamePanel = new HorizontalPanel();
        packageNamePopup.addRow( new Label( constants.ImportedDRLContainsNoNameForThePackage() ) );

        final TextBox packageName = new TextBox();
        packageNamePanel.add( new Label( constants.PackageName() + ":" ) );
        packageNamePanel.add( packageName );
        Button uploadWithNameButton = new Button( constants.OK() );
        uploadWithNameButton.addClickHandler( okClickHandler );
       
        packageNamePanel.add( uploadWithNameButton );
        packageNamePopup.addRow( packageNamePanel );
        uploadFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {
      public void onSubmitComplete(SubmitCompleteEvent event) {
                if ( event.getResults().indexOf( "OK" ) > -1 ) { //NON-NLS
                    Window.alert( constants.PackageWasImportedSuccessfully() );
                    afterCreatedEvent.execute();
                    parent.hide();
                    if ( packageNamePopup != null ) {
                        packageNamePopup.hide();
                    }
                } else if ( event.getResults().indexOf( "Missing package name." ) > -1 ) {
                    LoadingPopup.close();
                    packageNamePopup.show();
                } else {
                    ErrorPopup.showMessage( Format.format( constants.UnableToImportIntoThePackage0(),
                                                           event.getResults() ) );
                }
                LoadingPopup.close();       
      }      
        });
       
        uploadFormPanel.addSubmitHandler(new SubmitHandler() {
      public void onSubmit(SubmitEvent event) {
                if ( upload.getFilename().length() == 0 ) {
                    LoadingPopup.close()
                    Window.alert( constants.YouDidNotChooseADrlFileToImport() );
                    event.cancel();
                } else if ( !upload.getFilename().endsWith( ".drl" ) ) { //NON-NLS
                    LoadingPopup.close();                   
                    Window.alert( constants.YouCanOnlyImportDrlFiles() );
                    event.cancel();
                } else if ( packageName.getText() != null && !packageName.getText().equals( "" ) ) {
                    LoadingPopup.showMessage( constants.ImportingDRLPleaseWait() );
                    uploadFormPanel.setAction( uploadFormPanel.getAction() + "?packageName=" + packageName.getText() );
                }
      }         
        });

        return uploadFormPanel;
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 );
        panel.add( upload );

        //panel.add( new Label( "import:" ) );
        Button ok = new Button(constants.Import());
        ok.addClickListener( new ClickListener() {
            public void onClick(Widget sender) {
                doImportFile( uploadFormPanel );
            }

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

        panel.add( ok );

        uploadFormPanel.addFormHandler( new FormHandler() {
            public void onSubmitComplete(FormSubmitCompleteEvent event) {
                if ( event.getResults().indexOf( "OK" ) > -1 ) {
                    Window.alert(constants.ImportDone());
                    History.newItem(" ");
                    Window.Location.reload();
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.