@FXML
 void loadSelectedPlaylist() {
   Playlist p = (Playlist) playlistsView.getSelectionModel().getSelectedItem();
   if (p == null) return;
   tracksView.setPlaceholder(offlinePlaceHolder);
   Platform.runLater(
       () -> {
         List<Track> tracks = p.getTracks();
         tracksView.getItems().clear();
         for (int i = tracks.size() - 1; i >= 0; i--) {
           tracksView.getItems().add(tracks.get(i));
         }
         if (findTrack) {
           Platform.runLater(
               () -> {
                 tracksView.getSelectionModel().select(currentTrack);
                 tracksView.scrollTo(currentTrack);
                 tracksView.requestFocus();
                 findTrack = false;
               });
         } else {
           if (tracksView.getItems().size() > 0) {
             tracksView.scrollTo(0);
           }
         }
       });
 }
Beispiel #2
1
 private void initFooter() {
   webView.getEngine().load(BuildInfo.instance().getAdUrl());
   webView
       .getEngine()
       .locationProperty()
       .addListener(
           (observable, oldValue, newValue) -> {
             if (BuildInfo.instance().getAdUrl().equals(oldValue)) {
               application.getHostServices().showDocument(newValue);
             }
           });
   final Thread reloadThread =
       new Thread(
           () -> {
             while (true) {
               try {
                 Thread.sleep(60000);
                 javafx.application.Platform.runLater(
                     () -> {
                       webView.getEngine().reload();
                     });
               } catch (final Exception e) {
                 logger.log(Level.FINE, "Refresh failed", e);
               }
             }
           },
           "AdvReloader");
   reloadThread.setDaemon(true);
   reloadThread.start();
 }
Beispiel #3
0
 /**
  * Runs the runnable using Platform.runLater if the current thread is not on JavaFX Application
  * Thread.
  *
  * @param runnable runnable to run
  */
 public static void runThreadSafe(Runnable runnable) {
   if (!Platform.isFxApplicationThread()) {
     Platform.runLater(runnable);
   } else {
     runnable.run();
   }
 }
  public static void run(Runnable treatment) {
    if (treatment == null)
      throw new IllegalArgumentException("The treatment to perform can not be null");

    if (Platform.isFxApplicationThread()) treatment.run();
    else Platform.runLater(treatment);
  }
 @Test
 public void test7() throws Throwable {
   final CountDownLatch l = new CountDownLatch(1);
   Platform.runLater(
       () -> {
         final Stage t = new Stage();
         final Scene s = new Scene(new Group());
         t.setScene(s);
         t.show();
         final Stage p = new Stage();
         p.show();
         Platform.runLater(
             () -> {
               try {
                 p.setScene(s);
                 p.hide();
                 t.hide();
               } finally {
                 l.countDown();
               }
             });
       });
   l.await();
   if (exception != null) {
     throw exception;
   }
 }
 void addToPlaylist(List<File> files, Playlist p) {
   if (interfaceDisabled) return;
   new Thread(
           () -> {
             setInterfaceDisabled(true);
             int total = files.size();
             AtomicInteger current = new AtomicInteger(0);
             Cache.pushToPlaylist(
                 files,
                 p,
                 (Track t) -> {
                   Platform.runLater(
                       () -> {
                         infoLabel.setText(
                             String.format(
                                 res.getString("processed"),
                                 current.incrementAndGet(),
                                 total,
                                 t.getTitle()));
                         if (p == getSelectedPlaylist()) {
                           tracksView.getItems().remove(t);
                           tracksView.getItems().add(0, t);
                         }
                       });
                 });
             setInterfaceDisabled(false);
           })
       .start();
   if (p == getSelectedPlaylist()) {
     Platform.runLater(
         () -> {
           loadSelectedPlaylist();
         });
   }
 }
  public static void progress() {
    Platform.runLater(() -> splash.show());

    ProgressScreen progression = (ProgressScreen) splash;

    progression.setProgression(0);
    while (progression.getProgression() < 100) {
      progression.increaseProgression(1);

      if (progression.getProgression() < 101) progression.setTail("Conclude");
      if (progression.getProgression() < 95) progression.setTail("Take time to make it real");
      if (progression.getProgression() < 70) progression.setTail("Finalize");
      if (progression.getProgression() < 55) progression.setTail("Configure");
      if (progression.getProgression() < 35) progression.setTail("Copy");
      if (progression.getProgression() < 25) progression.setTail("Decompression");
      if (progression.getProgression() < 5) progression.setTail("Preparation phase");

      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
      }
    }

    Platform.runLater(() -> splash.hide());
  }
