private void onActionSimulateGameMode(EGameMode gameMode) { DebugConsole.getDefault().debug(this.getClass(), "On Action simulate GameMode: " + gameMode.toString()); // NOI18N final SequentialTransition st = new SequentialTransition(); st.setDelay(Duration.millis(125.0d)); final PauseTransition ptStopGameMode = this.onActionStopGameMode(); st.getChildren().add(ptStopGameMode); final FadeTransition ftHideGameInformations = this.onActionHideGameInformations(); st.getChildren().add(ftHideGameInformations); final FadeTransition ftShowGameInformations = this.onActionShowGameInformations(gameMode); st.getChildren().add(ftShowGameInformations); final PauseTransition ptStartGameMode = this.onActionStartGameMode(gameMode); st.getChildren().add(ptStartGameMode); st.playFromStart(); }
/** * Add an event handler to a node will trigger continuously trigger at a given interval while the button is * being pressed. * * @param node the {@link Node} * @param holdTime interval time * @param handler the handler */ private void addContinuousPressHandler(final Node node, final Duration holdTime, final EventHandler<MouseEvent> handler) { final Wrapper<MouseEvent> eventWrapper = new Wrapper<>(); final PauseTransition holdTimer = new PauseTransition(holdTime); holdTimer.setOnFinished(event -> { handler.handle(eventWrapper.content); holdTimer.playFromStart(); }); node.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> { eventWrapper.content = event; holdTimer.playFromStart(); }); node.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> holdTimer.stop()); node.addEventHandler(MouseEvent.DRAG_DETECTED, event -> holdTimer.stop()); }
public void regionOrProductChanged() { cancel(); boolean regionChanged = updateRegionAndProductSelection(); if (regionChanged) { // pause the data updating to wait for animation to finish PauseTransition delay = new PauseTransition(Duration.millis(1500)); delay.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { restart(); } }); delay.play(); } else { restart(); } }
@Override public void initialize(URL location, ResourceBundle resources) { tableColumnScope.setCellValueFactory(new PropertyValueFactory<>("scope")); tableColumnIdentifier.setCellValueFactory(new PropertyValueFactory<>("identifier")); tableColumnParameter.setCellValueFactory(new PropertyValueFactory<>("parameter")); tableColumnType.setCellValueFactory(new PropertyValueFactory<>("type")); tableColumnValue.setCellValueFactory(new PropertyValueFactory<>("data")); PauseTransition refreshLoop = new PauseTransition(); refreshLoop.setOnFinished(e -> { if (toggleButtonRefresh.isSelected()) refresh(); refreshLoop.playFromStart(); }); refreshLoop.setDuration(Duration.seconds(0.5)); refreshLoop.playFromStart(); refresh(); }
private void onCloseRequest() { final char borderSign = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__BORDER_SIGN).charAt(0); final String message = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__MESSAGE_STOP); final String title = Properties.getPropertyForTestdataApplication(KEY__TESTDATA_APPLICATION__TITLE); LoggerFacade.getDefault().message(borderSign, 80, message + title); try { TestdataFacade.getDefault().shutdown(); } catch (InterruptedException e) { } Injector.forgetAll(); DatabaseFacade.getDefault().shutdown(); final PauseTransition pt = new PauseTransition(LITTLE_DELAY__DURATION_125); pt.setOnFinished((ActionEvent event) -> { Platform.exit(); }); pt.playFromStart(); }
private void onCloseRequest() { // afterburner.fx Injector.forgetAll(); // Database DatabaseFacade.getDefault().shutdown(); // Message final char borderSign = Properties.getPropertyForApplication(KEY__APPLICATION__BORDER_SIGN).charAt(0); final String message = Properties.getPropertyForApplication(KEY__APPLICATION__MESSAGE_STOP); final String title = Properties.getPropertyForApplication(KEY__APPLICATION__TITLE) + Properties.getPropertyForApplication(KEY__APPLICATION__VERSION); LoggerFacade.getDefault().message(borderSign, 80, String.format(message, title)); // Timer final PauseTransition pt = new PauseTransition(LITTLE_DELAY__DURATION_125); pt.setOnFinished((ActionEvent event) -> { Platform.exit(); }); pt.playFromStart(); }
public MouseHandler(Duration maxTimeBetweenSequentialClicks) { bind(); clickTimer = new PauseTransition(maxTimeBetweenSequentialClicks); clickTimer.setOnFinished(event -> { int count = sequentialClickCount.get(); sequentialClickCount.set(0); switch (count) { case 1: singleClick(mouseEvent); break; case 2: doubleClick(mouseEvent); break; case 3: tripleClick(mouseEvent); break; default: } }); }
private void onCloseRequest() { // afterburner.fx Injector.forgetAll(); // Database DatabaseFacade.getDefault().shutdown(); // Message final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0); final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP); final String title = this.getProperty(KEY__APPLICATION__TITLE) + this.getProperty(KEY__APPLICATION__VERSION); LoggerFacade.getDefault().message(borderSign, 80, String.format(message, title)); // Timer final PauseTransition pt = new PauseTransition(DURATION__125); pt.setOnFinished((ActionEvent event) -> { Platform.exit(); }); pt.playFromStart(); }
private void onActionShowPageCSS(ConcreteSample concreteSample) { LoggerFacade.getDefault().debug(this.getClass(), "On action show page [CSS]"); // NOI18N final PauseTransition pt = new PauseTransition(); pt.setDuration(Duration.millis(25.0d)); pt.setOnFinished(event -> { LoggerFacade.getDefault().debug(this.getClass(), "Load css-url..."); // NOI18N final boolean hasCssURL = concreteSample.hasCssURL(); if (hasCssURL) { LoggerFacade.getDefault().debug(this.getClass(), "A css-url is defined."); // NOI18N wvCssPage.getEngine().loadContent(TemplateLoader.loadCSStemplate(concreteSample.getCssURL().get())); } else { LoggerFacade.getDefault().warn(this.getClass(), "No css-url is defined!"); // NOI18N wvCssPage.getEngine().loadContent(TemplateLoader.loadNoXyURLisDefinedTemplate(TemplateLoader.UrlType.CSS)); } }); pt.playFromStart(); }
private void onActionShowPageJavaDoc(ConcreteSample concreteSample) { LoggerFacade.getDefault().debug(this.getClass(), "On action show page [JavaDoc]"); // NOI18N final PauseTransition pt = new PauseTransition(); pt.setDuration(Duration.millis(25.0d)); pt.setOnFinished(event -> { LoggerFacade.getDefault().debug(this.getClass(), "Load javadoc-url..."); // NOI18N final boolean hasJavaDocURL = concreteSample.hasJavaDocURL(); if (hasJavaDocURL) { LoggerFacade.getDefault().debug(this.getClass(), "A javadoc-url is defined."); // NOI18N wvJavaDocPage.getEngine().load(concreteSample.getJavaDocURL().get()); } else { LoggerFacade.getDefault().warn(this.getClass(), "No javadoc-url is defined!"); // NOI18N wvJavaDocPage.getEngine().loadContent(TemplateLoader.loadNoXyURLisDefinedTemplate(TemplateLoader.UrlType.JAVA_DOC)); } }); pt.playFromStart(); }
private void onActionShowPageOverview(ConcreteSample concreteSample) { LoggerFacade.getDefault().debug(this.getClass(), "On action show page [Overview]"); // NOI18N final PauseTransition pt = new PauseTransition(); pt.setDuration(Duration.millis(25.0d)); pt.setOnFinished(event -> { LoggerFacade.getDefault().debug(this.getClass(), "Load overview-url..."); // NOI18N final boolean hasOverviewURL = concreteSample.hasOverviewURL(); if (hasOverviewURL) { LoggerFacade.getDefault().debug(this.getClass(), "A overview-url is defined."); // NOI18N wvOverviewPage.getEngine().load(concreteSample.getOverviewURL().get()); } else { LoggerFacade.getDefault().warn(this.getClass(), "No overview-url is defined!"); // NOI18N wvOverviewPage.getEngine().loadContent(TemplateLoader.loadNoXyURLisDefinedTemplate(TemplateLoader.UrlType.OVERVIEW)); } }); pt.playFromStart(); }
private void onActionShowPageProject(final ConcreteProject concreteProject) { LoggerFacade.getDefault().debug(this.getClass(), "On action show page [Project] for: " + concreteProject.getName()); // NOI18N // Reset previous shown content in sample-view wvProjectPage.getEngine().loadContent(TemplateLoader.loadLoadingTemplate()); final PauseTransition pt = new PauseTransition(); pt.setDuration(Duration.millis(25.0d)); pt.setOnFinished(event -> { LoggerFacade.getDefault().debug(this.getClass(), "Load project-url..."); // NOI18N // Show new project-view if (concreteProject.hasProjectURL()) { LoggerFacade.getDefault().debug(this.getClass(), "A project-url is defined."); // NOI18N wvProjectPage.getEngine().load(concreteProject.getProjectURL().get()); } else { LoggerFacade.getDefault().warn(this.getClass(), "No project-url is defined!"); // NOI18N wvProjectPage.getEngine().loadContent(TemplateLoader.loadNoXyURLisDefinedTemplate(TemplateLoader.UrlType.PROJECT)); } }); pt.playFromStart(); }
private void onActionShowPageSourceCode(ConcreteSample concreteSample) { LoggerFacade.getDefault().debug(this.getClass(), "On action show page [SourceCode]"); // NOI18N final PauseTransition pt = new PauseTransition(); pt.setDuration(Duration.millis(25.0d)); pt.setOnFinished(event -> { LoggerFacade.getDefault().debug(this.getClass(), "Load sourcecode-url..."); // NOI18N final boolean hasCssURL = concreteSample.hasCssURL(); if (hasCssURL) { LoggerFacade.getDefault().debug(this.getClass(), "A sourcecode-url is defined."); // NOI18N wvSourceCodePage.getEngine().loadContent(TemplateLoader.loadSourceCodeTemplate(concreteSample.getSourceCodeURL().get())); } else { LoggerFacade.getDefault().warn(this.getClass(), "No sourcecode-url is defined!"); // NOI18N wvSourceCodePage.getEngine().loadContent(TemplateLoader.loadNoXyURLisDefinedTemplate(TemplateLoader.UrlType.SOURCE_CODE)); } }); pt.playFromStart(); }
/** * Initializes the splash screen. * * @param create * @param learn * @param open */ public Splash(Command create, Command learn, Command open) { this.create = create; this.learn = learn; this.open = open; Image image = new Image(this.getClass().getResourceAsStream(SPLASH_GIF_PATH)); ImageView iv = new ImageView(image); this.getChildren().add(iv); Scene scene = new VoogaScene(this); Stage stage = new Stage(); stage.setScene(scene); stage.initStyle(StageStyle.UNDECORATED); stage.show(); PauseTransition delay = new PauseTransition(UILauncher.SPLASH_DURATION); delay.setOnFinished(event -> { stage.close(); showSplashMessage(); }); delay.play(); }
private void onCloseRequest() { // afterburner.fx Injector.forgetAll(); // Database DatabaseFacade.INSTANCE.shutdown(); // Message final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0); final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP); final String title = this.getProperty(KEY__APPLICATION__TITLE); LoggerFacade.INSTANCE.message(borderSign, 80, String.format(message, title)); // Timer final PauseTransition pt = new PauseTransition(DURATION__125); pt.setOnFinished((ActionEvent event) -> { Platform.exit(); }); pt.playFromStart(); }
private void onCloseRequest() { // afterburner.fx Injector.forgetAll(); // Database DatabaseFacade.INSTANCE.shutdown(); // Message final char borderSign = this.getProperty(KEY__APPLICATION__BORDER_SIGN).charAt(0); final String message = this.getProperty(KEY__APPLICATION__MESSAGE_STOP); final String title = this.getProperty(KEY__APPLICATION__TITLE) + this.getProperty(KEY__APPLICATION__VERSION); LoggerFacade.INSTANCE.message(borderSign, 80, String.format(message, title)); // Timer final PauseTransition pt = new PauseTransition(DURATION__125); pt.setOnFinished((ActionEvent event) -> { Platform.exit(); }); pt.playFromStart(); }
private PauseTransition onActionStartGameMode(EGameMode gameMode) { DebugConsole.getDefault().debug(this.getClass(), "On Action start GameMode: " + gameMode.toString()); // NOI18N /* What meand start GameMode (depends on the gameMode) - GAME_MODE__PREVIEW - - GAME_MODE__ATTENTION - - GAME_MODE__REMEMBER - - GAME_MODE__SUCCESS - - GAME_MODE__ERROR - - GAME_MODE__HIGHSCORE - - GAME_MODE__HELP - */ return null; }
/** * Create a new notification * @param title The title for the window * @param imagePath Path to the icon to be displayed * @param message The message to display */ public static void makeNotification(String title, String imagePath, String message) { PopUpWindow window = new PopUpWindow(height, width, xPosition, yPosition, title); placement(true); BorderPane pane = new BorderPane(); HBox box = new HBox(); box.setAlignment(Pos.CENTER); box.setSpacing(12.0); Label label = new Label(message); pane.setCenter(box); ImageView icon = new ImageView(imagePath); icon.setPreserveRatio(true); icon.setFitHeight(32.0); box.getChildren().addAll(icon, label); window.setContent(pane); PopUpWindowManager.getInstance().addPopUpWindow(window); PauseTransition delay = new PauseTransition(Duration.seconds(time)); delay.setOnFinished( event -> {PopUpWindowManager.getInstance().removePopUpWindow(window); placement(false);}); delay.play(); }
public static void openNotification(String text) { Stage stage = new Stage(); stage.setWidth(300); stage.setHeight(125); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); NotificationView notificationView = new NotificationView(); stage.setScene(new Scene(notificationView.getNotificationView(), 300, 125)); stage.setResizable(false); stage.setAlwaysOnTop(true); stage.setX(primaryScreenBounds.getMinX() + primaryScreenBounds.getWidth() - 300); stage.setY(primaryScreenBounds.getMinY() + primaryScreenBounds.getHeight() - 125); stage.initStyle(StageStyle.UNDECORATED); notificationView.getNotificationText().setWrapText(true); notificationView.getNotificationText().setAlignment(Pos.CENTER); notificationView.getNotificationText().setPadding(new Insets(0, 5, 0, 20)); notificationView.getNotificationText().setText(text); stage.show(); PauseTransition delay = new PauseTransition(Duration.seconds(5)); delay.setOnFinished(event -> stage.close()); delay.play(); }
public static void openNotification(ClientObject client) { Stage stage = new Stage(); stage.setWidth(300); stage.setHeight(125); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); NotificationView notificationView = new NotificationView(); stage.setScene(new Scene(notificationView.getNotificationView(), 300, 125)); stage.setResizable(false); stage.setAlwaysOnTop(true); stage.setX(primaryScreenBounds.getMinX() + primaryScreenBounds.getWidth() - 300); stage.setY(primaryScreenBounds.getMinY() + primaryScreenBounds.getHeight() - 125); stage.initStyle(StageStyle.UNDECORATED); notificationView.getNotificationText().setWrapText(true); notificationView.getNotificationText().setAlignment(Pos.CENTER); notificationView.getNotificationText().setPadding(new Insets(0, 5, 0, 20)); notificationView.getNotificationText().setText("New Connection: " + client.getIP() + " (" + client.getNickName() + ")"); stage.show(); PauseTransition delay = new PauseTransition(Duration.seconds(5)); delay.setOnFinished(event -> stage.close()); delay.play(); }