Example usage for javafx.scene Cursor WAIT

List of usage examples for javafx.scene Cursor WAIT

Introduction

In this page you can find the example usage for javafx.scene Cursor WAIT.

Prototype

Cursor WAIT

To view the source code for javafx.scene Cursor WAIT.

Click Source Link

Document

The wait cursor type.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.initStyle(StageStyle.UNDECORATED);
    Text text = new Text("Transparent!");
    text.setFont(new Font(40));
    VBox box = new VBox();
    box.getChildren().add(text);// w w w . ja  va  2  s. com
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
    scene.setCursor(Cursor.WAIT);
}

From source file:calendarioSeries.vistas.NewSerieController.java

@FXML
public void handleOk() {
    String tituloAux = titulo.getText().replaceAll(" ", "+").toLowerCase();
    String toJson = readUrl(BASE + tituloAux + "&type=series" + "&r=json");
    resultados.getChildren().clear();/*from ww w  .ja va2s  . c om*/
    try {
        JSONObject busqueda = new JSONObject(toJson);
        if (busqueda.getString("Response").equals("True")) {
            JSONArray res = busqueda.getJSONArray("Search");
            resultados.setPrefRows(res.length());
            for (int i = 0; i < res.length(); i++) {
                JSONObject resActual = new JSONObject(res.get(i).toString());
                HBox resultadoActual = new HBox(50);
                resultadoActual.setMaxWidth(Double.MAX_VALUE);
                resultadoActual.setAlignment(Pos.CENTER_LEFT);
                ImageView posterActual = new ImageView();

                try {
                    Image image = new Image(resActual.getString("Poster"));
                    posterActual.setImage(image);
                    posterActual.setFitHeight(240);
                    posterActual.setFitWidth(180);
                    posterActual.setPreserveRatio(false);
                    resultadoActual.getChildren().add(posterActual);
                } catch (IllegalArgumentException e) {
                    //                        System.out.println("Bad url");
                    Image image = new Image(
                            MainApp.class.getResource("resources/no-image.png").toExternalForm());
                    posterActual.setImage(image);
                    posterActual.setFitHeight(240);
                    posterActual.setFitWidth(180);
                    posterActual.setPreserveRatio(false);
                    resultadoActual.getChildren().add(posterActual);
                }

                String details;
                String nomSerie = new String(resActual.getString("Title").getBytes(), "UTF-8");
                String anoSerie = new String(resActual.getString("Year").getBytes(), "UTF-8");
                if (nomSerie.length() > 15) {
                    details = "%-12.12s...\t\t Ao: %-10s";
                } else {
                    details = "%-12s\t\t Ao: %-10s";
                }
                details = String.format(details, nomSerie, anoSerie);
                Label elemento = new Label(details);
                elemento.setMaxWidth(Double.MAX_VALUE);
                elemento.setMaxHeight(Double.MAX_VALUE);
                resultadoActual.getChildren().add(elemento);

                posterActual.setId(resActual.getString("imdbID"));
                posterActual.setOnMouseClicked(new EventHandler<MouseEvent>() {
                    @Override
                    public void handle(MouseEvent event) {
                        ImageView clickedButton = (ImageView) event.getSource();
                        Stage stage = (Stage) clickedButton.getScene().getWindow();
                        Task task = new Task() {
                            @Override
                            protected Object call() throws Exception {
                                mainController.mainApp.scene.setCursor(Cursor.WAIT);
                                Serie toAdd = new Serie(clickedButton.getId());
                                boolean possible = true;
                                for (Serie serie : mainController.getSeries()) {
                                    if (serie.equals(toAdd))
                                        possible = false;
                                }
                                if (possible)
                                    mainController.getSeries().add(toAdd);

                                try {
                                    mainController.populateImagenes();
                                    mainController.showDetallesMes(mainController.getMesActual());
                                } catch (Exception e) {
                                    e.printStackTrace();
                                } finally {
                                    mainController.mainApp.scene.setCursor(Cursor.DEFAULT);

                                    return mainController.getSeries();
                                }
                            }
                        };
                        Thread th = new Thread(task);
                        th.setDaemon(true);
                        th.start();
                        stage.close();
                    }
                });
                resultados.getChildren().add(resultadoActual);
            }
        } else {
            resultados.getChildren().add(new Label("La busqueda no obtuvo resultados"));
        }
    } catch (JSONException e) {
        e.printStackTrace();
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(NewSerieController.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:org.martus.client.swingui.PureFxMainWindow.java

@Override
public Object getWaitCursor() {
    return Cursor.WAIT;
}

From source file:editeurpanovisu.EquiCubeDialogController.java

public Task tskTraitement() {
    return new Task() {
        @Override//from ww w . j  a  va 2s .  co  m
        protected Object call() throws Exception {
            apTransformations.setCursor(Cursor.WAIT);
            Platform.runLater(() -> {
                for (int ij = 0; ij < lvListeFichier.getItems().size(); ij++) {
                    String strNomFich1 = (String) lvListeFichier.getItems().get(ij);
                    lvListeFichier.getItems().set(ij, "A Traiter => " + strNomFich1);
                }
            });
            updateProgress(0.0001f, lvListeFichier.getItems().size());
            for (int i1 = 0; i1 < lvListeFichier.getItems().size(); i1++) {
                Thread.sleep(200);
                updateMessage("Traitement en cours " + (i1 + 1) + "/" + lvListeFichier.getItems().size());
                String strNomFich = ((String) lvListeFichier.getItems().get(i1)).split("> ")[1];
                final int ii = i1;
                Platform.runLater(() -> {
                    lvListeFichier.getItems().set(ii, "Traitement en cours => " + strNomFich);
                });
                traiteFichier(strNomFich, i1);
                Thread.sleep(100);

                updateProgress(i1 + 1, lvListeFichier.getItems().size());
                Platform.runLater(() -> {
                    lvListeFichier.getItems().set(ii, "Trait => " + strNomFich);
                });
                Thread.sleep(100);
            }
            apTransformations.setCursor(Cursor.DEFAULT);
            return true;
        }

        @Override
        protected void succeeded() {
            super.succeeded();
            pbBarreAvancement.progressProperty().unbind();
            lblTermine.textProperty().unbind();
            lblTermine.setText("Traitement Termin");
            pbBarreAvancement.setProgress(0.001d);
            pbBarreAvancement.setVisible(false);
            pbBarreImage.setVisible(false);
            bTraitementEffectue = true;
            lblDragDropE2C.setVisible(true);
        }

    };
}

From source file:org.sleuthkit.autopsy.timeline.ui.detailview.EventDetailsChart.java

@Override
protected synchronized void layoutPlotChildren() {
    setCursor(Cursor.WAIT);
    maxY.set(0);//from   w  w w .  j  a  v  a 2s.  co m
    if (bandByType.get()) {
        stripeNodeMap.values().stream().collect(Collectors.groupingBy(EventStripeNode::getEventType)).values()
                .forEach(inputNodes -> {
                    List<EventStripeNode> stripeNodes = inputNodes.stream()
                            .sorted(Comparator.comparing(EventStripeNode::getStartMillis))
                            .collect(Collectors.toList());

                    maxY.set(layoutEventBundleNodes(stripeNodes, maxY.get()));
                });
    } else {
        List<EventStripeNode> stripeNodes = stripeNodeMap.values().stream()
                .sorted(Comparator.comparing(EventStripeNode::getStartMillis)).collect(Collectors.toList());
        maxY.set(layoutEventBundleNodes(stripeNodes, 0));
    }
    layoutProjectionMap();
    setCursor(null);
}

From source file:org.sleuthkit.autopsy.timeline.ui.detailview.AggregateEventNode.java

/**
 * loads sub-clusters at the given Description LOD
 *
 * @param newLOD/*from  ww  w.  jav  a 2  s. c  o m*/
 */
private void loadSubClusters(DescriptionLOD newLOD) {
    getSubNodePane().getChildren().clear();
    if (newLOD == event.getLOD()) {
        getSubNodePane().getChildren().clear();
        chart.setRequiresLayout(true);
        chart.requestChartLayout();
    } else {
        //make a new filter intersecting the global filter with text(description) and type filters to restrict sub-clusters
        final Filter combinedFilter = Filter.intersect(new Filter[] { new TextFilter(event.getDescription()),
                new TypeFilter(event.getType()), chart.getFilteredEvents().filter().get() });

        //make a new end inclusive span (to 'filter' with)
        final Interval span = event.getSpan().withEndMillis(event.getSpan().getEndMillis() + 1000);

        //make a task to load the subnodes
        LoggedTask<List<AggregateEventNode>> loggedTask = new LoggedTask<List<AggregateEventNode>>(
                NbBundle.getMessage(this.getClass(), "AggregateEventNode.loggedTask.name"), true) {

            @Override
            protected List<AggregateEventNode> call() throws Exception {
                //query for the sub-clusters
                List<AggregateEvent> aggregatedEvents = chart.getFilteredEvents()
                        .getAggregatedEvents(new ZoomParams(span,
                                chart.getFilteredEvents().eventTypeZoom().get(), combinedFilter, newLOD));
                //for each sub cluster make an AggregateEventNode to visually represent it, and set x-position
                return aggregatedEvents.stream().map((AggregateEvent t) -> {
                    AggregateEventNode subNode = new AggregateEventNode(t, AggregateEventNode.this, chart);
                    subNode.setLayoutX(
                            chart.getXAxis().getDisplayPosition(new DateTime(t.getSpan().getStartMillis()))
                                    - getLayoutXCompensation());
                    return subNode;
                }).collect(Collectors.toList()); // return list of AggregateEventNodes representing subclusters
            }

            @Override
            protected void succeeded() {
                try {
                    chart.setCursor(Cursor.WAIT);
                    //assign subNodes and request chart layout
                    getSubNodePane().getChildren().setAll(get());
                    setDescriptionVisibility(descrVis);
                    chart.setRequiresLayout(true);
                    chart.requestChartLayout();
                    chart.setCursor(null);
                } catch (InterruptedException | ExecutionException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
        };

        //start task
        chart.getController().monitorTask(loggedTask);
    }
}

From source file:org.jevis.jeconfig.JEConfig.java

/**
 * Inform the user the some precess is working
 *
 * @param working//from   ww w. ja  v  a2 s .  c o m
 */
public static void loadNotification(final boolean working) {
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            if (working) {
                getStage().getScene().setCursor(Cursor.WAIT);
            } else {
                getStage().getScene().setCursor(Cursor.DEFAULT);
            }
        }
    });

}

From source file:com.github.drbookings.ui.controller.MainController.java

private void setWorkingFX(final boolean working, final boolean success) {
    // if (!working) {
    // return;/*from  w  w w. ja va  2  s  . c  o m*/
    // }
    buttonAddBooking.getScene().getRoot().setCursor(Cursor.WAIT);
    progressBar.setVisible(working);
    if (success) {
        progressLabel.setVisible(working);
        progressLabel.getStyleClass().remove("warning");
    } else {
        progressLabel.getStyleClass().add("warning");
    }
    buttonAddBooking.setDisable(working);
    buttonGoHome.setDisable(working);
    buttonSelectCurrentMonth.setDisable(working);
    buttonSelectLastMonth.setDisable(working);
    buttonSelectLastThreeMonth.setDisable(working);
    buttonSelectPrevMonth.setDisable(working);
    buttonSelectNextMonth.setDisable(working);
    clearFilterButton.setDisable(working);

    filterBookingsLabel.setDisable(working);
    guestNameFilterInput.setDisable(working);
    tableView.setDisable(working);
    statusLabel.setDisable(working);
    guestNameFilterInput.setDisable(working);
    progressLabel.textProperty().unbind();
    progressBar.getScene().getRoot().setCursor(Cursor.DEFAULT);

}

From source file:de.bayern.gdi.gui.Controller.java

/**
 * Select a service according to service url textfield.
 *
 * @param downloadConf Loaded download config, null if a service is chosen
 *    from an URL or the service List/*w  w  w.j av a  2 s  . c  o m*/
 */
protected void doSelectService(DownloadConfig downloadConf) {
    log.info("Using download config: " + downloadConf);
    dataBean.resetSelectedService();
    serviceSelection.setDisable(true);
    serviceURL.getScene().setCursor(Cursor.WAIT);
    serviceURL.setDisable(true);
    resetGui();
    new Thread(() -> {
        try {
            ServiceModel serviceModel = (ServiceModel) serviceList.getSelectionModel().getSelectedItems()
                    .get(0);
            Service service = null;
            if (serviceModel != null && serviceModel.getUrl().toString().equals(serviceURL.getText())) {
                if (ServiceChecker.isReachable(serviceModel.getItem().getServiceURL())) {
                    service = serviceModel.getItem();
                    service.setPassword(servicePW.getText());
                    service.setUsername(serviceUser.getText());
                }
            } else {
                URL sURL = new URL(serviceURL.getText());
                if (ServiceChecker.isReachable(sURL)) {
                    service = new Service(sURL, "", true, serviceUser.getText(), servicePW.getText());
                }
            }
            if (service == null) {
                setStatusTextUI(I18n.format("status.service-timeout"));
                dataBean.setSelectedService(null);
                serviceSelection.setDisable(false);
                serviceURL.setDisable(false);
                serviceURL.getScene().setCursor(Cursor.DEFAULT);
                return;
            }
            serviceSelection.setDisable(true);
            serviceURL.getScene().setCursor(Cursor.WAIT);
            setStatusTextUI(I18n.format("status.checking-auth"));
            serviceURL.setDisable(true);
            Service finalService = service;
            Task task = new Task() {
                protected Integer call() {
                    try {
                        boolean serviceSelected = selectService(finalService);
                        if (serviceSelected) {
                            chooseSelectedService(downloadConf);
                        }
                        return 0;
                    } finally {
                        serviceSelection.setDisable(false);
                        serviceURL.getScene().setCursor(Cursor.DEFAULT);
                        serviceURL.setDisable(false);
                        validateChainContainerItems();
                    }
                }
            };
            Thread th = new Thread(task);
            th.setDaemon(true);
            th.start();
        } catch (MalformedURLException e) {
            setStatusTextUI(I18n.format("status.no-url"));
            log.error(e.getMessage(), e);
            serviceSelection.setDisable(false);
            serviceURL.getScene().setCursor(Cursor.DEFAULT);
            serviceURL.setDisable(false);
        }
    }).start();
}

From source file:de.dkfz.roddy.client.fxuiclient.RoddyUIController.java

private void switchExecutionStateProcessIndicator() {
    boolean runningTasks = RoddyUITask.getActiveTaskCount() > 0;
    executionService_activityIndicator.setVisible(runningTasks);
    if (runningTasks)
        App.instance.primaryStage.getScene().setCursor(Cursor.WAIT);
    else//from   w  ww .ja  va2 s . c om
        App.instance.primaryStage.getScene().setCursor(Cursor.DEFAULT);
}