示例#1
1
 @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);
           }
         }
       });
 }
示例#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();
 }
示例#3
0
  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());
  }
  @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());
      }
    }
  }
  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();
  }
示例#7
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;
   }
 }
 @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;
   }
 }
示例#10
0
 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();
         });
   }
 }
  @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
       });
 }
示例#15
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;
  }
示例#17
0
 public void updateJointNumber(int jointNumber, int newPosition) {
   Platform.runLater(
       new Runnable() {
         @Override
         public void run() {
           switch (jointNumber) {
             case 0:
               updateBasePosition(newPosition);
               break;
             case 1:
               updateShoulderPosition(newPosition);
               break;
             case 2:
               updateElbowPosition(newPosition);
               break;
             case 3:
               updateWristOnePosition(newPosition);
               break;
             case 4:
               updateWristTwoPosition(newPosition);
               break;
             case 5:
               updateWristThreePosition(newPosition);
               break;
           }
         }
       });
 }
示例#18
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();
   }
 }
示例#19
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();
          });
    }
  }
示例#20
0
  @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);
              }
            });
      }
    }
  }
  private void initComponents() {
    Platform.runLater(
        () -> {
          myPane = new StackPane();
          myWebComponent = new WebView();
          myEngine = myWebComponent.getEngine();

          if (myShowProgress) {
            myProgressBar = makeProgressBarWithListener();
            myWebComponent.setVisible(false);
            myPane.getChildren().addAll(myWebComponent, myProgressBar);
          } else {
            myPane.getChildren().add(myWebComponent);
          }
          if (myLinkInNewBrowser) {
            initHyperlinkListener();
          }
          Scene scene = new Scene(myPane);
          myPanel.setScene(scene);
          myPanel.setVisible(true);
          updateLaf(
              LafManager.getInstance().getCurrentLookAndFeel() instanceof DarculaLookAndFeelInfo);
        });

    add(myPanel, BorderLayout.CENTER);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  }
  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());
          }
        });
  }
示例#23
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");
  }
 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();
   }
 }
 @SuppressWarnings("unchecked")
 @Override
 public void onScriptFinished(Object result, Object Previous, File source) {
   Log.warning("Loading script results " + result + " previous " + Previous);
   // this is added in the script engine when the connection manager is
   // loaded
   Platform.runLater(
       () -> {
         jfx3dmanager.removeObjects();
       });
   ThreadUtil.wait(20);
   if (ArrayList.class.isInstance(Previous)) {
     ArrayList<Object> c = (ArrayList<Object>) Previous;
     for (int i = 0; i < c.size(); i++) {
       removeObject(c.get(i));
     }
   } else {
     removeObject(Previous);
   }
   if (ArrayList.class.isInstance(result)) {
     ArrayList<Object> c = (ArrayList<Object>) result;
     for (int i = 0; i < c.size(); i++) {
       Log.warning("Loading array Lists with removals " + c.get(i));
       addObject(c.get(i), source);
     }
   } else {
     addObject(result, source);
   }
 }
示例#26
0
  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();
            });
  }
示例#28
0
  @Subscribe
  public synchronized void onSocketPreviewChanged(SocketPreviewChangedEvent event) {
    Platform.runLater(
        () -> {
          final OutputSocket<?> socket = event.getSocket();

          if (socket.isPreviewed()) {
            // If the socket was just set as previewed, add it to the list of previewed sockets and
            // add a new view for it.
            if (!this.previewedSockets.contains(socket)) {
              this.previewedSockets.add(socket);
              this.previewBox
                  .getChildren()
                  .add(SocketPreviewViewFactory.createPreviewView(this.eventBus, socket));
            }
          } else {
            // If the socket was just set as not previewed, remove both it and the corresponding
            // control
            int index = this.previewedSockets.indexOf(socket);
            if (index != -1) {
              this.previewedSockets.remove(index);
              this.eventBus.unregister(this.previewBox.getChildren().remove(index));
            }
          }
        });
  }
示例#29
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);
  }
示例#30
0
 @Test
 public void testCreateBroker() {
   System.out.println("testCreateBroker");
   Platform.runLater(
       new Runnable() {
         @Override
         public void run() {
           synchronized (lock) {
             // Setup
             act = new ChildActivity();
             act.setScene(new HBox());
             Response response = new Response();
             response.setStatus(Status.OK);
             response.setActivity(act);
             browser.getBrowserPanel().receiveResponse(response);
           }
         }
       });
   try {
     Thread.sleep(100);
   } catch (InterruptedException ex) {
     ex.printStackTrace();
   }
   synchronized (lock) {
     assertNotNull(act.createBroker());
   }
 }