🎉 init project
This commit is contained in:
parent
964a72fe44
commit
8a8b58c80f
@ -59,7 +59,7 @@ public class AppUI extends Application {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
public void start(Stage stage) {
|
||||
Thread.currentThread().setUncaughtExceptionHandler(new DefaultExceptionHandler(stage));
|
||||
loadApplicationProperties();
|
||||
|
||||
|
@ -2,10 +2,12 @@ package com.cecilia.view.window;
|
||||
|
||||
import animatefx.animation.BounceInRight;
|
||||
import atlantafx.base.controls.Message;
|
||||
import atlantafx.base.controls.ModalPane;
|
||||
import atlantafx.base.theme.Styles;
|
||||
import atlantafx.base.util.Animations;
|
||||
import com.cecilia.view.loginregister.LoginRegisterView;
|
||||
import com.cecilia.view.loginregister.LoginRegisterViewModel;
|
||||
import com.goxr3plus.fxborderlessscene.borderless.BorderlessScene;
|
||||
import de.saxsys.mvvmfx.*;
|
||||
import javafx.animation.KeyFrame;
|
||||
import javafx.animation.Timeline;
|
||||
@ -42,12 +44,16 @@ public class WindowView implements FxmlView<WindowViewModel>, Initializable {
|
||||
private StackPane rootPane;
|
||||
@FXML
|
||||
private StackPane contentPane;
|
||||
public static final String MAIN_MODAL_ID = "modal-pane";
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
|
||||
messagePane.visibleProperty().bindBidirectional(windowViewModel.mainViewVisbleProperty());
|
||||
var modalPane = new ModalPane();
|
||||
modalPane.setId(MAIN_MODAL_ID);
|
||||
rootPane.getChildren().add(0, modalPane);
|
||||
//messagePane.visibleProperty().bindBidirectional(windowViewModel.mainViewVisbleProperty());
|
||||
MvvmFX.getNotificationCenter().subscribe("showMainView", (key, payload) -> {
|
||||
// trigger some actions
|
||||
Platform.runLater(() -> {
|
||||
@ -66,35 +72,28 @@ public class WindowView implements FxmlView<WindowViewModel>, Initializable {
|
||||
|
||||
MvvmFX.getNotificationCenter().subscribe("message", (key, payload) -> {
|
||||
// trigger some actions
|
||||
|
||||
Platform.runLater(() -> {
|
||||
showMessage((Integer) payload[0], (String) payload[1]);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
MvvmFX.getNotificationCenter().subscribe("exit", (key, payload) -> {
|
||||
// trigger some actions
|
||||
|
||||
Platform.runLater(() -> {
|
||||
Stage stage = (Stage) rootPane.getScene().getWindow();
|
||||
|
||||
stage.close();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
showLoginView();
|
||||
|
||||
}
|
||||
|
||||
private void showMainView() {
|
||||
|
||||
contentPane.getChildren().clear();
|
||||
ViewTuple<MainView, MainViewModel> load = FluentViewLoader.fxmlView(MainView.class).load();
|
||||
contentPane.getChildren().add(load.getView());
|
||||
windowViewModel.mainViewVisbleProperty().setValue(true);
|
||||
if (contentPane.getScene() instanceof BorderlessScene) {
|
||||
((BorderlessScene) contentPane.getScene()).maximizeStage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -110,9 +109,8 @@ public class WindowView implements FxmlView<WindowViewModel>, Initializable {
|
||||
|
||||
if (windowViewModel.isMainViewVisble()) {
|
||||
Platform.runLater(() -> {
|
||||
|
||||
|
||||
Message message = null;
|
||||
|
||||
if (code == HttpStatus.SUCCESS) {
|
||||
message = new Message("消息提示", msg, new FontIcon(Material2OutlinedAL.CHECK_CIRCLE_OUTLINE));
|
||||
message.getStyleClass().addAll(Styles.SUCCESS);
|
||||
@ -122,26 +120,26 @@ public class WindowView implements FxmlView<WindowViewModel>, Initializable {
|
||||
}
|
||||
message.setPrefHeight(Region.USE_PREF_SIZE);
|
||||
message.setMaxHeight(Region.USE_PREF_SIZE);
|
||||
message.setMaxWidth(Region.USE_PREF_SIZE);
|
||||
StackPane.setAlignment(message, Pos.TOP_RIGHT);
|
||||
StackPane.setMargin(message, new Insets(10, 10, 0, 0));
|
||||
StackPane.setMargin(message, new Insets(60, 10, 0, 0));
|
||||
|
||||
Message finalMessage = message;
|
||||
message.setOnClose(e -> {
|
||||
var out = Animations.slideOutUp(finalMessage, Duration.millis(250));
|
||||
out.setOnFinished(f -> messagePane.getChildren().remove(finalMessage));
|
||||
out.setOnFinished(f -> rootPane.getChildren().remove(finalMessage));
|
||||
out.playFromStart();
|
||||
});
|
||||
// var in = Animations.slideInDown(message, Duration.millis(250));
|
||||
if (!messagePane.getChildren().contains(message)) {
|
||||
messagePane.getChildren().add(message);
|
||||
if (!rootPane.getChildren().contains(message)) {
|
||||
rootPane.getChildren().add(message);
|
||||
}
|
||||
new BounceInRight(message).play();
|
||||
|
||||
Timeline fiveSecondsWonder = new Timeline(new KeyFrame(Duration.seconds(5), new EventHandler<ActionEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
var out = Animations.slideOutUp(finalMessage, Duration.millis(250));
|
||||
out.setOnFinished(f -> messagePane.getChildren().remove(finalMessage));
|
||||
out.setOnFinished(f -> rootPane.getChildren().remove(finalMessage));
|
||||
out.playFromStart();
|
||||
}
|
||||
}));
|
||||
|
@ -1,27 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<StackPane fx:id="rootPane" prefHeight="455.0" prefWidth="539.0" styleClass="window-view" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.cecilia.view.window.WindowView">
|
||||
<children>
|
||||
<Pane fx:id="backgroundPane" prefHeight="200.0" prefWidth="200.0" />
|
||||
<Pane fx:id="backgroundImgPane" prefHeight="200.0" prefWidth="200.0" />
|
||||
<StackPane fx:id="contentPane" prefHeight="150.0" prefWidth="200.0" />
|
||||
<BorderPane pickOnBounds="false" StackPane.alignment="TOP_RIGHT">
|
||||
<right>
|
||||
<VBox fx:id="messagePane" alignment="TOP_CENTER" minWidth="240.0" pickOnBounds="false" prefHeight="200.0" prefWidth="100.0" spacing="10.0" BorderPane.alignment="CENTER">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
<padding>
|
||||
<Insets top="60.0" />
|
||||
</padding>
|
||||
</VBox>
|
||||
</right>
|
||||
</BorderPane>
|
||||
<StackPane fx:id="contentPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="150.0" prefWidth="200.0" />
|
||||
</children>
|
||||
</StackPane>
|
Loading…
x
Reference in New Issue
Block a user