Beispiel #8
0
 @Override
 protected Void call() throws Exception {
   while (!isCancelled()) {
     Tweet tweet = tweetSetData.getNextOrRandomTweet(5, 10);
     if (null != tweet) {
       //                parents.put(createTweetInfoBox(tweets.take()));
       Platform.runLater(() -> wordle.setTweet(tweet));
       addTweetToCloud(tweet);
       Thread.sleep(3000);
       Platform.runLater(() -> wordle.setLayoutMode(Wordle.LayoutMode.TWEET));
       Thread.sleep(8000);
       Platform.runLater(() -> wordle.setLayoutMode(Wordle.LayoutMode.WORDLE));
       Thread.sleep(5000);
       //                removeTweetFromCloud(tweetWords);
       Platform.runLater(
           () ->
               wordle.setWords(
                   tweetSetData
                       .getTree()
                       .entrySet()
                       .stream()
                       .sorted(TweetSetData.COMPARATOR.reversed())
                       .limit(TagTweets.NUM_MAX_WORDS)
                       .map(
                           (java.util.Map.Entry<String, Long> entry) ->
                               new Word(entry.getKey(), entry.getValue()))
                       .collect(Collectors.toList())));
       Thread.sleep(5000);
     }
   }
   return null;
 }
 private synchronized void reload() {
   if (!initialized) {
     executorService.submit(
         () -> {
           if (!super.getChildren().isEmpty()) {
             Platform.runLater(super.getChildren()::clear);
           }
           List<ShareNotificationMessage> removedShares = new LinkedList<>();
           for (ShareNotificationMessage message : notifications.getNotifications()) {
             try {
               final TreeItem<BoxObject> item = itemFromNotification(message);
               Platform.runLater(() -> super.getChildren().add(item));
             } catch (QblStorageNotFound e) {
               removedShares.add(message);
             } catch (Exception e) {
               logger.error("failed to load FM", e);
             }
           }
           for (ShareNotificationMessage message : removedShares) {
             notifications.remove(message);
           }
         });
     initialized = true;
   }
 }
  public void setNicknameFree(boolean nicknameFree) {
    isNicknameFree = nicknameFree;
    if (nicknameFree) {
      Platform.runLater(
          new Runnable() {
            @Override
            public void run() {
              registerController.freeUser.setText("Nick Libero");
              registerController.setNickFree(true);
              registerStage.hide();
              registerStage.close();
              //  clientController.launchToMessagging();
              clientController.clientConnectButton.setVisible(false);
              clientController.welcomeLabel.setText(
                  "Benvenuto," + clientThread.getUser().getNickname() + "!");
              clientController.registerButton.setVisible(false);
              clientController.registerButton.setDisable(true);
            }
          }); // primarystage.close (in runlater)

    } else {
      Platform.runLater(
          new Runnable() {
            @Override
            public void run() {
              registerController.setNickFree(false);
              registerController.nicknameField.clear();
              clientController.launchToMessagging();
            }
          });
    }
  }
  private void asyncButtonHandler(ActionEvent event) {

    this.asyncButton.setDisable(true);
    this.asyncLabel.setText(
        String.format("started at %s", LocalTime.now().format(JavaFXClass.TIME_FORMATTER)));

    new Thread(
            () -> {
              Future<LocalTime> task = this.asyncExecutor.submit(this::asyncTask);

              try {
                LocalTime finished = task.get(JavaFXClass.ASYNC_SECONDS_ABORT, TimeUnit.SECONDS);

                Platform.runLater(
                    () -> {
                      this.asyncLabel.setText(
                          String.format(
                              "finished at %s", finished.format(JavaFXClass.TIME_FORMATTER)));
                      this.asyncButton.setDisable(false);
                    });

              } catch (TimeoutException ex) {
                Platform.runLater(
                    () -> {
                      this.asyncLabel.setText(
                          String.format("aborted after %ss", JavaFXClass.ASYNC_SECONDS_ABORT));
                      this.asyncButton.setDisable(false);
                    });

              } catch (ExecutionException | InterruptedException ex) {
                ex.printStackTrace();
              }
            })
        .start();
  }
  @Override
  public synchronized void setFile(final Long fileID) {
    if (Objects.equals(fileID, this.fileID) == false) {
      this.fileID = fileID;
      disposeContent();

      if (this.fileID == null || Case.isCaseOpen() == false) {
        if (registered == true) {
          ImageGalleryController.getDefault().getCategoryManager().unregisterListener(this);
          TagUtils.unregisterListener(this);
          registered = false;
        }
        file = null;
        Platform.runLater(
            () -> {
              clearContent();
            });
      } else {
        if (registered == false) {
          ImageGalleryController.getDefault().getCategoryManager().registerListener(this);
          TagUtils.registerListener(this);
          registered = true;
        }
        file = null;
        getFile();
        updateSelectionState();
        updateCategoryBorder();
        updateFollowUpIcon();
        updateUI();
        Platform.runLater(getContentUpdateRunnable());
      }
    }
  }
  @FXML
  public void initialize() {

    // Needed to support tri-state capability
    reconciledButton.setAllowIndeterminate(true);

    // Number combo needs to know the account in order to determine the next transaction number
    numberComboBox.accountProperty().bind(accountProperty());

    AutoCompleteFactory.setMemoModel(memoTextField);

    accountProperty.addListener(
        (observable, oldValue, newValue) -> {
          // Set the number of fixed decimal places for entry
          amountField.scaleProperty().set(newValue.getCurrencyNode().getScale());

          // Enabled auto completion for the payee field
          if (payeeTextField != null) { // transfer slips do not use the payee field
            AutoCompleteFactory.setPayeeModel(payeeTextField, newValue);
          }
        });

    // If focus is lost, check and load the form with an existing transaction
    if (payeeTextField != null) { // transfer slips do not use the payee field
      payeeTextField
          .focusedProperty()
          .addListener(
              (observable, oldValue, newValue) -> {
                if (!newValue) {
                  handlePayeeFocusChange();
                }
              });
    }

    // Install an event handler when the parent has been set via injection
    parentProperty.addListener(
        (observable, oldValue, newValue) -> {
          newValue.addEventHandler(
              KeyEvent.KEY_PRESSED,
              event -> {
                if (JavaFXUtils.ESCAPE_KEY.match(
                    event)) { // clear the form if an escape key is detected
                  clearForm();
                } else if (JavaFXUtils.ENTER_KEY.match(event)) { // handle an enter key if detected
                  if (validateForm()) {
                    Platform.runLater(AbstractSlipController.this::handleEnterAction);
                  } else {
                    Platform.runLater(
                        () -> {
                          if (event.getSource() instanceof Node) {
                            JavaFXUtils.focusNext((Node) event.getSource());
                          }
                        });
                  }
                }
              });
        });
  }
 public static void setCsg(List<CSG> toadd, File source) {
   Platform.runLater(
       () -> {
         getBowlerStudio().jfx3dmanager.removeObjects();
         if (toadd != null)
           for (CSG c : toadd) {
             Platform.runLater(() -> getBowlerStudio().jfx3dmanager.addObject(c, source));
           }
       });
 }
 public MenuPrincipalController() {
   Platform.runLater(
       () -> {
         cargarVistaPopUp();
       });
   Platform.runLater(
       () -> {
         cargarVistaPartida();
       });
 }
 // <editor-fold defaultstate="collapsed" desc="Region HANDLERS AND EVENTS">
 public void btnNuevaPartidaActionHandler(ActionEvent event) {
   final Stage popUpStage = new Stage();
   Platform.runLater(
       () -> {
         configPopUpWindow(popUpStage); // Armo la ventana del popup
       });
   Platform.runLater(
       () -> {
         configPartidaWindow(popUpStage); // Cargo la partida y luego los datos de la ventana
       });
 }
 @BeforeClass
 public static void setUpClass() throws Exception {
   Platform.setImplicitExit(false);
   try {
     Platform.runLater(() -> {});
   } catch (IllegalStateException e) {
     startPlatform();
   } catch (Exception e) {
     e.printStackTrace();
     startPlatform();
   }
 }
  public void init() {
    this.tcRef.add(this, BorderLayout.CENTER);

    Platform.setImplicitExit(false);
    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            createScene();
          }
        });
  }
