Example usage for javafx.util Duration millis

List of usage examples for javafx.util Duration millis

Introduction

In this page you can find the example usage for javafx.util Duration millis.

Prototype

double millis

To view the source code for javafx.util Duration millis.

Click Source Link

Document

The value of this duration, in fractional milliseconds

Usage

From source file:caillou.company.clonemanager.gui.customComponent.location.LocationController.java

@Override
public void initialize(URL url, ResourceBundle rb) {

    this.disabledProperty().bind(getModel().disabledProperty());
    final LocationController thisInstance = this;
    this.updatedProperty().addListener(new ChangeListener<Boolean>() {

        @Override/*from  ww w. j  a  v a  2  s.  c  o m*/
        public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
            getModel().updateLocation(thisInstance.getPath(), thisInstance.getGroup().getValue());
        }
    });

    this.getModel().getEventBus().register(this);

    LocationsModel locationsModel = mainModel.getLocationsModel();
    groupId.visibleProperty().bind(locationsModel.enableGroupingProperty());
    groupId.managedProperty().bind(locationsModel.enableGroupingProperty());
    groupId.getItems().add(Group.GROUPA);
    groupId.getItems().add(Group.GROUPB);

    path.textProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            boolean disableExclusion = true;
            if (newValue != null && !newValue.equals("")) {
                File file = new File(newValue);
                if (file.exists() && file.isDirectory()) {
                    disableExclusion = false;
                }
            }
            filterButtonId.setDisable(disableExclusion);
            updated.set(!updated.get());
        }
    });

    groupId.valueProperty().addListener(new ChangeListener<Group>() {
        @Override
        public void changed(ObservableValue<? extends Group> observable, Group oldValue, Group newValue) {
            updated.set(!updated.get());
        }
    });

    disabledProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            path.setDisable(newValue);
            groupId.setDisable(newValue);
            button.setDisable(newValue);
        }

    });

    filterButtonId.setDisable(true);

    /**
     * Due to the bug
     * "https://bitbucket.org/controlsfx/controlsfx/issue/185/nullpointerexception-when-using-popover"
     */
    MainApp.getInstance().getStage().setOnCloseRequest(new EventHandler<WindowEvent>() {
        @Override
        public void handle(WindowEvent event) {
            errorPopOver.hide(Duration.millis(0));
        }
    });
    /**
     * End *
     */

}

From source file:caillou.company.clonemanager.gui.customComponent.results.ResultController.java

@Override
public void initialize(URL location, ResourceBundle resources) {
    this.guiApplicationFileListFiltered = new FilteredList<>(guiApplicationFileList);
    this.initializePhaseAutomaticResizing();
    this.initializeContextDependant();

    SortedList<GUIApplicationFile> sortedList = new SortedList<>(guiApplicationFileListFiltered);
    // Bind the SortedList comparator to the TableView comparator.
    sortedList.comparatorProperty().bind(resultViewId.comparatorProperty());

    resultViewId.setItems(sortedList);//from  w ww .ja  va  2 s  .c o m
    resultViewId.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    this.filterList(guiApplicationFileListFiltered);
    this.initializeFilter();
    this.initializeRowFactory();

    this.initializeStatistic();

    accordionPaneId.setExpandedPane(informationPaneId);

    groupId.getItems().add(Group.GROUPA);
    groupId.getItems().add(Group.GROUPB);
    groupId.setValue(Group.GROUPA);

    /**
     * Due to the bug
     * "https://bitbucket.org/controlsfx/controlsfx/issue/185/nullpointerexception-when-using-popover"
     */
    MainApp.getInstance().getStage().setOnCloseRequest(new EventHandler<WindowEvent>() {
        @Override
        public void handle(WindowEvent event) {
            if (popOver != null) {
                popOver.hide(Duration.millis(0));
            }
        }
    });
    /**
     * End *
     */
}

From source file:com.github.naoghuman.testdata.abclist.service.ExerciseService.java

@Override
public void start() {
    final SequentialTransition sequentialTransition = new SequentialTransition();

    final PauseTransition ptProgressBarInformation = new PauseTransition();
    ptProgressBarInformation.setDuration(Duration.millis(250.0d));
    ptProgressBarInformation.setOnFinished((ActionEvent event) -> {
        presenter.setProgressBarInformation(onStartMessage);
    });/*ww w.  jav  a  2  s .c  o  m*/
    sequentialTransition.getChildren().add(ptProgressBarInformation);

    final PauseTransition ptStart = new PauseTransition();
    ptStart.setDuration(Duration.millis(1000.0d));
    ptStart.setOnFinished((ActionEvent event) -> {
        super.start();
    });
    sequentialTransition.getChildren().add(ptStart);

    sequentialTransition.playFromStart();
}

From source file:mesclasses.view.RootLayoutController.java

