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

Examples of com.google.gwt.user.client.ui.DialogBox$MouseHandler


   
    this.eventBus = eventBus;
   
    checkboxes = new ArrayList<CheckBox>();

    dialog = new DialogBox();
   
    niceDayTypeNames.put(TrafficCountRecord.DAYTYPE_WEEKDAY, "Weekday");
    niceDayTypeNames.put(TrafficCountRecord.DAYTYPE_SATURDAY, "Saturday");
    niceDayTypeNames.put(TrafficCountRecord.DAYTYPE_SUNDAY_HOLIDAY, "Sunday/Holiday");
   
View Full Code Here


    // 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

    bind();
  }
 
  @UiHandler("gpsHelp")
  void onClickGPSHelp(ClickEvent e) {
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("GPS Tagging Tolerance");
    VerticalPanel dialogVerticalPanel = new VerticalPanel();
    HTML dialogDesc = new HTML("GPS points are tagged based on nearness to user-defined roads. " +
        "The GPS tagging tolerance defines the maximum distance a point can be from a road and be included in the road's tag. " +
        "The system will use 1/2 of the block length that is set for the default zone type OR 50 m, whichever is greater.");
    Button ok = new Button("OK");
    ok.addClickHandler(new ClickHandler() {
     
      @Override
      public void onClick(ClickEvent event) {
        dialogBox.hide();
      }
    });
    dialogVerticalPanel.add(dialogDesc);
    dialogVerticalPanel.add(ok);
    dialogVerticalPanel.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
    dialogBox.setWidget(dialogVerticalPanel);
    dialogBox.center();
    dialogBox.show();
       
  }