Beispiel #19
0
  public boolean isOkPressed(int typeSignal) {
    ((StageLoader) btnOK.getScene().getWindow()).setMethod(() -> btnOK());
    if (tuSignal == null) return false;
    Stage w = (Stage) btnOK.getScene().getWindow();

    if (typeSignal == 3) {
      List<SpTuCommand> tuCommands =
          SingleFromDB.spTuCommands
              .stream()
              .filter(f -> f.getObjref() == tuSignal.getStateref())
              .collect(Collectors.toList());
      ChoiceBox<SpTuCommand> chBox = new ChoiceBox<>();
      tuCommands.forEach(chBox.getItems()::add);
      chBox
          .getSelectionModel()
          .selectedItemProperty()
          .addListener(
              (observ, oldValue, newValue) -> {
                value = newValue.getVal() + "";
              });
      if (chBox.getItems().size() > 0) chBox.getSelectionModel().selectFirst();
      if (SingleObject.selectedShape.getValueProp().get()
          == chBox.getSelectionModel().getSelectedItem().getVal()) {
        chBox.getSelectionModel().selectNext();
      }
      Platform.runLater(() -> chBox.requestFocus());
      bpTU.setCenter(chBox);
    } else if (typeSignal == 1) {
      TextField txtField = new TextField();
      txtField.setText(SingleObject.selectedShape.getValueProp().get() + "");
      txtField
          .textProperty()
          .addListener(
              (observ, oldValue, newValue) -> {
                try {
                  Double.parseDouble(newValue);
                  value = newValue;
                } catch (Exception e) {
                  txtField.setText(oldValue);
                }
              });
      Platform.runLater(() -> txtField.requestFocus());
      bpTU.setCenter(txtField);
    } else {
      System.out.println("=====   This is not TU or TI   =====");
    }
    w.showAndWait();

    return isOkClicked;
  }
  private Button getNonBreakingLineButton() {
    Button ret =
        new Button(
            "", new ImageView(new Image("file:icons/nonbreakline.png", 24, 24, false, true)));
    Utils.setToolbarButtonStyle(ret);
    ret.setTooltip(new Tooltip(LabelGrabber.INSTANCE.getLabel("nonbreak.tooltip")));
    ret.setOnAction(
        (event) -> {
          int caretPos = lyricsArea.getArea().getCaretPosition();
          String[] parts = lyricsArea.getText().split("\n");
          int lineIndex = lineFromPos(lyricsArea.getText(), caretPos);
          String line = parts[lineIndex];
          if (line.trim().isEmpty()) {
            Platform.runLater(
                new Runnable() {

                  @Override
                  public void run() {
                    lyricsArea.getArea().replaceText(caretPos, caretPos, "<>");
                    lyricsArea.getArea().refreshStyle();
                  }
                });
          } else {
            int nextLinePos = nextLinePos(lyricsArea.getText(), caretPos);
            if (nextLinePos >= lyricsArea.getText().length()) {
              Platform.runLater(
                  new Runnable() {

                    @Override
                    public void run() {
                      lyricsArea.getArea().replaceText(nextLinePos, nextLinePos, "\n<>\n");
                      lyricsArea.getArea().refreshStyle();
                    }
                  });
            } else {
              Platform.runLater(
                  new Runnable() {

                    @Override
                    public void run() {
                      lyricsArea.getArea().replaceText(nextLinePos, nextLinePos, "<>\n");
                      lyricsArea.getArea().refreshStyle();
                    }
                  });
            }
          }
        });
    return ret;
  }
 public static void estimateKeyDerivationTime() {
   // This is run in the background after startup. If we haven't recorded it before, do a key
   // derivation to see
   // how long it takes. This helps us produce better progress feedback, as on Windows we don't
   // currently have a
   // native Scrypt impl and the Java version is ~3 times slower, plus it depends a lot on CPU
   // speed.
   checkGuiThread();
   estimatedKeyDerivationTime = Main.instance.prefs.getExpectedKeyDerivationTime();
   if (estimatedKeyDerivationTime == null) {
     new Thread(
             () -> {
               log.info("Doing background test key derivation");
               KeyCrypterScrypt scrypt = new KeyCrypterScrypt(SCRYPT_PARAMETERS);
               long start = System.currentTimeMillis();
               scrypt.deriveKey("test password");
               long msec = System.currentTimeMillis() - start;
               log.info("Background test key derivation took {}msec", msec);
               Platform.runLater(
                   () -> {
                     estimatedKeyDerivationTime = Duration.ofMillis(msec);
                     Main.instance.prefs.setExpectedKeyDerivationTime(estimatedKeyDerivationTime);
                   });
             })
         .start();
   }
 }
