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

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


        log.log(Level.SEVERE, e.getMessage(), e);
      }
    });

    final CellTable<EventProxy> eventsTable = eventsListUi.getEventsTable();
    final Button addButton = eventsListUi.getAddButton();
    final Button deleteButton = eventsListUi.getDeleteButton();
    final SimplePager eventsTablePager = eventsListUi.getEventsTablePager();
    final SingleSelectionModel<EventProxy> selectionModel = eventsListUi.getSelectionModel();
   
   
 
View Full Code Here


  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {
    final Button sendButton = new Button("Login");
    final TextBox nameField = new TextBox();
    nameField.setWidth("100px");
    final PasswordTextBox passwordField = new PasswordTextBox();
    passwordField.setWidth("100px");
    final Label errorLabel = new Label();

    // We can add style names to widgets
    sendButton.addStyleName("sendButton");

    // Add the nameField and sendButton to the RootPanel
    // Use RootPanel.get() to get the entire body element
    RootPanel.get("nameFieldContainer").add(nameField);
    RootPanel.get("loginFieldContainer").add(passwordField);
    RootPanel.get("sendButtonContainer").add(sendButton);
    RootPanel.get("errorLabelContainer").add(errorLabel);

    // Focus the cursor on the name field when the app loads
    nameField.setFocus(true);
    nameField.selectAll();

    // Create the popup dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("Remote Procedure Call");
    dialogBox.setAnimationEnabled(true);
    final Button closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    final Label textToServerLabel = new Label();
    final HTML serverResponseLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
    dialogVPanel.add(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
    dialogVPanel.add(serverResponseLabel);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogVPanel.add(closeButton);
    dialogBox.setWidget(dialogVPanel);

    // Add a handler to close the DialogBox
    closeButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        dialogBox.hide();
        sendButton.setEnabled(true);
        sendButton.setFocus(true);
      }
    });

    // Create a handler for the sendButton and nameField
    class MyHandler implements ClickHandler, KeyUpHandler {
      /**
       * Fired when the user clicks on the sendButton.
       */
      public void onClick(ClickEvent event) {
        sendNameToServer();
      }

      /**
       * Fired when the user types in the nameField.
       */
      public void onKeyUp(KeyUpEvent event) {
        if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
          sendNameToServer();
        }
      }

      /**
       * Send the name from the nameField to the server and wait for a response.
       */
      private void sendNameToServer() {
        // First, we validate the input.
        errorLabel.setText("");
        String username = nameField.getText();
        String password = passwordField.getText();
        if (!FieldVerifier.isValidName(username)) {
          errorLabel.setText("Please enter at least four characters");
          return;
        }
       
        if(!("admin".equals(username) && "admin".equals(password)))
        {
          errorLabel.setText("Invalid username and password");
          return;
        }

        // Then, we send the input to the server.
        sendButton.setEnabled(false);
        textToServerLabel.setText(username);
        serverResponseLabel.setText("");
        greetingService.greetServer(username,
            new AsyncCallback<String>() {
              public void onFailure(Throwable caught) {
                // Show the RPC error message to the user
                dialogBox
                    .setText("Remote Procedure Call - Failure");
                serverResponseLabel
                    .addStyleName("serverResponseLabelError");
                serverResponseLabel.setHTML(SERVER_ERROR);
                dialogBox.center();
                closeButton.setFocus(true);
              }

              public void onSuccess(String result) {
                dialogBox.setText("Remote Procedure Call");
                serverResponseLabel
                    .removeStyleName("serverResponseLabelError");
                serverResponseLabel.setHTML(result);
                dialogBox.center();
                closeButton.setFocus(true);
              }
            });
      }
    }

View Full Code Here

  public void testSelectionEvents() {
    TabLayoutPanel p = new TabLayoutPanel(2, Unit.EM);
    RootPanel.get().add(p);

    p.add(new Button("foo"), "foo");
    p.add(new Button("bar"), "bar");

    // Make sure selecting a tab fires both events in the right order.
    TestSelectionHandler handler = new TestSelectionHandler();
    p.addBeforeSelectionHandler(handler);
    p.addSelectionHandler(handler);
View Full Code Here

  public void testSelectionEventsNoFire() {
    TabLayoutPanel p = new TabLayoutPanel(2, Unit.EM);
    RootPanel.get().add(p);

    p.add(new Button("foo"), "foo");
    p.add(new Button("bar"), "bar");

    TestSelectionHandler handler = new TestSelectionHandler();
    p.addBeforeSelectionHandler(handler);
    p.addSelectionHandler(handler);
    p.selectTab(1, false);
View Full Code Here

  @DoNotRunWith(Platform.HtmlUnitLayout)
  public void testTabLayout() {
    TabLayoutPanel p = new TabLayoutPanel(2, Unit.EM);
    RootPanel.get().add(p);

    p.add(new Button("foo"), new Label("foo"));
    p.add(new Button("bar"), new Label("bar"));

    assertEquals(p.getTabWidget(0).getElement().getOffsetTop(),
        p.getTabWidget(1).getElement().getOffsetTop());
  }
View Full Code Here

    innerPanel.setStylePrimaryName("hm-mapinnerpanel");
    // innerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    HorizontalPanel horizPanel = new HorizontalPanel();
    list.setStylePrimaryName("hm-demolistbox");
    Button nextLink = new Button(">>");
    nextLink.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        show(list.getNext(), true);
      }
    });
View Full Code Here

    vp.add(map);
    vp.setSpacing(10);
    map.setSize("500px", "500px");
    map.setUIToDefault();

    hideButton = new Button("Hide");
    vp.add(hideButton);
    hideButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (groundOverlay.isVisible()) {
          hideButton.setText("Show");
View Full Code Here

    Panel panel = new FlowPanel();

    map = new MapWidget(LatLng.newInstance(40.652513, -73.936615), 12);
    map.setSize("640px", "480px");
    panel.add(map);
    Button toggleStreetview = new Button("Toggle Street View Overlay");
    toggleStreetview.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (svShown) {
          map.removeOverlay(svOverlay);
        } else {
          map.addOverlay(svOverlay);
View Full Code Here

    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);
View Full Code Here

    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();
        }
      });
View Full Code Here

TOP

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

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.