diff --git a/pom.xml b/pom.xml index 882fede3a350c0b121878919e98fbe45bad37825..de51eb22d77689157e41cfc66f8d6f56b4588bf6 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,11 @@ ikonli-antdesignicons-pack 12.3.1 + + org.kordamp.ikonli + ikonli-bootstrapicons-pack + 12.3.1 + diff --git a/src/main/java/com/light/GitManagerApp.java b/src/main/java/com/light/GitManagerApp.java index 6cccd4f8092502dfb5bc898aa0d42497f3696136..9ca069629c4c29713cd02d18323ec25475641292 100644 --- a/src/main/java/com/light/GitManagerApp.java +++ b/src/main/java/com/light/GitManagerApp.java @@ -11,6 +11,7 @@ import javafx.scene.image.Image; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; +import javafx.scene.layout.StackPane; import javafx.stage.Stage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,7 +26,7 @@ public class GitManagerApp extends Application { Application.setUserAgentStylesheet(new PrimerLight().getUserAgentStylesheet()); // 根节点 - AnchorPane root = new AnchorPane(); + StackPane root = new StackPane(); // 左右布局 HBox container = new HBox(); @@ -40,8 +41,10 @@ public class GitManagerApp extends Application { NodeUtils.setAnchors(root, Insets.EMPTY); // 场景 - Scene scene = new Scene(root, 1000, 600); + Scene scene = new Scene(root); stage.setTitle("Git批量管理工具"); + stage.setMinWidth(1100); + stage.setMinHeight(650); stage.getIcons().add(new Image(this.getClass().getResource("/icons/git.png").toExternalForm())); stage.setScene(scene); stage.show(); diff --git a/src/main/java/com/light/layout/MenuPane.java b/src/main/java/com/light/layout/MenuPane.java index 95bc34872a5e62163df6b65d060b209261dc75f3..f2cd33c1f4ad74ed33b74129d5e8127552630c1b 100644 --- a/src/main/java/com/light/layout/MenuPane.java +++ b/src/main/java/com/light/layout/MenuPane.java @@ -9,6 +9,7 @@ import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import org.kordamp.ikonli.antdesignicons.AntDesignIconsFilled; import org.kordamp.ikonli.antdesignicons.AntDesignIconsOutlined; +import org.kordamp.ikonli.bootstrapicons.BootstrapIcons; import org.kordamp.ikonli.javafx.FontIcon; import java.util.Optional; @@ -26,9 +27,9 @@ public class MenuPane extends StackPane { private final ListView dynamicMenu = new ListView<>(); // 底部导航栏 - private final Label userLabel = new Label("test"); - private final Label emailLabel = new Label("test@163.com"); - private final VBox bottomMenu = new VBox(userLabel, emailLabel); + private final Label downloadLabel = new Label("正在下载", new FontIcon(BootstrapIcons.ARROW_DOWN)); + private final Label updateLabel = new Label("正在更新", new FontIcon(BootstrapIcons.ARROW_DOWN)); + private final VBox bottomMenu = new VBox(downloadLabel, updateLabel); private VBox asideContainer = new VBox(topMenu, new Separator(Orientation.HORIZONTAL), dynamicMenu, new Separator(Orientation.HORIZONTAL), bottomMenu); @@ -38,26 +39,29 @@ public class MenuPane extends StackPane { this.contentPane = contentPane; initialize(); - // 模拟数据 + // 菜单栏标题 dynamicMenu.getItems().addAll( new NavItem(new FontIcon(AntDesignIconsOutlined.HOME), "首页", null), new NavItem(new FontIcon(AntDesignIconsOutlined.PARTITION), "管理", null), new NavItem(new FontIcon(AntDesignIconsOutlined.EDIT), "笔记", null) ); + dynamicMenu.getSelectionModel().selectFirst(); } private void initialize() { // 加载样式 getStylesheets().add(STYLE_SHEET); + // 添加侧边栏,设置menu菜单自动伸缩 getChildren().addAll(asideContainer); VBox.setVgrow(dynamicMenu, Priority.ALWAYS); // 添加样式 this.asideContainer.getStyleClass().add("aside"); this.dynamicMenu.getStyleClass().add("menu"); - this.userLabel.getStyleClass().add("user-label"); - this.emailLabel.getStyleClass().add("email-label"); + this.bottomMenu.getStyleClass().add("down-update"); + this.downloadLabel.getStyleClass().add("download-label"); + this.updateLabel.getStyleClass().add("update-label"); // 加上监听 dynamicMenu.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index fbb190d889513c5c1b4e6f956a5319cddb9b4dac..f359b55985c735897466ef180dd106743a23c4b1 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -10,4 +10,5 @@ open module com.leo { requires org.kordamp.ikonli.javafx; requires org.jetbrains.annotations; requires org.kordamp.ikonli.antdesignicons; + requires org.kordamp.ikonli.bootstrapicons; } diff --git a/src/main/resources/css/menu.css b/src/main/resources/css/menu.css index 72b0fa2c35d94a91d04779daf485a13e72cbb4fc..e11cca9bb3e2121e55b140279576d95e106c70e2 100644 --- a/src/main/resources/css/menu.css +++ b/src/main/resources/css/menu.css @@ -3,7 +3,7 @@ .aside { /*-fx-min-width: 220px; -fx-max-width: 220px;*/ - -fx-pref-width: 220px; + -fx-pref-width: 200px; -fx-border-width: 0 1px 0 0; -fx-border-color: -cf-border-color; -fx-spacing: 5px; @@ -85,72 +85,26 @@ -fx-icon-color: -cf-primary-color; } -.user-label, .email-label { - -fx-font-size: 13px; - -fx-font-weight: bolder; - -fx-text-fill: -cf-text-color; -} - -.email-label { - -fx-font-weight: lighter; - -fx-text-fill: derive(-cf-text-color, 40%); -} - -/* 滚动条样式 */ -.scroll-bar-style { - -fx-background-color: transparent; -} - -.scroll-bar-style > .viewport { - -fx-background-color: transparent; -} - -.scroll-bar-style .scroll-bar { - /*-fx-block-increment:10000;*/ - -fx-unit-increment: 20; - -fx-background-color: transparent; -} - -.scroll-bar-style .scroll-bar > .decrement-button > .decrement-arrow, -.scroll-bar-style .scroll-bar > .increment-button > .increment-arrow { - -fx-background-color: transparent; -} - -.scroll-bar-style .scroll-bar:vertical > .decrement-button, -.scroll-bar-style .scroll-bar:vertical > .increment-button { - -fx-pref-height: 0px; - -fx-pref-width: 0.01px; -} - -.scroll-bar-style .scroll-bar:horizontal > .decrement-button, -.scroll-bar-style .scroll-bar:horizontal > .increment-button { - -fx-pref-width: 0px; - -fx-pref-height: 0.01px; -} - -.scroll-bar-style .scroll-bar > .track { - -fx-background-radius: 0px; - -fx-background-color: transparent; -} - -.scroll-bar-style .scroll-bar:vertical > .thumb, .scroll-bar-style .scroll-bar:horizontal > .thumb { - -fx-background-color: rgba(0, 0, 0, 0.2); - -fx-background-insets: 0px; - -fx-background-radius: 3px; -} - -.scroll-bar-style .scroll-bar:vertical { - -fx-padding: 6px 0px 6px 0px; +/*正在下载,正在更新box*/ +.down-update { + -fx-alignment: center-left; + -fx-spacing: 10px; + -fx-padding: 0 10px; + -fx-min-height: 40px; + -fx-pref-height: 40px; } -.scroll-bar-style .scroll-bar:horizontal { - -fx-padding: 0px 6px 0px 6px; +.download-label, .update-label { + -fx-font-size: 14px; + -fx-text-fill: -cf-text-color; } -.scroll-bar-style .scroll-bar:vertical > .thumb, .scroll-bar-style .scroll-bar:vertical > .track { - -fx-background-insets: 0px 0px 0px -6px; +.download-label > .ikonli-font-icon { + -fx-icon-size: 14px; + -fx-icon-color: -cf-primary-color; } -.scroll-bar-style .scroll-bar:horizontal > .thumb, .scroll-bar-style .scroll-bar:horizontal > .track { - -fx-background-insets: -6px 0px 0px 0px; +.update-label > .ikonli-font-icon { + -fx-icon-size: 14px; + -fx-icon-color: -cf-success-color; } \ No newline at end of file