List of usage examples for javafx.util Duration millis
double millis
To view the source code for javafx.util Duration millis.
Click Source Link
From source file:net.rptools.tokentool.controller.TokenTool_Controller.java
private void treeViewFinish() { log.info("***treeViewFinish called"); // Sort the nodes off of root treeItems = sortTreeNodes(treeItems); updateOverlayTreeview(treeItems);/*from w w w. j ava2s .c o m*/ addPseudoClassToLeafs(overlayTreeView); updateOverlayTreeViewRecentFolder(false); // overlayNameLabel.setVisible(true); overlayTreeProgressBar.setStyle("-fx-accent: forestgreen;"); progressBarLabel.setVisible(false); FadeTransition fadeOut = new FadeTransition(Duration.millis(2000)); fadeOut.setNode(overlayTreeProgressBar); fadeOut.setFromValue(1.0); fadeOut.setToValue(0.0); fadeOut.setCycleCount(1); fadeOut.setAutoReverse(false); fadeOut.playFromStart(); FadeTransition fadeIn = new FadeTransition(Duration.millis(4000)); fadeIn.setNode(overlayNameLabel); fadeIn.setFromValue(0.0); fadeIn.setToValue(1.0); fadeIn.setCycleCount(1); fadeIn.setAutoReverse(false); fadeIn.playFromStart(); }
From source file:com.github.vatbub.tictactoe.view.Main.java
private void showWinner(Board.WinnerInfo winnerInfo) { guiAnimationQueue.submitWaitForUnlock( () -> addWinLineOnWin(winnerInfo, new Color(1.0, 145.0 / 255.0, 30.0 / 255.0, 1.0), () -> { winnerText.setText(winnerInfo.winningPlayer.getName() + " won :)"); double endX = winningGirl.getX(); double endY = winningGirl.getY(); double confettiOffset = 30; double confettiX = confetti.getX(); double confettiY = confetti.getY(); AnchorPane.clearConstraints(winningGirl); winningGirl.setX(endX);//from ww w. j a v a 2 s . c o m winningGirl.setY(root.getHeight() + 140); blurGamePane(); winMessage.setOpacity(0); confetti.setOpacity(0); winPane.setOpacity(1); winPane.setVisible(true); winningGirl.setVisible(true); Timeline timeline = new Timeline(); double S4 = 1.45; double x0 = 0.33; KeyValue confettiKeyValue1x = new KeyValue(confetti.xProperty(), confettiX); KeyValue confettiKeyValue1y = new KeyValue(confetti.yProperty(), confettiY - confettiOffset); KeyValue confettiKeyValue1opacity = new KeyValue(confetti.opacityProperty(), 0); KeyFrame confettiKeyFrame1 = new KeyFrame(Duration.seconds(0), confettiKeyValue1x, confettiKeyValue1y, confettiKeyValue1opacity); KeyValue confettiKeyValue2x = new KeyValue(confetti.xProperty(), confettiX); KeyValue confettiKeyValue2y = new KeyValue(confetti.yProperty(), confettiY - confettiOffset); KeyValue confettiKeyValue2opacity = new KeyValue(confetti.opacityProperty(), 0); KeyFrame confettiKeyFrame2 = new KeyFrame(Duration.millis(500), confettiKeyValue2x, confettiKeyValue2y, confettiKeyValue2opacity); KeyValue confettiKeyValue3x = new KeyValue(confetti.xProperty(), confettiX, new CustomEaseOutInterpolator(S4, x0)); KeyValue confettiKeyValue3y = new KeyValue(confetti.yProperty(), confettiY, new CustomEaseOutInterpolator(S4, x0)); KeyValue confettiKeyValue3opacity = new KeyValue(confetti.opacityProperty(), 1); KeyFrame confettiKeyFrame3 = new KeyFrame(Duration.millis(1100), confettiKeyValue3x, confettiKeyValue3y, confettiKeyValue3opacity); KeyValue winningGirlKeyValue1x = new KeyValue(winningGirl.xProperty(), endX, new CustomEaseOutInterpolator(S4, x0)); KeyValue winningGirlKeyValue1y = new KeyValue(winningGirl.yProperty(), endY, new CustomEaseOutInterpolator(S4, x0)); KeyFrame winningGirlKeyFrame1 = new KeyFrame(Duration.seconds(1), winningGirlKeyValue1x, winningGirlKeyValue1y); timeline.getKeyFrames().addAll(winningGirlKeyFrame1, confettiKeyFrame1, confettiKeyFrame2, confettiKeyFrame3); timeline.setOnFinished((event) -> fadeNode(winMessage, 1, () -> { AnchorPane.setRightAnchor(winningGirl, 0.0); AnchorPane.setBottomAnchor(winningGirl, 0.0); })); timeline.play(); })); }
From source file:com.github.vatbub.tictactoe.view.Main.java
private void showWinnerWithTwoHumanPlayers(Board.WinnerInfo winnerInfo) { guiAnimationQueue.submitWaitForUnlock(() -> addWinLineOnWin(winnerInfo, Color.YELLOW, () -> { twoHumansWinnerText.setText(winnerInfo.winningPlayer.getName() + " won :)"); double endX = twoHumansWinnerImage.getX(); double endY = twoHumansWinnerImage.getY(); AnchorPane.clearConstraints(twoHumansWinnerImage); twoHumansWinnerImage.setX(endX); twoHumansWinnerImage.setY(twoHumansWinnerImage.getY() + 300); // blurGamePane(); blurGamePane(10.0);/*from w w w .j a va2 s. com*/ twoHumansWinMessage.setOpacity(0); twoHumansWinnerImage.setOpacity(0); twoHumansWinnerPane.setOpacity(1); twoHumansWinnerPane.setVisible(true); twoHumansWinnerImage.setVisible(true); Timeline timeline = new Timeline(); double S4 = 1.45; double x0 = 0.33; KeyValue twoHumansWinnerImageKeyValue1x = new KeyValue(twoHumansWinnerImage.xProperty(), endX, new CustomEaseOutInterpolator(S4, x0)); KeyValue twoHumansWinnerImageKeyValue1y = new KeyValue(twoHumansWinnerImage.yProperty(), endY, new CustomEaseOutInterpolator(S4, x0)); KeyValue twoHumansWinnerImageKeyValue1Opacity = new KeyValue(twoHumansWinnerImage.opacityProperty(), 1); KeyFrame twoHumansWinnerImageKeyFrame1 = new KeyFrame(Duration.millis(600), twoHumansWinnerImageKeyValue1x, twoHumansWinnerImageKeyValue1y, twoHumansWinnerImageKeyValue1Opacity); timeline.getKeyFrames().addAll(twoHumansWinnerImageKeyFrame1); timeline.setOnFinished((event) -> fadeNode(twoHumansWinMessage, 1, () -> { AnchorPane.setLeftAnchor(twoHumansWinnerImage, 0.0); AnchorPane.setBottomAnchor(twoHumansWinnerImage, 0.0); })); timeline.play(); })); }
From source file:com.github.vatbub.tictactoe.view.Main.java
private void addWinLineOnWin(Board.WinnerInfo winnerInfo, Paint color, Runnable onFinished) { Line originLine = new Line(0, 0, 0, 0); winLineGroup.getChildren().add(originLine); WinLine winLine = new WinLine(winnerInfo); double winLineEndX = winLine.endArc.getCenterX(); double winLineEndY = winLine.endArc.getCenterY(); winLine.startArc.setFill(color);//ww w. jav a 2 s . c o m winLine.startArc.setStrokeWidth(0); winLine.endArc.setFill(color); winLine.endArc.setStrokeWidth(0); winLine.rightLine.setStrokeWidth(0); winLine.leftLine.setStrokeWidth(0); winLine.centerLine.setStroke(color); winLine.centerLine.strokeWidthProperty().bind(winLine.startArc.radiusXProperty().multiply(2)); winLineGroup.getChildren().addAll(winLine.getAll()); blurNode(gamePane, 4); winLineGroup.setOpacity(0); GaussianBlur blur = new GaussianBlur(100); winLineGroup.setEffect(blur); winLineGroup.setBlendMode(BlendMode.DARKEN); winLineGroup.setVisible(true); double winLineAnimationX1 = 0.2; double winLineAnimationX2 = 0.5; KeyValue stretchKeyValue1x = new KeyValue(winLine.endArc.centerXProperty(), winLine.startArc.getCenterX()); KeyValue stretchKeyValue1y = new KeyValue(winLine.endArc.centerYProperty(), winLine.startArc.getCenterY()); KeyFrame stretchKeyFrame1 = new KeyFrame(Duration.millis(0), stretchKeyValue1x, stretchKeyValue1y); KeyValue stretchKeyValue2x = new KeyValue(winLine.endArc.centerXProperty(), winLine.startArc.getCenterX(), new CustomEaseBothInterpolator(winLineAnimationX1, winLineAnimationX2)); KeyValue stretchKeyValue2y = new KeyValue(winLine.endArc.centerYProperty(), winLine.startArc.getCenterY(), new CustomEaseBothInterpolator(winLineAnimationX1, winLineAnimationX2)); KeyFrame stretchKeyFrame2 = new KeyFrame(Duration.millis(100), stretchKeyValue2x, stretchKeyValue2y); KeyValue stretchKeyValue3x = new KeyValue(winLine.endArc.centerXProperty(), winLineEndX, new CustomEaseBothInterpolator(winLineAnimationX1, winLineAnimationX2)); KeyValue stretchKeyValue3y = new KeyValue(winLine.endArc.centerYProperty(), winLineEndY, new CustomEaseBothInterpolator(winLineAnimationX1, winLineAnimationX2)); KeyFrame stretchKeyFrame3 = new KeyFrame(Duration.millis(800), stretchKeyValue3x, stretchKeyValue3y); KeyValue opacityKeyValue1 = new KeyValue(winLineGroup.opacityProperty(), 0.8); KeyFrame opacityKeyFrame1 = new KeyFrame(Duration.millis(400), opacityKeyValue1); Timeline timeline = new Timeline(); timeline.getKeyFrames().addAll(stretchKeyFrame1, stretchKeyFrame2, stretchKeyFrame3, opacityKeyFrame1); timeline.play(); timeline.setOnFinished((event) -> onFinished.run()); }
From source file:com.github.vatbub.tictactoe.view.Main.java
private void showLooser(Board.WinnerInfo winnerInfo) { String looserName = board.getOpponent(winnerInfo.winningPlayer).getName(); guiAnimationQueue.submitWaitForUnlock(() -> { ShakeTransition anim = new ShakeTransition(gamePane, null); anim.playFromStart();/*from w w w .j av a2 s. c o m*/ Timeline timeline = new Timeline(); Circle c1 = new Circle((452 / 600.0) * looserPane.getWidth(), (323 / 640.0) * looserPane.getHeight(), 0); GaussianBlur circleBlur = new GaussianBlur(30); c1.setEffect(circleBlur); looseImage.setClip(c1); addWinLineOnLoose(winnerInfo); KeyValue keyValue1 = new KeyValue(c1.radiusProperty(), 0); KeyFrame keyFrame1 = new KeyFrame(Duration.millis(800), keyValue1); KeyValue keyValue2 = new KeyValue(c1.radiusProperty(), (500 / 640.0) * looserPane.getHeight()); KeyFrame keyFrame2 = new KeyFrame(Duration.millis(900), keyValue2); timeline.getKeyFrames().addAll(keyFrame1, keyFrame2); looseMessage.setOpacity(0); looserText.setText(looserName + " lost :("); looserPane.setVisible(true); looserPane.setOpacity(1); timeline.setOnFinished((event) -> { looseImage.setClip(null); winLineGroup.setClip(null); blurGamePane(); PauseTransition wait = new PauseTransition(); wait.setDuration(Duration.seconds(1)); wait.setOnFinished((event2) -> { FadeTransition looseMessageTransition = new FadeTransition(); looseMessageTransition.setNode(looseMessage); looseMessageTransition.setFromValue(0); looseMessageTransition.setToValue(1); looseMessageTransition.setDuration(Duration.millis(500)); looseMessageTransition.setAutoReverse(false); looseMessageTransition.play(); }); wait.play(); }); timeline.play(); }); }
From source file:com.github.vatbub.tictactoe.view.Main.java
private void addWinLineOnLoose(Board.WinnerInfo winnerInfo) { final double strokeWidth = 2; Line originLine = new Line(0, 0, 0, 0); winLineGroup.getChildren().add(originLine); WinLine winLine = new WinLine(winnerInfo); winLine.startArc.setFill(Color.TRANSPARENT); winLine.startArc.setStroke(Color.BLACK); winLine.startArc.setStrokeWidth(strokeWidth); winLine.endArc.setFill(Color.TRANSPARENT); winLine.endArc.setStroke(Color.BLACK); winLine.endArc.setStrokeWidth(strokeWidth); winLine.rightLine.setStrokeWidth(strokeWidth); winLine.leftLine.setStrokeWidth(strokeWidth); winLine.centerLine.setStrokeWidth(0); winLineGroup.getChildren().addAll(winLine.getAll()); winLineGroup.setOpacity(0);//from w w w.j a v a 2 s . c om GaussianBlur blur = new GaussianBlur(7); winLineGroup.setEffect(blur); winLineGroup.setVisible(true); KeyValue keyValue1 = new KeyValue(winLineGroup.opacityProperty(), 0); KeyFrame keyFrame1 = new KeyFrame(Duration.millis(900), keyValue1); KeyValue keyValue2 = new KeyValue(winLineGroup.opacityProperty(), 1); KeyFrame keyFrame2 = new KeyFrame(Duration.millis(950), keyValue2); Timeline timeline = new Timeline(); timeline.getKeyFrames().addAll(keyFrame1, keyFrame2); timeline.play(); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param strLstPano// w ww . j av a 2s . com * @param iNumPano * @return */ public static Pane paneAffichageHS(String strLstPano, int iNumPano) { Pane paneHotSpots = new Pane(); paneHotSpots.setTranslateY(10); paneHotSpots.setTranslateX(10); VBox vbHotspots = new VBox(5); paneHotSpots.getChildren().add(vbHotspots); Label lblPoint; int io; for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspots(); io++) { Label lblSep = new Label(" "); Label lblSep1 = new Label(" "); VBox vbPanneauHS = new VBox(); double deplacement = 0; vbPanneauHS.setLayoutX(deplacement); Pane paneHsPanoramique = new Pane(vbPanneauHS); paneHsPanoramique.setPrefHeight(300); paneHsPanoramique.setMinHeight(300); paneHsPanoramique.setMaxHeight(300); int iNum1 = io; Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> { Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1); if (c1 != null) { if (c1.getFill() == Color.RED) { c1.setFill(Color.YELLOW); c1.setStroke(Color.RED); } else { c1.setFill(Color.RED); c1.setStroke(Color.YELLOW); } } })); timBouge.setCycleCount(Timeline.INDEFINITE); timBouge.pause(); paneHsPanoramique.setOnMouseEntered((e) -> { timBouge.play(); }); paneHsPanoramique.setOnMouseExited((e) -> { timBouge.pause(); Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1); if (c1 != null) { c1.setFill(Color.YELLOW); c1.setStroke(Color.RED); } }); paneHsPanoramique .setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;"); paneHsPanoramique.setId("HS" + io); lblPoint = new Label("Point #" + (io + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.setTranslateX(-deplacement); lblPoint.getStyleClass().add("titreOutil"); Separator sepHotspots = new Separator(Orientation.HORIZONTAL); sepHotspots.setTranslateX(-deplacement); sepHotspots.setPrefWidth(321); sepHotspots.setTranslateX(2); paneHsPanoramique.setPrefWidth(325); vbPanneauHS.getChildren().addAll(lblPoint, sepHotspots); if (strLstPano != null) { Label lblLien = new Label(rbLocalisation.getString("main.panoramiqueDestination")); lblLien.setTranslateX(10); ComboBox cbDestPano = new ComboBox(); String[] strListe = strLstPano.split(";"); cbDestPano.getItems().addAll(Arrays.asList(strListe)); int iNum11 = getPanoramiquesProjet()[iNumPano].getHotspot(io).getNumeroPano(); cbDestPano.setTranslateX(10); cbDestPano.setId("cbpano" + io); cbDestPano.getSelectionModel().select(iNum11); cbDestPano.getSelectionModel().selectedIndexProperty().addListener((ov, t, t1) -> { valideHS(); if (dejaCharge) { dejaCharge = false; retireAffichageHotSpots(); Pane affHS1 = paneAffichageHS(strListePano(), iNumPano); affHS1.setId("labels"); vbVisuHotspots.getChildren().add(affHS1); } }); if (iNum11 != -1) { int iNumPan = iNum11; ImageView ivAfficheVignettePano = new ImageView( getPanoramiquesProjet()[iNum11].getImgPanoRect()); ivAfficheVignettePano.setPreserveRatio(true); ivAfficheVignettePano.setFitWidth(300); ivAfficheVignettePano.setLayoutY(10); ivAfficheVignettePano.setCursor(Cursor.HAND); ivAfficheVignettePano.setOnMouseClicked((e) -> { affichePanoChoisit(iNumPan); }); AnchorPane apVisuVignettePano = new AnchorPane(ivAfficheVignettePano); apVisuVignettePano.setPrefHeight(170); apVisuVignettePano.setTranslateX(10); vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, apVisuVignettePano, lblSep); } else { vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, lblSep); } } Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot")); lblTexteHS.setTranslateX(10); TextField tfTexteHS = new TextField(); if (getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo() != null) { tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo()); } tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); tfTexteHS.setId("txtHS" + io); tfTexteHS.setPrefSize(200, 25); tfTexteHS.setMaxSize(200, 20); tfTexteHS.setTranslateX(60); vbPanneauHS.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1); vbHotspots.getChildren().addAll(paneHsPanoramique, lblSep); } int iNbHS = io; int iTaillePane = io * 325; for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotImage(); io++) { Label lblSep = new Label(" "); Label lblSep1 = new Label(" "); VBox vbPanneauHsImage = new VBox(); Pane paneHsImage = new Pane(vbPanneauHsImage); int iNum = io; Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> { Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum); if (c1 != null) { if (c1.getFill() == Color.BLUE) { c1.setFill(Color.YELLOW); c1.setStroke(Color.BLUE); } else { c1.setFill(Color.BLUE); c1.setStroke(Color.YELLOW); } } })); timBouge.setCycleCount(Timeline.INDEFINITE); timBouge.pause(); paneHsImage.setOnMouseEntered((e) -> { timBouge.play(); }); paneHsImage.setOnMouseExited((e) -> { Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum); if (c1 != null) { c1.setFill(Color.BLUE); c1.setStroke(Color.YELLOW); } timBouge.pause(); }); paneHsImage.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;"); paneHsImage.setId("HSImg" + io); lblPoint = new Label("Image #" + (io + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.getStyleClass().add("titreOutil"); Separator sepHS = new Separator(Orientation.HORIZONTAL); sepHS.setPrefWidth(321); sepHS.setTranslateX(2); paneHsImage.setPrefWidth(325); vbPanneauHsImage.getChildren().addAll(lblPoint, sepHS); Label lblLien = new Label(rbLocalisation.getString("main.imageChoisie")); lblLien.setTranslateX(10); String strF1XML = getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrLienImg(); Image imgChoisie = new Image( "file:" + getStrRepertTemp() + File.separator + "images" + File.separator + strF1XML); ImageView ivChoisie = new ImageView(imgChoisie); ivChoisie.setTranslateX(100); ivChoisie.setFitWidth(100); ivChoisie.setFitHeight(imgChoisie.getHeight() / imgChoisie.getWidth() * 100); vbPanneauHsImage.getChildren().addAll(lblLien, ivChoisie, lblSep); Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot")); lblTexteHS.setTranslateX(10); TextField tfTexteHS = new TextField(); if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo() != null) { tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo()); } tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); tfTexteHS.setId("txtHSImage" + io); tfTexteHS.setPrefSize(200, 25); tfTexteHS.setMaxSize(200, 20); tfTexteHS.setTranslateX(60); vbPanneauHsImage.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1); Label lblCoulFond = new Label(rbLocalisation.getString("diapo.couleurFond")); lblCoulFond.setTranslateX(10); Label lblOpacite = new Label(rbLocalisation.getString("diapo.opacite")); lblOpacite.setTranslateX(10); if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond().equals("")) { getPanoramiquesProjet()[iNumPano].getHotspotImage(io).setStrCouleurFond( "#" + getGestionnaireInterface().getCouleurFondTheme().toString().substring(2, 8)); } ColorPicker cpCouleurFond = new ColorPicker( Color.valueOf(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond())); if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite() == -1) { getPanoramiquesProjet()[iNumPano].getHotspotImage(io) .setOpacite(getGestionnaireInterface().getOpaciteTheme()); } cpCouleurFond.setTranslateX(100); int i = io; cpCouleurFond.valueProperty().addListener((ov, av, nv) -> { if (getiNombrePanoramiques() != 0) { setbDejaSauve(false); getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *"); } getPanoramiquesProjet()[iNumPano].getHotspotImage(i) .setStrCouleurFond("#" + cpCouleurFond.getValue().toString().substring(2, 8)); }); Slider slOpacite = new Slider(0, 1, getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite()); slOpacite.valueProperty().addListener((ov, av, nv) -> { if (getiNombrePanoramiques() != 0) { setbDejaSauve(false); getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *"); } getPanoramiquesProjet()[iNumPano].getHotspotImage(i).setOpacite(slOpacite.getValue()); }); slOpacite.setTranslateX(100); slOpacite.setPrefWidth(130); slOpacite.setMinWidth(130); slOpacite.setMaxWidth(130); vbPanneauHsImage.getChildren().addAll(lblCoulFond, cpCouleurFond, lblOpacite, slOpacite); vbHotspots.getChildren().addAll(paneHsImage, lblSep); iTaillePane += 225 + ivChoisie.getFitHeight(); paneHsImage.setPrefHeight(200 + ivChoisie.getFitHeight()); paneHsImage.setMinHeight(200 + ivChoisie.getFitHeight()); paneHsImage.setMaxHeight(200 + ivChoisie.getFitHeight()); } iNbHS += io; for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotHTML(); io++) { Label lblSep = new Label(" "); int iNum = io; VBox vbPanneauHS = new VBox(); Pane paneHsHtml = new Pane(vbPanneauHS); Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> { Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum); if (c1 != null) { if (c1.getFill() == Color.DARKGREEN) { c1.setFill(Color.YELLOWGREEN); c1.setStroke(Color.DARKGREEN); } else { c1.setFill(Color.DARKGREEN); c1.setStroke(Color.YELLOWGREEN); } } })); timBouge.setCycleCount(Timeline.INDEFINITE); timBouge.pause(); paneHsHtml.setOnMouseEntered((e) -> { timBouge.play(); }); paneHsHtml.setOnMouseExited((e) -> { timBouge.pause(); Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum); if (c1 != null) { c1.setFill(Color.DARKGREEN); c1.setStroke(Color.YELLOWGREEN); } }); paneHsHtml.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;"); paneHsHtml.setId("HSHTML" + io); lblPoint = new Label("Hotspot HTML #" + (io + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.getStyleClass().add("titreOutil"); Separator sepHS = new Separator(Orientation.HORIZONTAL); sepHS.setPrefWidth(321); sepHS.setTranslateX(2); paneHsHtml.setPrefWidth(325); Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot")); lblTexteHS.setTranslateX(10); TextField tfTexteHS = new TextField(); if (getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo() != null) { tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo()); } tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); tfTexteHS.setId("txtHSHTML" + io); tfTexteHS.setPrefSize(200, 25); tfTexteHS.setMaxSize(200, 20); tfTexteHS.setTranslateX(60); vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS); Button btnEditeHSHTML = new Button(rbLocalisation.getString("main.editeHTML")); btnEditeHSHTML.setPrefWidth(80); btnEditeHSHTML.setTranslateX(paneHsHtml.getPrefWidth() - btnEditeHSHTML.getPrefWidth() - 10); vbPanneauHS.getChildren().addAll(btnEditeHSHTML); btnEditeHSHTML.setOnAction((e) -> { EditeurHTML editHTML = new EditeurHTML(); HotspotHTML HS = getPanoramiquesProjet()[iNumPano].getHotspotHTML(iNum); editHTML.setHsHTML(HS); Rectangle2D tailleEcran = Screen.getPrimary().getBounds(); int iHauteur = (int) tailleEcran.getHeight() - 100; int iLargeur = (int) tailleEcran.getWidth() - 100; editHTML.affiche(iLargeur, iHauteur); editHTML.addPropertyChangeListener("bValide", (ev) -> { if (ev.getNewValue().toString().equals("true")) { getPanoramiquesProjet()[iNumPano].setHotspotHTML(editHTML.getHsHTML(), iNum); dejaCharge = false; retireAffichageHotSpots(); Pane affHS1 = paneAffichageHS(strListePano(), iNumPano); affHS1.setId("labels"); vbVisuHotspots.getChildren().add(affHS1); } }); }); vbHotspots.getChildren().addAll(paneHsHtml, lblSep); paneHsHtml.setPrefHeight(120); paneHsHtml.setMinHeight(120); paneHsHtml.setMaxHeight(120); iTaillePane += 145; } iNbHS += io; for (io = 0; io < getPanoramiquesProjet()[iNumPano].getiNombreHotspotDiapo(); io++) { Label lblSep = new Label(" "); int iNum = io; VBox vbPanneauHS = new VBox(); Pane paneHsDiapo = new Pane(vbPanneauHS); Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> { Circle c1 = (Circle) panePanoramique.lookup("#dia" + iNum); if (c1 != null) { if (c1.getFill() == Color.TURQUOISE) { c1.setFill(Color.ORANGE); c1.setStroke(Color.TURQUOISE); } else { c1.setFill(Color.TURQUOISE); c1.setStroke(Color.ORANGE); } } })); timBouge.setCycleCount(Timeline.INDEFINITE); timBouge.pause(); paneHsDiapo.setOnMouseEntered((e) -> { timBouge.play(); }); paneHsDiapo.setOnMouseExited((e) -> { timBouge.pause(); Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum); if (c1 != null) { c1.setFill(Color.TURQUOISE); c1.setStroke(Color.ORANGE); } }); paneHsDiapo.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;"); paneHsDiapo.setId("DIAPO" + io); lblPoint = new Label("Hotspot Diaporama #" + (io + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.getStyleClass().add("titreOutil"); Separator sepHS = new Separator(Orientation.HORIZONTAL); sepHS.setPrefWidth(321); sepHS.setTranslateX(2); paneHsDiapo.setPrefWidth(325); Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot")); lblTexteHS.setTranslateX(10); TextField tfTexteHS = new TextField(); if (getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo() != null) { tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo()); } tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); tfTexteHS.setId("txtDIA" + io); tfTexteHS.setPrefSize(200, 25); tfTexteHS.setMaxSize(200, 20); tfTexteHS.setTranslateX(60); vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS); ComboBox cbListeDiapo = new ComboBox(); for (int i = 0; i < getiNombreDiapo(); i++) { cbListeDiapo.getItems().add(diaporamas[i].getStrNomDiaporama()); } cbListeDiapo.getSelectionModel() .select(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getiNumDiapo()); int iii = io; cbListeDiapo.getSelectionModel().selectedIndexProperty().addListener((ov, av, nv) -> { getPanoramiquesProjet()[iNumPano].getHotspotDiapo(iii).setiNumDiapo((int) nv); }); cbListeDiapo.setTranslateX(60); vbPanneauHS.getChildren().addAll(cbListeDiapo); //Ajouter Liste Diaporamas vbHotspots.getChildren().addAll(paneHsDiapo, lblSep); paneHsDiapo.setPrefHeight(120); paneHsDiapo.setMinHeight(120); paneHsDiapo.setMaxHeight(120); iTaillePane += 145; } valideHS(); iNbHS += io; dejaCharge = true; paneHotSpots.setPrefHeight(iTaillePane); paneHotSpots.setMinHeight(iTaillePane); paneHotSpots.setMaxHeight(iTaillePane); paneHotSpots.setId("labels"); apVisuHS.setPrefHeight(paneHotSpots.getPrefHeight()); apVisuHS.setMinHeight(paneHotSpots.getPrefHeight()); apVisuHS.setMaxHeight(paneHotSpots.getPrefHeight()); vbVisuHotspots.setPrefHeight(paneHotSpots.getPrefHeight()); vbVisuHotspots.setMinHeight(paneHotSpots.getPrefHeight()); vbVisuHotspots.setMaxHeight(paneHotSpots.getPrefHeight()); return paneHotSpots; }
From source file:net.sourceforge.pmd.util.fxdesigner.MainDesignerController.java
private void initializeViewAnimation() { // gets captured in the closure final double defaultMainHorizontalSplitPaneDividerPosition = mainHorizontalSplitPane .getDividerPositions()[0];//from w w w . j av a 2 s . c o m // show/ hide bottom pane bottomTabsToggle.selectedProperty().addListener((observable, wasExpanded, isNowExpanded) -> { KeyValue keyValue = null; DoubleProperty divPosition = mainHorizontalSplitPane.getDividers().get(0).positionProperty(); if (wasExpanded && !isNowExpanded) { keyValue = new KeyValue(divPosition, 1); } else if (!wasExpanded && isNowExpanded) { keyValue = new KeyValue(divPosition, defaultMainHorizontalSplitPaneDividerPosition); } if (keyValue != null) { Timeline timeline = new Timeline(new KeyFrame(Duration.millis(200), keyValue)); timeline.play(); } }); }
From source file:org.jevis.jeconfig.JEConfig.java
/** * Build an new JEConfig Login and main frame/stage * * @param primaryStage//from w w w . java2s . c o m */ //AITBilal - Login private void initGUI(Stage primaryStage) { Scene scene; LoginGlass login = new LoginGlass(primaryStage); AnchorPane jeconfigRoot = new AnchorPane(); AnchorPane.setTopAnchor(jeconfigRoot, 0.0); AnchorPane.setRightAnchor(jeconfigRoot, 0.0); AnchorPane.setLeftAnchor(jeconfigRoot, 0.0); AnchorPane.setBottomAnchor(jeconfigRoot, 0.0); // jeconfigRoot.setStyle("-fx-background-color: white;"); // jeconfigRoot.getChildren().setAll(new Label("sodfhsdhdsofhdshdsfdshfjf")); Screen screen = Screen.getPrimary(); Rectangle2D bounds = screen.getVisualBounds(); // @AITBilal - Main frame elemente wird aufgerufen nachdem man sich eingeloggt hat. login.getLoginStatus().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { System.out.println("after request"); _mainDS = login.getDataSource(); ds = _mainDS; Platform.runLater(new Runnable() { @Override public void run() { FadeTransition ft = new FadeTransition(Duration.millis(1500), login); ft.setFromValue(1.0); ft.setToValue(0); ft.setCycleCount(1); ft.play(); } }); JEConfig.PROGRAMM_INFO.setJEVisAPI(ds.getInfo()); JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.commons.application.Info.INFO); JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.application.Info.INFO); preLodedClasses = login.getAllClasses(); preLodedRootObjects = login.getRootObjects(); PluginManager pMan = new PluginManager(ds); //@AITBilal - Toolbar fr save, newB, delete, sep1, form GlobalToolBar toolbar = new GlobalToolBar(pMan); pMan.addPluginsByUserSetting(null); // StackPane root = new StackPane(); // root.setId("mainpane"); BorderPane border = new BorderPane(); VBox vbox = new VBox(); vbox.getChildren().addAll(new TopMenu(), toolbar.ToolBarFactory()); border.setTop(vbox); //@AITBilal - Alle Plugins Inhalt fr JEConfig (Resources... | System | Attribute) border.setCenter(pMan.getView()); Statusbar statusBar = new Statusbar(ds); border.setBottom(statusBar); System.out.println("show welcome"); //Disable GUI is StatusBar note an disconnect border.disableProperty().bind(statusBar.connectedProperty.not()); Platform.runLater(new Runnable() { @Override public void run() { AnchorPane.setTopAnchor(border, 0.0); AnchorPane.setRightAnchor(border, 0.0); AnchorPane.setLeftAnchor(border, 0.0); AnchorPane.setBottomAnchor(border, 0.0); jeconfigRoot.getChildren().setAll(border); // try { // WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://coffee-project.eu/")); // WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://openjevis.org/projects/openjevis/wiki/JEConfig3#JEConfig-Version-3")); // Task<Void> showWelcome = new Task<Void>() { // @Override // protected Void call() throws Exception { try { WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL()); } catch (URISyntaxException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } catch (MalformedURLException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } // return null; // } // }; // new Thread(showWelcome).start(); // WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL()); // } catch (URISyntaxException ex) { // Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); // } catch (MalformedURLException ex) { // Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); // } } }); } } }); AnchorPane.setTopAnchor(login, 0.0); AnchorPane.setRightAnchor(login, 0.0); AnchorPane.setLeftAnchor(login, 0.0); AnchorPane.setBottomAnchor(login, 0.0); //@AITBilal - Login Dialog scene = new Scene(jeconfigRoot, bounds.getWidth(), bounds.getHeight()); scene.getStylesheets().add("/styles/Styles.css"); primaryStage.getIcons().add(getImage("1393354629_Config-Tools.png")); primaryStage.setTitle("JEConfig"); primaryStage.setScene(scene); maximize(primaryStage); primaryStage.show(); // Platform.runLater(new Runnable() { // @Override // public void run() { //@AITBilal - Inhalt bzw. die Elemente von LoginDialog jeconfigRoot.getChildren().setAll(login); // } // }); primaryStage.onCloseRequestProperty().addListener(new ChangeListener<EventHandler<WindowEvent>>() { @Override public void changed(ObservableValue<? extends EventHandler<WindowEvent>> ov, EventHandler<WindowEvent> t, EventHandler<WindowEvent> t1) { try { System.out.println("Disconnect"); ds.disconnect(); } catch (JEVisException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } } }); }
From source file:org.sleuthkit.autopsy.timeline.ui.detailview.EventDetailsChart.java
/** * layout the nodes in the given list, starting form the given minimum y * coordinate.//from w w w. j a v a2 s .c o m * * Layout the nodes representing events via the following algorithm. * * we start with a list of nodes (each representing an event) - sort the * list of nodes by span start time of the underlying event - initialize * empty map (maxXatY) from y-position to max used x-value - for each node: * * -- size the node based on its children (recursively) * * -- get the event's start position from the dateaxis * * -- to position node (1)check if maxXatY is to the left of the left x * coord: if maxXatY is less than the left x coord, good, put the current * node here, mark right x coord as maxXatY, go to next node ; if maxXatY * greater than start position, increment y position, do check(1) again * until maxXatY less than start position * * @param nodes collection of nodes to layout * @param minY the minimum y coordinate to position the nodes at. */ double layoutEventBundleNodes(final Collection<? extends EventBundleNodeBase<?, ?, ?>> nodes, final double minY) { TreeRangeMap<Double, Double> treeRangeMap = TreeRangeMap.create(); // maximum y values occupied by any of the given nodes, updated as nodes are layed out. double localMax = minY; Set<String> activeQuickHidefilters = getController().getQuickHideFilters().stream() .filter(AbstractFilter::isActive).map(DescriptionFilter::getDescription) .collect(Collectors.toSet()); //for each node do a recursive layout to size it and then position it in first available slot for (EventBundleNodeBase<?, ?, ?> bundleNode : nodes) { //is the node hiden by a quick hide filter? boolean quickHide = activeQuickHidefilters.contains(bundleNode.getDescription()); if (quickHide) { //hide it and skip layout bundleNode.setVisible(false); bundleNode.setManaged(false); } else { bundleLayoutHelper(bundleNode); //get computed height and width double h = bundleNode.getBoundsInLocal().getHeight(); double w = bundleNode.getBoundsInLocal().getWidth(); //get left and right x coords from axis plus computed width double xLeft = getXForEpochMillis(bundleNode.getStartMillis()) - bundleNode.getLayoutXCompensation(); double xRight = xLeft + w + MINIMUM_EVENT_NODE_GAP; //initial test position double yTop = minY; if (oneEventPerRow.get()) { // if onePerRow, just put it at end yTop = (localMax + MINIMUM_EVENT_NODE_GAP); } else { double yBottom = yTop + h; //until the node is not overlapping any others try moving it down. boolean overlapping = true; while (overlapping) { overlapping = false; //check each pixel from bottom to top. for (double y = yBottom; y >= yTop; y--) { final Double maxX = treeRangeMap.get(y); if (maxX != null && maxX >= xLeft - MINIMUM_EVENT_NODE_GAP) { //if that pixel is already used //jump top to this y value and repeat until free slot is found. overlapping = true; yTop = y + MINIMUM_EVENT_NODE_GAP; yBottom = yTop + h; break; } } } treeRangeMap.put(Range.closed(yTop, yBottom), xRight); } localMax = Math.max(yTop + h, localMax); if ((xLeft != bundleNode.getLayoutX()) || (yTop != bundleNode.getLayoutY())) { //animate node to new position Timeline timeline = new Timeline( new KeyFrame(Duration.millis(100), new KeyValue(bundleNode.layoutXProperty(), xLeft), new KeyValue(bundleNode.layoutYProperty(), yTop))); timeline.setOnFinished((ActionEvent event) -> { requestChartLayout(); }); timeline.play(); } } } return localMax; //return new max }