Beispiel #22
0
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    albumList = FXCollections.observableArrayList();
    playlistList = FXCollections.observableArrayList();
    fileList = new ArrayList<>();

    // obs³uga zamykania okna
    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            root.getScene()
                .getWindow()
                .setOnCloseRequest(
                    e -> {
                      clearData();
                    });
          }
        });

    // wczytanie albumów i playlist
    loadAlbums();
    loadPlaylists();

    // domyœlnie pokazuje albumy
    drawAlbums();
    addPlaylistButton.disableProperty().set(true);
  }
  private JInternalFrame _startJFXImpuestosCRUD() {
    frame = new JInternalFrame("Administrador de impuestos");
    final JFXPanel fxPanel = new JFXPanel();

    frame.setClosable(true);
    frame.add(fxPanel);
    frame.setVisible(true);

    Herramientas.panelCatalogo(frame);
    Principal.getEscritorio().getPanelEscritorio().add(frame);
    frame.setSize(706, 518);
    frame.setPreferredSize(new Dimension(706, 518));
    frame.setResizable(true);
    frame.setVisible(true);
    Herramientas.centrarVentana(frame);
    Herramientas.iconificable(frame);
    frame.toFront();

    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            Scene scene = null;
            try {
              scene = initImpuestosCRUD();
              scene.setFill(null);
              fxPanel.setScene(scene);
            } catch (IOException e) {

            }
          }
        });

    return frame;
  }
  @FXML
  private void initialize() {
    deleteButton.setDisable(true);
    reconcileButton.setDisable(true);

    initializeTreeTableView();

    Platform.runLater(this::loadAccountTree);

    MessageBus.getInstance()
        .registerListener(
            this, MessageChannel.SYSTEM, MessageChannel.ACCOUNT, MessageChannel.TRANSACTION);

    // Register invalidation listeners to force a reload
    typeFilter.addListener(observable -> reload());

    selectedAccountProperty.addListener(
        (observable, oldValue, newValue) -> {
          updateButtonStates();
        });

    modifyButton.disableProperty().bind(selectedAccountProperty.isNull());

    AccountBalanceDisplayManager.getAccountBalanceDisplayModeProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              treeTableView.refresh();
            });
  }
  /**
   * The stop method is the opposite of the start method. It provides an opportunity to close down
   * the program, including GUI components. If the start method has never been called, the stop
   * method may or may not be called.
   *
   * <p>Make the GUI invisible first. This prevents the user from taking any actions while the
   * program is ending.
   */
  @Override
  public void stop() {
    if (serverStage != null) {
      // Make the view invisible
      // Commented because of errors - serviceLocator.getLogger().info("Server-GUI wird beendet");
      // // HIIIER Kommt wohl kein check durch - ist es wirklich view den wir prüfen müssen??
      serverStage.hide();
    }
    if (serverStage != null) {
      Platform.exit(); // Ends all JavaFX activities
      System.exit(0); // Ends all Programm activities
    }

    serviceLocator.getLogger().info("nach dem if vom Server_Template stopp");
    serviceLocator
        .setChangeValueWindowIsActive(); // Changes the ServiceLocator Value for WindowIsActive to
    // false so that the thread ShowTimeInWindow() stops

    // More cleanup code as needed

    serviceLocator
        .getLogger()
        .info("Application terminated"); // Wieso wird diese Message jetzt mit "appStage.hide();"
    // nicht mehr angezeigt?
  }