private void displayNotification(int type, String texte) {
    notificationMessageLabel.setText(texte);
    notificationPane.getStyleClass().clear();
    CssUtil.removeClass(deleteNotifBtn, "notif-warning");
    CssUtil.removeClass(deleteNotifBtn, "notif-error");
    Double timeDisplayed = 3.0D;//from  ww w . j a v a 2s. c om
    switch (type) {
    case MessageEvent.SUCCESS:
        CssUtil.addClass(notificationPane, "notif-success");
        deleteNotifBtn.setManaged(false);
        deleteNotifBtn.setVisible(false);
        notificationTitleLabel.setText("SUCCES");
        break;
    case MessageEvent.WARNING:
        CssUtil.addClass(notificationPane, "notif-warning");
        CssUtil.addClass(deleteNotifBtn, "notif-warning");
        notificationTitleLabel.setText("ATTENTION");
        break;
    case MessageEvent.ERROR:
        CssUtil.addClass(notificationPane, "notif-error");
        CssUtil.addClass(deleteNotifBtn, "notif-error");
        notificationTitleLabel.setText("ERREUR");
        timeDisplayed = 0.0;
        break;
    }
    notificationPane.setManaged(true);
    notificationPane.setVisible(true);

    if (timeDisplayed > 0.0) {
        FadeTransition ft = new FadeTransition(Duration.millis(150), notificationPane);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.play();
        Timeline timeline = new Timeline();
        timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(timeDisplayed), (ActionEvent event) -> {
            FadeTransition ft2 = new FadeTransition(Duration.millis(150), notificationPane);
            ft2.setFromValue(1.0);
            ft2.setToValue(0.0);
            ft2.setCycleCount(1);
            ft2.play();
            ft2.setOnFinished((ActionEvent event1) -> {
                notificationPane.setManaged(false);
                notificationPane.setVisible(false);
            });

        }));
        timeline.play();
    }
}

From source file:caillou.company.clonemanager.gui.customComponent.results.ResultController.java

@FXML
private void backAction(ActionEvent event) throws Exception {
    /**//  ww  w  .  jav a  2  s  .  c  om
     * Due to the bug
     * "https://bitbucket.org/controlsfx/controlsfx/issue/185/nullpointerexception-when-using-popover"
     */
    if (popOver != null) {
        popOver.hide(Duration.millis(0));
    }
    /**
     * End *
     */
    MainApp app = MainApp.getInstance();
    mainModel.resetLocationsModel();
    mainModel.resetCritereModel();
    app.replaceSceneContent(Navigation.SEARCH_VIEW, WindowsPreferredDimensions.SEARCH_VIEW_WIDTH,
            WindowsPreferredDimensions.SEARCH_VIEW_HEIGHT);
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void animateDisplay() {
    gridPane.setOpacity(0);/*from  w w w  . jav a2  s. c o m*/
    Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
    double duration = getDuration(400);
    Timeline timeline = new Timeline();
    ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();

    if (type.animationType == AnimationType.SlideDownFromCenterTop) {
        double startY = -gridPane.getHeight();
        keyFrames
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                        new KeyValue(gridPane.translateYProperty(), startY, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                new KeyValue(gridPane.translateYProperty(), -10, interpolator)));
    } else if (type.animationType == AnimationType.ScaleFromCenter) {
        double startScale = 0.25;
        keyFrames
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                        new KeyValue(gridPane.scaleXProperty(), startScale, interpolator),
                        new KeyValue(gridPane.scaleYProperty(), startScale, interpolator)

        ));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                new KeyValue(gridPane.scaleXProperty(), 1, interpolator),
                new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
    } else if (type.animationType == AnimationType.ScaleYFromCenter) {
        double startYScale = 0.25;
        keyFrames
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                        new KeyValue(gridPane.scaleYProperty(), startYScale, interpolator)

        ));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
    } else if (type.animationType == AnimationType.ScaleDownToCenter) {
        double startScale = 1.1;
        keyFrames
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                        new KeyValue(gridPane.scaleXProperty(), startScale, interpolator),
                        new KeyValue(gridPane.scaleYProperty(), startScale, interpolator)

        ));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                new KeyValue(gridPane.scaleXProperty(), 1, interpolator),
                new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
    } else if (type.animationType == AnimationType.FadeInAtCenter) {
        keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 0, interpolator)

        ));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
    }

    timeline.play();
}

From source file:ijfx.ui.plugin.overlay.OverlayPanel.java

