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

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


  private Timer timer;
  private CompileCallback handler;
  private int timeout = 60, elapsed = 0;
 
  public ClsiRemoteService() {
  form = new FormPanel();
  form.setVisible(false);
  RootPanel.get().add(form);
    initialize(this);
  }
View Full Code Here


       
    });
    footerPanel.add(discard);
   
    // Create a FormPanel and point it at a service.
      final FormPanel form = new FormPanel();
      form.setAction("/image");

      // 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.setEncoding(FormPanel.ENCODING_MULTIPART);
      form.setMethod(FormPanel.METHOD_POST);

      // Create a panel to hold all of the form widgets.
      VerticalPanel panel = new VerticalPanel();
      form.setWidget(panel);

      // add label
      panel.add(new Label("select a file:"));
     
      // Create a FileUpload widget.
      final FileUpload upload = new FileUpload();
      upload.setName("uploadFormElement");
      panel.add(upload);

      // Add a 'submit' button.
      panel.add(new Button("Submit", new ClickHandler() {
        public void onClick(ClickEvent event) {
        upload.setName(upload.getFilename());
          form.submit();
        }
      }));

    footerPanel.add(form);
    deckPanel.add(footerPanel);
View Full Code Here

  private final MapWidget map;

  public Geocoder2Demo() {
    Panel panel = new FlowPanel();
    final FormPanel form = new FormPanel();
    form.setAction("#");
    Panel formElements = new FlowPanel();
    Label label = new Label("Search for an address:");
    formElements.add(label);
    final TextBox addressBox = new TextBox();
    addressBox.setVisibleLength(40);
    formElements.add(addressBox);
    Button submit = new Button("Search");
    submit.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        form.submit();
      }
    });
    formElements.add(submit);
    form.add(formElements);
    form.addSubmitHandler(new SubmitHandler() {
      public void onSubmit(SubmitEvent event) {
        showAddress(addressBox.getText());
        event.cancel();
      }
    });
    panel.add(form);

    map = new MapWidget(LatLng.newInstance(34, 0), 1);
    map.setSize("100%", "480px");
    panel.add(map);

    Grid grid = new Grid((sampleAddresses.length / NUM_ADDRESS_COLUMNS) + 1,
        NUM_ADDRESS_COLUMNS);

    for (int i = 0; i < sampleAddresses.length; i++) {
      final String address = sampleAddresses[i];
      Button link = new Button(address);
      // Hyperlink link = new Hyperlink(address, true,
      // "Extracting Structured Address Information");
      link.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          addressBox.setText(address);
          form.submit();
        }
      });
      grid.setWidget(i / NUM_ADDRESS_COLUMNS, i % NUM_ADDRESS_COLUMNS, link);
    }
    panel.add(grid);