View Full Code Here

    // 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("Loop Recognition");
    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(textToServerLabel);
    dialogVPanel.add(new HTML("<br><b>Algorithm 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();

        //=======================================================
        // HAVLAK
        //=======================================================
        long start = System.currentTimeMillis();
        String result = "Welcome to LoopTesterApp, GWT edition<br>";
        LoopTesterApp app = new LoopTesterApp();
        app.cfg.createNode(0);
        app.lsg.dump();
        app.buildBaseLoop(0);
        app.cfg.createNode(1);
        new BasicBlockEdge(app.cfg, 0, 2);
        int found = 0;

        result += "15000 dummy loops<br>";
        serverResponseLabel.setHTML(result);
        for (int dummyloop = 0; dummyloop < 1; dummyloop++) {
          HavlakLoopFinder finder = new HavlakLoopFinder(app.cfg, app.lsg);
          finder.findLoops();
        }

        result += "Constructing CFG...<br>";
        serverResponseLabel.setHTML(result);
        int n = 2;

        for (int parlooptrees = 0; parlooptrees < 10; parlooptrees++) {
          app.cfg.createNode(n + 1);
          app.buildConnect(2, n + 1);
          n = n + 1;

          for (int i = 0; i < 2; i++) {
            int top = n;
            n = app.buildStraight(n, 1);
            for (int j = 0; j < 25; j++) {
              n = app.buildBaseLoop(n);
            }
            int bottom = app.buildStraight(n, 1);
            app.buildConnect(n, top);
            n = bottom;
          }
          app.buildConnect(n, 1);
        }

        result += "Performing Loop Recognition\n1 Iteration<br>";
        HavlakLoopFinder finder = new HavlakLoopFinder(app.cfg, app.lsg);
        finder.findLoops();
        long t = System.currentTimeMillis() - start;
        result += "Found: " + app.lsg.getNumLoops() + " in " +
            t + " [ms]";

        result += "Another 100 iterations...<br>";
        for (int i = 0; i < 100; i++) {
          HavlakLoopFinder finder2 = new HavlakLoopFinder(app.cfg, new LSG());
          finder2.findLoops();
        }
        t = System.currentTimeMillis() - start;
        result += "<br>Found: " + app.lsg.getNumLoops() + " in " +
            t + " [ms]";

        //=======================================================

        sendButton.setEnabled(false);
        dialogBox.setText("Find Loops");
        serverResponseLabel.setHTML(result);
        dialogBox.center();
        closeButton.setFocus(true);

        /*
        //        if (!FieldVerifier.isValidName(textToServer)) {
        //          errorLabel.setText("Please enter at least four characters");
View Full Code Here

  public DefaultGameDialogs(Provider<GameHost> gameHost) {
    this.gameHost = gameHost;
  }

  public void show(String title) {
    final DialogBox box = new DialogBox();

    box.setAnimationEnabled(true);
    box.setText(title);
    box.setWidth("200px"); // It's an higherlower, folks!

    VerticalPanel verticalPanel = new VerticalPanel();

    Button higher = new Button("Higher, higher!");
    higher.addStyleName("centered");
    higher.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        box.hide();
        gameHost.get().playerGuess(RelationshipToPreviousCard.HIGHER);
      }
    });
    verticalPanel.add(higher);

    Button lower = new Button("Down, boy!");
    lower.addStyleName("centered");
    lower.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        box.hide();
        gameHost.get().playerGuess(RelationshipToPreviousCard.LOWER);
      }
    });
    verticalPanel.add(lower);

    HorizontalPanel hp = new HorizontalPanel();
    hp.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    hp.add(verticalPanel);
    box.setWidget(hp);
    box.center();
    box.show();
  }
View Full Code Here

    box.center();
    box.show();
  }

  public void showEndGame(final Runnable runnable) {
    final DialogBox box = new DialogBox();
    box.setAnimationEnabled(true);
    box.setText("Thanks for playing Higher or Lower! *ding*ding*ding*ding*");
    Button b = new Button("Thanks for having me!");
    b.addStyleName("centered");
    b.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        runnable.run();
        box.hide();
      }
    });
    box.setWidget(b);
    box.center();
    box.show();
  }
View Full Code Here

    return p;
  }

  private DialogBox makeAddPolyDialog() {

    DialogBox dialog = new DialogBox();
    dialog.setTitle("Add Polyline");

    Grid grid = new Grid(2, 4);

    VerticalPanel vp = new VerticalPanel();
    grid.setHTML(0, 0, "<b>Opacity</b>");
    // The drop down lists for setting the style
    final ListBox opacityBox = new ListBox();
    for (int i = 100; i > 0; i -= 10) {
      opacityBox.addItem(i + "%");
    }
    opacityBox.addChangeHandler(new ChangeHandler() {
      public void onChange(ChangeEvent event) {
        String val = opacityBox.getItemText(opacityBox.getSelectedIndex());
        opacity = Double.parseDouble(val.replace("%", "")) / 100.0;
      }
    });
    grid.setWidget(1, 0, opacityBox);

    grid.setHTML(0, 1, "<b>Weight</b>");
    final ListBox weightBox = new ListBox();
    weightBox.addItem("1 pixel");
    weightBox.addItem("2 pixels");
    weightBox.addItem("3 pixels");
    weightBox.addItem("5 pixels");
    weightBox.addItem("10 pixels");
    weightBox.addChangeHandler(new ChangeHandler() {
      public void onChange(ChangeEvent event) {
        String val = weightBox.getItemText(weightBox.getSelectedIndex());
        val = val.replace(" pixel", "");
        val = val.replace("s", "");
        weight = Integer.parseInt(val);
      }
    });
    grid.setWidget(1, 1, weightBox);

    grid.setHTML(0, 2, "<b>Color</b>");
    final ListBox colorBox = new ListBox();
    colorBox.addItem("#FF0000 red");
    colorBox.addItem("#FFFF00 yellow");
    colorBox.addItem("#00FF00 green");
    colorBox.addItem("#00FFFF cyan");
    colorBox.addItem("#0000FF blue");
    colorBox.addItem("#FF00FF violet");
    colorBox.addChangeHandler(new ChangeHandler() {
      public void onChange(ChangeEvent event) {
        color = colorBox.getItemText(colorBox.getSelectedIndex()).substring(0,
            7);
      }
    });
    grid.setWidget(1, 2, colorBox);

    grid.setHTML(0, 3, "<b>Fill Polygon</b>");
    final CheckBox fillCheckBox = new CheckBox("");
    fillCheckBox.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        fillFlag = fillCheckBox.getValue();
      }
    });
    grid.setWidget(1, 3, fillCheckBox);

    Button addPolylineButton = new Button("Make Polyline");
    addPolylineButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        message1.setText("opacity=" + opacity + " color=" + color + " weight="
            + weight + " polygon=" + makePolygon + " center=" + map.getCenter()
            + " zoom=" + map.getZoomLevel());
        addPolyDialog.hide();
        createPolyline();
        editPolylineButton.setEnabled(true);
      }
    });

    Button addPolygonButton = new Button("Make Polygon");
    addPolygonButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        message1.setText("Opacity=" + opacity + " color=" + color + "weight="
            + weight + "polygon = " + makePolygon + "Center=" + map.getCenter()
            + " zoom=" + map.getZoomLevel() + "fill=" + fillFlag);
        addPolyDialog.hide();
        createPolygon();
        editPolygonButton.setEnabled(true);
      }
    });

    Button cancelButton = new Button("Cancel");
    cancelButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        addPolyDialog.hide();
      }
    });

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    buttonPanel.add(addPolylineButton);
    buttonPanel.add(addPolygonButton);
    buttonPanel.add(cancelButton);
    vp.add(grid);
    vp.add(buttonPanel);
    dialog.add(vp);

    return dialog;
  }
View Full Code Here

    // 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

     
      static void buildPopup(String nameAch, final HashMap<String, XmlListAchievement> hashMapAch) {
          //String nameAch = "Defender";
        String html = buildHtmlHeader(hashMapAch, nameAch);             
        // Create the popup dialog box in case of error
        final DialogBox dialogBox = new DialogBox();
        dialogBox.setText("Achievement Description");
        dialogBox.setAnimationEnabled(true);
        Button closeButton = new Button("Close");
        // We can set the id of a widget by accessing its Element
        closeButton.getElement().setId("closeButtonAch");
        VerticalPanel dialogVPanel = new VerticalPanel();
       
        dialogVPanel.addStyleName("dialogVPanel");
        dialogVPanel.add(new HTML(html));
        dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.add(closeButton);
        dialogBox.setWidget(dialogVPanel);
        //dialogBox.showRelativeTo(tableStatsCommAcc);
        dialogBox.center();
       
        closeButton.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            dialogBox.hide();
//              searchClanButton.setEnabled(true);
//              searchClanButton.setFocus(true);
          }
        });
     
View Full Code Here

     
      static void buildPopup(String nameAch, final HashMap<String, XmlListAchievement> hashMapAch) {
          //String nameAch = "Defender";
        String html = buildHtmlHeader(hashMapAch, nameAch);             
        // Create the popup dialog box in case of error
        final DialogBox dialogBox = new DialogBox();
        dialogBox.setText("Achievement Description");
        dialogBox.setAnimationEnabled(true);
        Button closeButton = new Button("Close");
        // We can set the id of a widget by accessing its Element
        closeButton.getElement().setId("closeButtonAch");
        VerticalPanel dialogVPanel = new VerticalPanel();
       
        dialogVPanel.addStyleName("dialogVPanel");
        dialogVPanel.add(new HTML(html));
        dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
        dialogVPanel.add(closeButton);
        dialogBox.setWidget(dialogVPanel);
        //dialogBox.showRelativeTo(tableStatsCommAcc);
        dialogBox.center();
       
        closeButton.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            dialogBox.hide();
//              searchClanButton.setEnabled(true);
//              searchClanButton.setFocus(true);
          }
        });
     
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.DialogBox$MouseHandler

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.