use of org.controlsfx.control.NotificationPane in project tactview by helospark.
the class JavaFXUiMain method start.
@Override
public void start(Stage stage) throws IOException {
DirtyRepository dirtyRepository = lightDi.getBean(DirtyRepository.class);
ExitWithSaveService exitWithSaveService = lightDi.getBean(ExitWithSaveService.class);
StylesheetAdderService styleSheetAdder = lightDi.getBean(StylesheetAdderService.class);
styleSheetAdder.setTactviewIconForStage(stage);
JavaFXUiMain.STAGE = stage;
lightDi.getListOfBeans(MainWindowStageAware.class).forEach(listener -> listener.setMainWindowStage(stage));
NotificationPane notificationPane = new NotificationPane();
BorderPane root = new BorderPane();
Scene scene = new Scene(root, 650, 550, Color.GREY);
styleSheetAdder.addStyleSheets(root, "stylesheet.css");
MenuBar menuBar = lightDi.getBean(MenuProcessor.class).createMenuBar();
if (SystemUtils.IS_OS_MAC_OSX) {
// https://stackoverflow.com/a/28874063
menuBar.useSystemMenuBarProperty().set(true);
}
stage.setOnCloseRequest(e -> {
exitApplication(exitWithSaveService, e);
});
root.setTop(menuBar);
stage.setScene(scene);
stage.setTitle("TactView - Video editor");
dirtyRepository.addUiChangeListener(value -> {
Platform.runLater(() -> {
String title = "";
if (value) {
title += "* ";
}
title += "TactView - Video editor";
stage.setTitle(title);
});
});
stage.setMaximized(true);
if (SystemUtils.IS_OS_MAC) {
SwingFXUtils.toFXImage(new BufferedImage(100, 100, TYPE_INT_BGR), null);
}
// spacing between child nodes only.
SplitPane mainContentPane = new SplitPane();
mainContentPane.setId("content-area");
mainContentPane.setPrefWidth(scene.getWidth());
// space between vbox border and child nodes column
mainContentPane.setPadding(new Insets(1));
mainContentPane.setDividerPositions(0.6);
canvas = new Canvas();
lightDi.getBean(CanvasStateHolder.class).setCanvas(canvas);
lightDi.getBean(DefaultCanvasTranslateSetter.class).setDefaultCanvasTranslate(uiProjectRepository.getPreviewWidth(), uiProjectRepository.getPreviewHeight());
InputModeRepository inputModeRepository = lightDi.getBean(InputModeRepository.class);
inputModeRepository.setCanvas(canvas);
displayUpdateService.setCanvas(canvas);
displayUpdateService.updateCurrentPositionWithInvalidatedCache();
Tooltip tooltip = new Tooltip();
StringProperty statusTextProperty = lightDi.getBean(VideoStatusBarUpdater.class).getTextProperty();
tooltip.textProperty().bind(statusTextProperty);
tooltip.setHideOnEscape(false);
tooltip.setAutoHide(false);
tooltip.setAnchorLocation(AnchorLocation.CONTENT_TOP_LEFT);
statusTextProperty.addListener((e, oldV, newV) -> {
if (newV.length() > 0) {
Bounds canvasBottom = canvas.localToScene(canvas.getBoundsInLocal());
double x = canvasBottom.getMinX();
double y = canvasBottom.getMaxY() + 60;
tooltip.show(canvas, x, y);
} else {
tooltip.hide();
}
});
tooltip.setWrapText(true);
HBox upperPane = new HBox();
upperPane.setId("upper-content-area");
upperPane.setMinHeight(300);
upperPane.setFillHeight(true);
DetachableTabPaneLoadModel layoutToLoad = lightDi.getBean(DefaultLayoutProvider.class).provideDefaultLayout();
DockableTabRepository dockableTabRepository = lightDi.getBean(DockableTabRepository.class);
dockableTabRepository.setParentPane(upperPane);
dockableTabRepository.loadAndSetModelToParent(layoutToLoad);
TiwulFXUtil.setTiwulFXStyleSheet(scene);
VBox lower = new VBox(5);
lower.setPrefWidth(scene.getWidth());
lower.setPrefHeight(300);
lower.setId("timeline-view");
BorderPane timeline = uiTimeline.createTimeline(lower, root);
lower.getChildren().add(timeline);
VBox.setVgrow(timeline, Priority.ALWAYS);
mainContentPane.getItems().add(upperPane);
mainContentPane.getItems().add(lower);
mainContentPane.setOrientation(Orientation.VERTICAL);
root.setCenter(mainContentPane);
notificationPane.setContent(root);
inputModeRepository.registerInputModeChangeConsumerr(onClassChangeDisableTabs());
inputModeRepository.registerInputModeChangeConsumerr(onClassChange(timeline));
lightDi.getListOfBeans(ScenePostProcessor.class).stream().forEach(processor -> processor.postProcess(scene));
lightDi.getListOfBeans(PostInitializationArgsCallback.class).forEach(postInitCallback -> postInitCallback.call(mainArgs));
if (splashStage.isShowing()) {
stage.show();
splashStage.toFront();
FadeTransition fadeSplash = new FadeTransition(Duration.seconds(0.5), splasViewh);
fadeSplash.setDelay(Duration.millis(800));
fadeSplash.setFromValue(1.0);
fadeSplash.setToValue(0.0);
fadeSplash.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
splashStage.hide();
}
});
fadeSplash.play();
}
}
use of org.controlsfx.control.NotificationPane in project controlsfx by controlsfx.
the class HelloNotificationPane method getPanel.
@Override
public Node getPanel(Stage stage) {
notificationPane = new NotificationPane();
String imagePath = HelloNotificationPane.class.getResource("notification-pane-warning.png").toExternalForm();
ImageView image = new ImageView(imagePath);
notificationPane.setGraphic(image);
notificationPane.getActions().addAll(new Action("Sync", ae -> {
// do sync
// then hide...
notificationPane.hide();
}));
Button showBtn = new Button("Show / Hide");
showBtn.setOnAction(e -> {
if (notificationPane.isShowing()) {
notificationPane.hide();
} else {
notificationPane.show();
}
});
CheckBox cbSlideFromTop = new CheckBox("Slide from top");
cbSlideFromTop.setSelected(true);
notificationPane.showFromTopProperty().bind(cbSlideFromTop.selectedProperty());
cbUseDarkTheme = new CheckBox("Use dark theme");
cbUseDarkTheme.setSelected(false);
cbUseDarkTheme.setOnAction(e -> updateBar());
cbHideCloseBtn = new CheckBox("Hide close button");
cbHideCloseBtn.setSelected(false);
cbHideCloseBtn.setOnAction(e -> notificationPane.setCloseButtonVisible(!cbHideCloseBtn.isSelected()));
textField = new TextField();
textField.setPromptText("Type text to display and press Enter");
textField.setOnAction(e -> notificationPane.show(textField.getText()));
VBox root = new VBox(10);
root.setPadding(new Insets(50, 0, 0, 10));
root.getChildren().addAll(showBtn, cbSlideFromTop, cbUseDarkTheme, cbHideCloseBtn, textField);
notificationPane.setContent(root);
updateBar();
return notificationPane;
}
Aggregations