private ErrorTooltipManager(String message) { require(isNotBlank(message), "Tooltip message cannot be blank"); this.tooltip = new Tooltip(message); this.tooltip.getStyleClass().add(ERROR_TOOLTIP_CLASS); hideTimer.getKeyFrames().add(new KeyFrame(new Duration(5000))); hideTimer.setOnFinished(e -> { tooltip.hide(); ErrorTooltipManager.this.active = false; }); activationTimer.getKeyFrames().add(new KeyFrame(new Duration(250))); activationTimer.setOnFinished(e -> { if (!ErrorTooltipManager.this.active) { Scene scene = getScene(); if (scene != null) { Window owner = scene.getWindow(); if (owner != null && owner.isShowing() && ValidableTextField.this.isVisible()) { Point2D where = getDisplayCoordiantes(owner, scene); tooltip.show(ValidableTextField.this, where.getX(), where.getY()); ErrorTooltipManager.this.active = true; hideTimer.playFromStart(); } } } }); }
@Inject public ContentPane(WorkArea modules, Dashboard dashboard, NewsPanel news, @Named("defaultDashboardItemId") String defaultDasboardItem) { this.modules = modules; this.dashboard = dashboard; this.newsContainer = new VBox(news); this.newsContainer.getStyleClass().add("news-container"); StackPane stack = new StackPane(modules, dashboard); setHgrow(stack, Priority.ALWAYS); newsContainer.managedProperty().bind(newsContainer.visibleProperty()); newsContainer.setVisible(false); fadeIn = new FadeTransition(new Duration(300), newsContainer); fadeIn.setFromValue(0); fadeIn.setToValue(1); fadeOut = new FadeTransition(new Duration(300), newsContainer); fadeOut.setFromValue(1); fadeOut.setToValue(0); fadeOut.setOnFinished(e -> { newsContainer.setVisible(false); }); getChildren().addAll(stack, newsContainer); eventStudio().addAnnotatedListeners(this); eventStudio().broadcast(new SetActiveDashboardItemRequest(defaultDasboardItem)); }
/** * Like the usual {@code setProgress}-method but adds a smooth animation * * @param progress The progress to set */ public void setProgressAnimated(double progress) { Timeline timeline = new Timeline(); KeyValue keyValue = new KeyValue(this.progressProperty(), progress); KeyFrame keyFrame = new KeyFrame(new Duration(400), keyValue); timeline.getKeyFrames().add(keyFrame); timeline.play(); }
/** * show the given notification * * @param title * @param text * @param milliSecs */ public static void showNotification(String title, String text, int milliSecs) { Notifications notification = Notifications.create(); notification.hideAfter(new Duration(milliSecs)); notification.title(title); notification.text(text); Platform.runLater(() -> notification.showInformation()); }
public void hide() { if (dialogStage != null) { dispatchEvent(new HideDialogEvent(dialogStage)); Platform.runLater(() -> { SimpleIntegerProperty toto = new SimpleIntegerProperty(50); toto.addListener((ChangeListener<Number>) (observable, oldValue, newValue) -> { dialogStage.setWidth(dialogStage.getWidth() * (1 / newValue.doubleValue())); dialogStage.setHeight(dialogStage.getHeight() * (1 / newValue.doubleValue())); }); EasingInterpolator interpolator = new EasingInterpolator(EasingMode.SWING_FROM); final Timeline timeline = new Timeline(); KeyFrame kf = new KeyFrame(new Duration(200), new KeyValue(toto, 1, interpolator)); timeline.getKeyFrames().addAll(kf); timeline.setOnFinished(e -> dialogStage.hide()); timeline.play(); }); } }