View Full Code Here

  private MapWidget map;

  public GeocoderDemo() {
    Panel panel = new FlowPanel();
    final FormPanel form = new FormPanel();
    form.setAction("#");

    Panel formElements = new FlowPanel();
    final TextBox address = new TextBox();
    address.setVisibleLength(60);
    address.setText("10 10th Street, Atlanta, GA");
    formElements.add(address);
    formElements.add(buildLatLngPanel());
    this.displayLatLng(ATLANTA);

    Button submit = new Button("Go!");
    submit.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        form.submit();
      }
    });
    formElements.add(submit);
    form.add(formElements);
    form.addSubmitHandler(new SubmitHandler() {
      public void onSubmit(SubmitEvent event) {
        showAddress(address.getText());
        event.cancel();
      }
    });
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

  String username;
  String password;
 
  public LoginPanel() {
    VerticalPanel loginPanel = new VerticalPanel();
    FormPanel frmLogin = new FormPanel();
    FlexTable login = new FlexTable();
    Label lblUsername = new Label("Username");
    Label lblPassword = new Label("Password");
    TextBox txtUsername = new TextBox();
    PasswordTextBox txtPassword = new PasswordTextBox();
    Button btnLogin = new Button("Login");
    HTML loginTitle = new HTML();
   
    txtUsername.setWidth("160px");
    txtPassword.setWidth("160px");
   
    loginTitle.setHTML("<h3>Login</h3>");
    loginTitle.setStyleName("loginPanelTitle");
   
    login.setWidget(0,0,lblUsername);
    login.setWidget(0,1,txtUsername);
    login.setWidget(1,0,lblPassword);
    login.setWidget(1,1,txtPassword);
    login.setWidget(2,0,btnLogin);
   
    frmLogin.add(login);
    LoginHandler loginHandler = new LoginHandler();
    btnLogin.addClickHandler(loginHandler);
    btnLogin.addKeyUpHandler(loginHandler);
   
    loginPanel.add(loginTitle);
View Full Code Here

public class CreateUserPanel extends Composite {
 
  public CreateUserPanel() {
    VerticalPanel loginPanel = new VerticalPanel();
    FormPanel frmCreateUser = new FormPanel();
    FlexTable createUser = new FlexTable();
    Label lblUsername = new Label("Username");
    Label lblPassword = new Label("Password");
    TextBox txtUsername = new TextBox();
    PasswordTextBox txtPassword = new PasswordTextBox();
    Button btnCreateUser = new Button("Create User");
    HTML createUserTitle = new HTML();
   
    txtUsername.setWidth("160px");
    txtPassword.setWidth("160px");
   
    createUserTitle.setHTML("<h3>Login</h3>");
    createUserTitle.setStyleName("loginPanelTitle");
   
    createUser.setWidget(0,0,lblUsername);
    createUser.setWidget(0,1,txtUsername);
    createUser.setWidget(1,0,lblPassword);
    createUser.setWidget(1,1,txtPassword);
    createUser.setWidget(2,0,btnCreateUser);
   
    frmCreateUser.add(createUser);
    CreateUserHandler createUserHandler = new CreateUserHandler();
    btnCreateUser.addClickHandler(createUserHandler);
    btnCreateUser.addKeyUpHandler(createUserHandler);
   
    loginPanel.add(createUserTitle);
View Full Code Here

        this.confirm = false;
    }

    @Override
    protected IsWidget body(final ApplyContext context) {
        FormPanel form = new FormPanel();
        form.setAction(context.patchUrl);
        form.setEncoding(ENCODING_MULTIPART);
        form.setMethod(METHOD_POST);
        FlowPanel panel = new FlowPanel();
        form.setWidget(panel);
        context.form = form;

        Hidden operation = new Hidden("operation");
        panel.add(operation);
        context.operation = operation;
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(),
                                          constants.Import() );
        ClickHandler okClickHandler = new ClickHandler() {
            public void onClick(ClickEvent event) {
                if ( Window.confirm( constants.ImportMergeWarning() ) ) {
                    LoadingPopup.showMessage( constants.ImportingDRLPleaseWait() );
                    uploadFormPanel.submit();
                }
            }

        };
        ok.addClickHandler( okClickHandler );

        panel.add( ok );

        final FormStylePopup packageNamePopup = new FormStylePopup( images.packageLarge(),
                                                                    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
                    LoadingPopup.close();
                    Window.alert( constants.PackageWasImportedSuccessfully() );
                    afterCreatedEvent.execute();
                    parent.hide();
                    if ( packageNamePopup != null ) {
                        packageNamePopup.hide();
                    }
                } else if ( event.getResults().indexOf( "Missing package name." ) > -1 ) { //NON-NLS
                    LoadingPopup.close();
                    packageNamePopup.show();
                } else {
                    ErrorPopup.showMessage( constants.UnableToImportIntoThePackage0( event.getResults() ) );
                }
                LoadingPopup.close();
            }
        } );
        uploadFormPanel.addSubmitHandler( new SubmitHandler() {
            public void onSubmit(SubmitEvent event) {
                if ( upload.getFilename().length() == 0 ) {
                    Window.alert( constants.YouDidNotChooseADrlFileToImport() );
                    event.cancel();
                } else if ( !upload.getFilename().endsWith( ".drl" ) ) { //NON-NLS
                    Window.alert( constants.YouCanOnlyImportDrlFiles() );
                    event.cancel();
                } else if ( packageName.getText() != null && !packageName.getText().equals( "" ) ) {
                    uploadFormPanel.setAction( uploadFormPanel.getAction() + "?packageName=" + packageName.getText() );
                } else {
                    LoadingPopup.showMessage( constants.CreatingPackagePleaseWait() );
                }
            }
        } );
View Full Code Here

        h.add( new Image( 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

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.