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

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


            final ClickHandler sizeHandler = new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    for (int i = 0; i < sizes.length; i++) {
                        Button b = sizes[i];
                        if (b == event.getSource()) {
                            setSize(i);
                        }
                    }
                    hide();
                }
            };
            for (int i = 0; i < sizes.length; i++) {
                Button b = sizes[i];
                b.setStyleDependentName("size" + i, true);
                b.addClickHandler(sizeHandler);
                size.add(b);
            }

            FlowPanel mode = new FlowPanel();
            content.add(mode);
            final ClickHandler modeHandler = new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    for (int i = 0; i < modes.length; i++) {
                        Button b = modes[i];
                        if (b == event.getSource()) {
                            setDevMode(i);
                        }
                    }
                    hide();
                }
            };
            modes[getDevMode()].setActive(true);
            for (int i = 0; i < modes.length; i++) {
                Button b = modes[i];
                b.addClickHandler(modeHandler);
                mode.add(b);
            }

            Button reset = new DebugButton(Icon.RESET, "Restore defaults.",
                    " Reset");
            reset.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    resetStoredState();
                    readStoredState();
                    hide();
View Full Code Here


            content.add(reset);
        }

        private void setSize(int size) {
            for (int i = 0; i < sizes.length; i++) {
                Button b = sizes[i];
                b.setStyleDependentName(STYLENAME_ACTIVE, i == size);
            }
            setFontSize(size);
            writeStoredState();
        }
View Full Code Here

      public void run() {
        RootPanel.get("txtStartDate").add(txtStartDate);
        RootPanel.get("txtEndDate").add(txtEndDate);
        RootPanel.get("btnSetRange").add(btnSetRange);
       
        Button btnAutoRange = new Button("Auto Range");
        btnAutoRange.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        graph.setValueRangeAuto();
        graph.setVisibleChartRangeAuto();
      }
View Full Code Here

        // create the treegrid, with data and options
        treegrid = new TreeGrid(dataConnector, options);
        RootPanel.get("mytreegrid").add(treegrid);
       
        // create a button to add a truck, to see that data is updated
        Button btnAddTruck = new Button("Add Truck");
        btnAddTruck.addClickHandler(new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            Truck truck = new Truck("Added Truck", 1234, "test");
            dataConnector.add(truck);
          }
View Full Code Here

    @Override
    public void onModuleLoad() {
        final TextBox nameField = new TextBox();
        nameField.setText("GWT User");
        final Button button = new Button("Check");

        VerticalPanel vp = new VerticalPanel();
        vp.add(nameField);
        vp.add(button);
        RootPanel.get().add(vp);

        button.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if ("GWT User".equals(nameField.getText())) {
                    Window.alert("User OK");
                } else {
View Full Code Here

    // Logger.getLogger("").addHandler(new ErrorDialog().getHandler());
    Logger.getLogger("").addHandler(
        new RequestFactoryLogHandler(provider, Level.ALL,
            new ArrayList<String>()));

    final Button sendButton = new Button("Send");
    final TextBox nameField = new TextBox();
    nameField.setText("Aleksey");
    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("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() {
      @Override
      public void onClick(ClickEvent event) {
        dialogBox.hide();
        sendButton.setEnabled(true);
        sendButton.setFocus(true);
View Full Code Here

  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {
    final Button sendButton = new Button("Send");
    final TextBox nameField = new TextBox();
    nameField.setText("GWT User");
    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("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 textToServer = nameField.getText();
        if (!FieldVerifier.isValidName(textToServer)) {
          errorLabel.setText("Please enter at least four characters");
          return;
        }
       
        // Then, we send the input to the server.
        sendButton.setEnabled(false);
        textToServerLabel.setText(textToServer);
        serverResponseLabel.setText("");
        greetingService.greetServer(textToServer, 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 onModuleLoad() {
    Chronoscope.setMicroformatsEnabled(true);
    Chronoscope.initialize();
   
    Button b = new Button("click");
    b.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        Chronoscope.initialize();
      }
    });
   
View Full Code Here

    Chronoscope.setErrorReporting(false);
    Chronoscope.setAnimationPreview(false);
    chronoscope = Chronoscope.getInstance();
    chronoscope2 = Chronoscope.getInstance();
   
    Button b1 = new Button("Chart Renders Empty", new ClickHandler() {
      public void onClick(ClickEvent event) {
        updateChart("blank_graph");
      }
    });
    Button b2 = new Button("Chart Renders With No Legend", new ClickHandler() {
      public void onClick(ClickEvent event) {
        updateChart("no_legend");
      }
    });
    Button b3 = new Button("Chart Renders With Overrun", new ClickHandler() {
      public void onClick(ClickEvent event) {
        updateChart("overrun");
      }
    });
    RootPanel.get("buttons").add(b1);
View Full Code Here

            ChartDemoMutate.this.theview = view;
            theplot = view.getChart().getPlot();
          }
        });
   
    Button b1 = new Button("Mutate", new ClickHandler() {
      public void onClick(ClickEvent event) {
        mutate();
      }
    });
    RootPanel.get("buttons").add(b1);
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.