/**
  * Updates the UI for the active Track.
  *
  * @param node
  */
 private void updateBlink(Node node) {
   if (node == null && lastBlinkNode != null) {
     lastBlinkNode.setOpacity(1);
     blink.stop();
   }
   if (lastBlinkNode == null || lastBlinkNode != node) {
     if (lastBlinkNode != null) {
       lastBlinkNode.setOpacity(1);
       blink.stop();
     }
     lastBlinkNode = node;
     blink = TransitionUtil.createBlink(node);
     blink.play();
   }
 }
Exemplo n.º 2
0
 /**
  * Method loadTableScene calls if login and password is correct, and do more beautiful change
  * scene.
  */
 public void loadTableScene() {
   stage = (Stage) userField.getScene().getWindow();
   Node node = root.lookup("#table");
   node.setOpacity(0);
   FadeTransition fadeTransition = new FadeTransition(Duration.seconds(2), node);
   fadeTransition.setToValue(1);
   fadeTransition.play();
   Scene scene = new Scene(root);
   stage.setScene(scene);
   stage.show();
 }
Exemplo n.º 3
0
  @Override
  protected Animation createAndPrepareAnimation(Node curNode, Node newNode) {
    newNode.setOpacity(1);

    double deltaX = -curNode.getBoundsInLocal().getWidth();
    newNode.setTranslateX(-deltaX);

    TranslateTransitionBuilder builder =
        TranslateTransitionBuilder.create()
            .interpolator(Interpolator.EASE_BOTH)
            .byX(deltaX)
            .duration(new Duration(1000));

    return ParallelTransitionBuilder.create()
        .children(builder.node(curNode).build(), builder.node(newNode).build())
        .build();
  }
 @Override
 protected void dataItemAdded(
     Series<String, Number> series, int itemIndex, Data<String, Number> item) {
   Node candle = createCandle(getData().indexOf(series), item, itemIndex);
   if (shouldAnimate()) {
     candle.setOpacity(0);
     getPlotChildren().add(candle);
     // fade in new candle
     FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
     ft.setToValue(1);
     ft.play();
   } else {
     getPlotChildren().add(candle);
   }
   // always draw average line on top
   if (series.getNode() != null) {
     series.getNode().toFront();
   }
 }
 @Override
 protected void seriesAdded(Series<String, Number> series, int seriesIndex) {
   // handle any data already in series
   for (int j = 0; j < series.getData().size(); j++) {
     Data item = series.getData().get(j);
     Node candle = createCandle(seriesIndex, item, j);
     if (shouldAnimate()) {
       candle.setOpacity(0);
       getPlotChildren().add(candle);
       // fade in new candle
       FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
       ft.setToValue(1);
       ft.play();
     } else {
       getPlotChildren().add(candle);
     }
   }
   // create series path
   Path seriesPath = new Path();
   seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
   series.setNode(seriesPath);
   getPlotChildren().add(seriesPath);
 }
Exemplo n.º 6
0
 private void toHiddenState() {
   state = State.HIDDEN;
   toAnimate.setVisible(false);
   toAnimate.setOpacity(1.0);
 }