Java Code Examples for javafx.scene.control.ProgressIndicator#INDETERMINATE_PROGRESS

The following examples show how to use javafx.scene.control.ProgressIndicator#INDETERMINATE_PROGRESS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditorFxScene.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
/**
 * Show the loading process.
 */
@FxThread
private void showLoading() {
    focused = getFocusOwner();

    var loadingLayer = getLoadingLayer();
    loadingLayer.setVisible(true);
    loadingLayer.setManaged(true);
    loadingLayer.toFront();

    progressIndicator = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);
    progressIndicator.setId(CssIds.EDITOR_LOADING_PROGRESS);

    FxUtils.addChild(loadingLayer, progressIndicator);

    var container = getContainer();
    container.setDisable(true);
}
 
Example 2
Source File: Splash.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** @param percentage Progress 0..100, or negative for indeterminate */
public void updateProgress(final int percentage)
{
    final double progress = percentage >= 0 ? percentage/100.0 : ProgressIndicator.INDETERMINATE_PROGRESS;
    Platform.runLater(() ->
    {
        this.progress.setProgress(progress);
        stage.toFront();
    });
}
 
Example 3
Source File: ViewContentBeneathTerrainSurfaceSample.java    From arcgis-runtime-samples-java with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {

  // create stack pane and JavaFX app scene
  StackPane stackPane = new StackPane();
  Scene fxScene = new Scene(stackPane);

  // set title, size, and add JavaFX scene to stage
  stage.setTitle("View Content Beneath Terrain Surface Sample");
  stage.setWidth(800);
  stage.setHeight(700);
  stage.setScene(fxScene);
  stage.show();

  // create a scene from a web scene Url and set it to the scene view
  scene = new ArcGISScene("https://www.arcgis.com/home/item.html?id=91a4fafd747a47c7bab7797066cb9272");
  sceneView = new SceneView();
  sceneView.setArcGISScene(scene);

  // add a progress indicator to show the scene is loading
  ProgressIndicator progressIndicator = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);

  // once the scene has loaded, set the navigation constraint and opacity of the base surface
  scene.addDoneLoadingListener(() -> {
    // ensure the navigation constraint is set to NONE to view content beneath the terrain surface
    scene.getBaseSurface().setNavigationConstraint(NavigationConstraint.NONE);
    // set opacity to view content beneath the base surface
    scene.getBaseSurface().setOpacity(0.4f);
  });

  // hide the progress indicator once the sceneview has completed drawing
  sceneView.addDrawStatusChangedListener(event -> progressIndicator.setVisible(false));

  // add the scene view and progress indicator to the stack pane
  stackPane.getChildren().addAll(sceneView, progressIndicator);
}
 
Example 4
Source File: LocalServerMapImageLayerSample.java    From arcgis-runtime-samples-java with Apache License 2.0 4 votes vote down vote up
@Override
public void start(Stage stage) {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Local Server Map Image Layer Sample");
    stage.setWidth(APPLICATION_WIDTH);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a view with a map and basemap
    ArcGISMap map = new ArcGISMap(Basemap.createStreets());
    mapView = new MapView();
    mapView.setMap(map);

    // track progress of loading map image layer to map
    imageLayerProgress = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);
    imageLayerProgress.setMaxWidth(30);

    // check that local server install path can be accessed
    if (LocalServer.INSTANCE.checkInstallValid()) {
      LocalServer server = LocalServer.INSTANCE;
      // start local server
      server.addStatusChangedListener(status -> {
        if (status.getNewStatus() == LocalServerStatus.STARTED) {
          // start map image service
          String mapServiceURL = new File(System.getProperty("data.dir"), "./samples-data/local_server/RelationshipID.mpk").getAbsolutePath();
          mapImageService = new LocalMapService(mapServiceURL);
          mapImageService.addStatusChangedListener(this::addLocalMapImageLayer);
          mapImageService.startAsync();
        }
      });
      server.startAsync();
    } else {
      Platform.runLater(() -> {
        Alert dialog = new Alert(AlertType.INFORMATION);
        dialog.initOwner(mapView.getScene().getWindow());
        dialog.setHeaderText("Local Server Load Error");
        dialog.setContentText("Local Geoprocessing Failed to load.");
        dialog.show();
      });
    }

    // add view to application window with progress bar
    stackPane.getChildren().addAll(mapView, imageLayerProgress);
    StackPane.setAlignment(imageLayerProgress, Pos.CENTER);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