public void onGearClicked(MouseEvent e) {
    if (!optionsPane.isShowing()) {
        RotateTransition rotate = new RotateTransition(Duration.millis(500), gearIcon);
        rotate.setByAngle(180);/*from  w  w w .  ja v a  2 s  .  com*/
        rotate.play();
        optionsPane.show(gearIcon);
    } else {
        RotateTransition rotate = new RotateTransition(Duration.millis(500), gearIcon);
        rotate.setByAngle(-180);
        rotate.play();
        optionsPane.hide();
    }

    e.consume();
}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void animateHide(Runnable onFinishedHandler) {
    Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
    double duration = getDuration(200);
    Timeline timeline = new Timeline();
    ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();

    if (type.animationType == AnimationType.SlideDownFromCenterTop) {
        double endY = -gridPane.getHeight();
        keyFrames/*w  w w .  j a  va  2s  . c  o  m*/
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                        new KeyValue(gridPane.translateYProperty(), -10, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                new KeyValue(gridPane.translateYProperty(), endY, interpolator)));

        timeline.setOnFinished(e -> onFinishedHandler.run());
        timeline.play();
    } else if (type.animationType == AnimationType.ScaleFromCenter) {
        double endScale = 0.25;
        keyFrames
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                        new KeyValue(gridPane.scaleXProperty(), 1, interpolator),
                        new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                new KeyValue(gridPane.scaleXProperty(), endScale, interpolator),
                new KeyValue(gridPane.scaleYProperty(), endScale, interpolator)));
    } else if (type.animationType == AnimationType.ScaleYFromCenter) {
        gridPane.setRotationAxis(Rotate.X_AXIS);
        gridPane.getScene().setCamera(new PerspectiveCamera());
        keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.rotateProperty(), 0, interpolator),
                new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.rotateProperty(), -90, interpolator),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
    } else if (type.animationType == AnimationType.ScaleDownToCenter) {
        double endScale = 0.1;
        keyFrames
                .add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator),
                        new KeyValue(gridPane.scaleXProperty(), 1, interpolator),
                        new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator),
                new KeyValue(gridPane.scaleXProperty(), endScale, interpolator),
                new KeyValue(gridPane.scaleYProperty(), endScale, interpolator)));
    } else if (type.animationType == AnimationType.FadeInAtCenter) {
        keyFrames.add(
                new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration),
                new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
    }

    timeline.setOnFinished(e -> onFinishedHandler.run());
    timeline.play();
}

From source file:com.bekwam.resignator.ResignatorAppMainViewController.java

@FXML
public void showConsole(ActionEvent evt) {

    CheckMenuItem mi = (CheckMenuItem) evt.getSource();

    if (logger.isDebugEnabled()) {
        logger.debug("[SHOW] show={}", mi.isSelected());
    }/*w  w  w.  j a v  a  2 s.com*/

    if (mi.isSelected() && !sp.getItems().contains(console)) {
        if (logger.isDebugEnabled()) {
            logger.debug("[SHOW] adding console region");
        }

        console.setOpacity(0.0d);

        sp.getItems().add(console);

        FadeTransition ft = new FadeTransition(Duration.millis(400), console);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.setAutoReverse(false);
        ft.play();

        return;
    }

    if (!mi.isSelected() && sp.getItems().contains(console)) {

        if (logger.isDebugEnabled()) {
            logger.debug("[SHOW] removing console region");
        }

        FadeTransition ft = new FadeTransition(Duration.millis(300), console);
        ft.setFromValue(1.0);
        ft.setToValue(0.1);
        ft.setCycleCount(1);
        ft.setAutoReverse(false);
        ft.play();

        ft.setOnFinished((e) -> sp.getItems().remove(console));
    }
}

From source file:com.bekwam.resignator.ResignatorAppMainViewController.java

@FXML
public void showProfileBrowser(ActionEvent evt) {

    CheckMenuItem mi = (CheckMenuItem) evt.getSource();

    if (logger.isDebugEnabled()) {
        logger.debug("[SHOW] show={}", mi.isSelected());
    }//from w w  w  .  j  a  v a  2 s  . co  m

    if (mi.isSelected() && !outerSp.getItems().contains(profileBrowser)) {
        if (logger.isDebugEnabled()) {
            logger.debug("[SHOW] adding profileBrowser region");
        }

        profileBrowser.setOpacity(0.0d);

        outerSp.getItems().add(0, profileBrowser);
        outerSp.setDividerPositions(0.3);

        FadeTransition ft = new FadeTransition(Duration.millis(400), profileBrowser);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setCycleCount(1);
        ft.setAutoReverse(false);
        ft.play();

        return;
    }

    if (!mi.isSelected() && outerSp.getItems().contains(profileBrowser)) {

        if (logger.isDebugEnabled()) {
            logger.debug("[SHOW] removing profileBrowser region");
        }

        FadeTransition ft = new FadeTransition(Duration.millis(300), profileBrowser);
        ft.setFromValue(1.0);
        ft.setToValue(0.1);
        ft.setCycleCount(1);
        ft.setAutoReverse(false);
        ft.play();

        ft.setOnFinished((e) -> outerSp.getItems().remove(profileBrowser));
    }
}