Beispiel #26
0
  @Override
  public void start(Stage primaryStage) {
    this.primaryStage = primaryStage;
    ApplicationContextHolder.getContext();
    startLogAppender();
    Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionLogger());
    primaryStage.setScene(initScene());
    primaryStage
        .getIcons()
        .addAll(ApplicationContextHolder.getContext().getBeansOfType(Image.class).values());
    primaryStage.setTitle(ApplicationContextHolder.getContext().getBean(Pdfsam.class).name());
    primaryStage.setOnCloseRequest(e -> Platform.exit());
    initWindowsStatusController(primaryStage);
    initOverwriteDialogController(primaryStage);
    initActiveModule();
    primaryStage.show();

    requestCheckForUpdateIfNecessary();
    requestLatestNewsPanelDisplay();
    eventStudio().addAnnotatedListeners(this);
    closeSplash();
    STOPWATCH.stop();
    LOG.info(
        DefaultI18nContext.getInstance()
            .i18n(
                "Started in {0}",
                DurationFormatUtils.formatDurationWords(STOPWATCH.getTime(), true, true)));
  }
Beispiel #27
0
  private void platformRunNow(final Runnable runnable) {
    final boolean[] done = new boolean[1];
    final Runnable sync =
        new Runnable() {

          @Override
          public void run() {
            logger.log(Level.FINE, "platformRunNow run start");
            runnable.run();
            done[0] = true;
            logger.log(Level.FINE, "platformRunNow run complete");
            synchronized (this) {
              this.notify();
            }
          }
        };
    javafx.application.Platform.runLater(sync);
    logger.log(Level.FINE, "platformRunNow wait start");
    synchronized (sync) {
      while (!done[0]) {
        try {
          sync.wait();
        } catch (final InterruptedException e) {
          logger.log(Level.WARNING, e.getMessage(), e);
        }
      }
    }
    logger.log(Level.FINE, "platformRunNow wait complete");
  }
