示例#1
0
  public static void handleDevMapClick(LatLng position) {
    if (WindowInformation.locationPanel.isRoadMode()) {
      if (location1ID != -1 && position != null) {
        roadPoints.add(position);
        // Window.alert("Road point added");
      }
    } else {
      String locationName = Window.prompt("Name for this location:", "NULL" + locationCounter++);
      if (locationName != null) {
        GameServices.devService.createLocation(
            GameInfo.getInstance().getPlayer(),
            locationName,
            position.getLatitude(),
            position.getLongitude(),
            new AsyncCallback<Void>() {
              public void onFailure(Throwable caught) {}

              public void onSuccess(Void result) {
                // TODO: Keep the auto-refresh when creating locations?
                // GameInformation.getInstance().refreshAll(true);
              }
            });
      }
    }
  }
 public void configure() {
   String s = Window.prompt("Enter path to web content to display:", path == null ? "" : path);
   if (s != null) {
     path = s;
     refresh();
   }
 }
 private String askNewConfigName() {
   String newName = Window.prompt("Please specify the configuration name.", "My Config");
   while (containsConfig(newName)) {
     Window.alert("'" + newName + "' already exists, please choose a different name.");
     newName = askNewConfigName();
   }
   return newName;
 }
示例#4
0
  @Test
  public void prompt() {
    // Arrange
    mockedHandler.prompt(EasyMock.eq("prompt message"), EasyMock.eq("initial value"));
    EasyMock.expectLastCall().andReturn("mocked message");
    EasyMock.replay(mockedHandler);

    // Act
    String result = Window.prompt("prompt message", "initial value");

    // Assert
    EasyMock.verify(mockedHandler);
    assertEquals("mocked message", result);
  }
  private void renameSelected() {

    String name = Window.prompt(constants.CategoryNewNamePleaseEnter(), "");
    if (name != null) {
      RepositoryServiceFactory.getCategoryService()
          .renameCategory(
              explorer.getSelectedPath(),
              name,
              new GenericCallback<java.lang.Void>() {
                public void onSuccess(Void v) {
                  Window.alert(constants.CategoryRenamed());
                  explorer.refresh();
                }
              });
    }
  }
示例#6
0
  /** {@inheritDoc} */
  @Override
  public void onGenerateClicked() {
    String host = Window.prompt(constant.hostNameField(), "");
    if (!host.isEmpty()) {
      service.generateKey(
          host,
          new AsyncRequestCallback<Void>() {
            @Override
            protected void onSuccess(Void result) {
              refreshKeys();
            }

            @Override
            protected void onFailure(Throwable exception) {
              notificationManager.showError(
                  SafeHtmlUtils.fromString(exception.getMessage()).asString());
              eventBus.fireEvent(new ExceptionThrownEvent(exception));
            }
          });
    }
  }