Example 5
Source File: LocalServerFeatureLayerSample.java    From arcgis-runtime-samples-java with Apache License 2.0 4 votes vote down vote up
@Override
public void start(Stage stage) {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Local Server Feature Layer Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a view with a map and basemap
    map = new ArcGISMap(Basemap.createStreets());
    mapView = new MapView();
    mapView.setMap(map);

    // track progress of loading feature layer to map
    featureLayerProgress = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);
    featureLayerProgress.setMaxWidth(30);

    // check that local server install path can be accessed
    if (LocalServer.INSTANCE.checkInstallValid()) {
      server = LocalServer.INSTANCE;
      server.addStatusChangedListener(status -> {
        if (server.getStatus() == LocalServerStatus.STARTED) {
          // start feature service
          File mpkFile = new File(System.getProperty("data.dir"), "./samples-data/local_server/PointsofInterest.mpk");
          featureService = new LocalFeatureService(mpkFile.getAbsolutePath());
          featureService.addStatusChangedListener(this::addLocalFeatureLayer);
          featureService.startAsync();
        }
      });
      // start local server
      server.startAsync();
    } else {
      Platform.runLater(() -> {
        Alert dialog = new Alert(AlertType.INFORMATION);
        dialog.initOwner(mapView.getScene().getWindow());
        dialog.setHeaderText("Local Server Load Error");
        dialog.setContentText("Local Geoprocessing Failed to load.");
        dialog.showAndWait();

        Platform.exit();
      });
    }

    // add view to application window
    stackPane.getChildren().addAll(mapView, featureLayerProgress);
    StackPane.setAlignment(featureLayerProgress, Pos.CENTER);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
Example 6
Source File: CanvasManager.java    From ShootOFF with GNU General Public License v3.0 4 votes vote down vote up
public CanvasManager(Group canvasGroup, Resetter resetter, String cameraName,
		ObservableList<ShotEntry> shotEntries) {
	this.canvasGroup = canvasGroup;
	config = Configuration.getConfig();
	this.resetter = resetter;
	this.cameraName = cameraName;
	this.shotEntries = shotEntries;

	background.setOnMouseClicked((event) -> {
		toggleTargetSelection(Optional.empty());
	});

	if (Platform.isFxApplicationThread()) {
		progress = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);
		progress.setPrefHeight(config.getDisplayHeight());
		progress.setPrefWidth(config.getDisplayWidth());
		canvasGroup.getChildren().add(progress);
		canvasGroup.getChildren().add(diagnosticsVBox);
		diagnosticsVBox.setAlignment(Pos.CENTER);
		diagnosticsVBox.setFillWidth(true);
		diagnosticsVBox.setPrefWidth(config.getDisplayWidth());
	}

	canvasGroup.setOnMouseClicked((event) -> {
		if (contextMenu.isPresent() && contextMenu.get().isShowing()) contextMenu.get().hide();

		if (config.inDebugMode() && event.getButton() == MouseButton.PRIMARY) {
			// Click to shoot
			final ShotColor shotColor;

			if (event.isShiftDown()) {
				shotColor = ShotColor.RED;
			} else if (event.isControlDown()) {
				shotColor = ShotColor.GREEN;
			} else {
				return;
			}

			// Skip the camera manager for injected shots made from the
			// arena tab otherwise they get scaled before the call to
			// addArenaShot when they go through the arena camera feed's
			// canvas manager
			if (this instanceof MirroredCanvasManager) {
				final long shotTimestamp = System.currentTimeMillis();

				addShot(new DisplayShot(new Shot(shotColor, event.getX(), event.getY(), shotTimestamp), config.getMarkerRadius()), false);
			} else {
				cameraManager.injectShot(shotColor, event.getX(), event.getY(), false);
			}
			return;
		} else if (contextMenu.isPresent() && event.getButton() == MouseButton.SECONDARY) {
			contextMenu.get().show(canvasGroup, event.getScreenX(), event.getScreenY());
		}
	});
}