Beispiel #28
0
  @Override
  public void afterShow() {
    final boolean autostart =
        Boolean.parseBoolean(application.getParameters().getNamed().get("autostart"));
    if (autostart) {
      javafx.application.Platform.runLater(
          () -> {
            final Alert dialog = new Alert(AlertType.INFORMATION);
            dialog.initOwner(application.getPrimaryStage());
            dialog.setHeaderText("Autostart in 10 seconds. Close this dialog to cancel");
            dialog.show();
            final Task<Void> sleeper =
                new Task<Void>() {

                  @Override
                  protected Void call() throws Exception {
                    try {
                      Thread.sleep(10000);
                    } catch (final Exception e) {
                      logger.log(Level.SEVERE, e.getMessage(), e);
                    }
                    return null;
                  }
                };
            sleeper.setOnSucceeded(
                event -> {
                  if (dialog.isShowing()) {
                    dialog.close();
                    startButton.fire();
                  }
                });
            new Thread(sleeper, "autostartThread").start();
          });
    }
  }
  public void userLogged(String serPrefs) {

    Gson gs = new Gson();
    prefs = gs.fromJson(serPrefs, Preferences.class);
    clientThread.setUser(prefs.getUser());
    Platform.runLater(
        new Runnable() {
          @Override
          public void run() {
            loginStage.hide();
            loginStage.close();
            /*   clientController.welcomeLabel.setText("Bentornato, "+prefs.getUser().getNickname());
            clientController.launchToMessagging();
            clientController.regLabel.setVisible(false);
            clientController.loginButton.setText("LOGOUT");
            clientController.registerButton.setVisible(false);
            clientController.registerButton.setDisable(true); */
            isClientLogged = true;
            clientController.loginButton.setDisable(true);
            clientController.registerButton.setDisable(true);
            clientController.clientConnectButton.setVisible(false);
            clientController.welcomeLabel.setFont(robo);
            clientController.welcomeLabel.setText(
                "Bentornato, " + prefs.getUser().getNickname() + "!");
            clientController.scuolaBox.setSelected(prefs.isScuola());
            clientController.makingBox.setSelected(prefs.isMaking());
            clientController.religioneBox.setSelected(prefs.isReligione());
            clientController.promozione_territorioBox.setSelected(prefs.isPromozione_territorio());
            clientController.donazione_sangueBox.setSelected(prefs.isDonazione_sangue());
            clientController.anzianiBox.setSelected(prefs.isAnziani());
            clientController.tasseBox.setSelected(prefs.isTasse());
          }
        });
  }
  @Override
  public void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);
    if (item == null) {
      setGraphic(null);
      setText(null);
    } else {
      if (item.toString().equalsIgnoreCase("Processing")) {
        Platform.runLater(
            new Runnable() {
              @Override
              public void run() {

                if (getGraphic() == null) {
                  setGraphic(progressBar);
                  progressBar.setProgress(-1);
                } else {
                  ProgressBar objpProgressBar = (ProgressBar) getGraphic();
                  objpProgressBar.setProgress(-1);
                }
                setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
              }
            });
      }
    }
  }