mybatisOverrides = new LinkedHashMap<>();
- // ---- 字体大小(显示设置) ----
- private int fontSectionTitle = 24; // 节标题
- private int fontFieldLabel = 20; // 字段标签
- private int fontButton = 20; // 按钮
- private int fontBody = 20; // 正文/提示
- private int fontMono = 20; // 等宽/代码
+ // ---- 字体大小(显示设置)10级 Token 体系 ----
+ private int fontH1 = 28; // 页面主标题
+ private int fontH2 = 22; // 区块标题
+ private int fontH3 = 18; // 子标题
+ private int fontBody = 15; // 正文/标签
+ private int fontSmall = 13; // 辅助文字/提示
+ private int fontCaption = 11; // 脚注/版本号
+ private int fontMono = 14; // 等宽/代码
+ private int fontBtnLg = 16; // 主按钮
+ private int fontBtn = 14; // 普通按钮
+ private int fontBtnSm = 12; // 小按钮
+
+ // ---- 向后兼容旧名 getter(供未迁移的窗口文件使用) ----
+ @Deprecated public int getFontSectionTitle() { return fontH2; }
+ @Deprecated public int getFontFieldLabel() { return fontBody; }
+ @Deprecated public int getFontButton() { return fontBtn; }
+ // getFontBody() / getFontMono() 由 Lombok 按新字段名自动生成
+
+ // ---- 主题 ----
+ private String theme = "light"; // light | dark
+
+ // ---- 默认数据源 ----
+ private String defaultDatasource;
// ==================== 外部配置加载 ====================
@@ -147,17 +164,28 @@ public class WorkUtilsProperties {
}
}
- // 字体大小
- applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_SECTION_TITLE, v -> this.fontSectionTitle = v);
- applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_FIELD_LABEL, v -> this.fontFieldLabel = v);
- applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_BUTTON, v -> this.fontButton = v);
- applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_BODY, v -> this.fontBody = v);
- applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_MONO, v -> this.fontMono = v);
+ // 字体大小(新键优先,旧键作为 fallback)
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_H1, v -> this.fontH1 = v);
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_H2, v -> this.fontH2 = v);
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_H3, v -> this.fontH3 = v);
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_BODY, v -> this.fontBody = v);
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_SMALL, v -> this.fontSmall = v);
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_CAPTION, v -> this.fontCaption = v);
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_MONO, v -> this.fontMono = v);
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_BTN_LG, v -> this.fontBtnLg = v);
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_BTN, v -> this.fontBtn = v);
+ applyIntIfPresent(external, ExternalConfigManager.KEY_FONT_BTN_SM, v -> this.fontBtnSm = v);
+
+ // 主题
+ applyIfPresent(external, ExternalConfigManager.KEY_THEME, v -> this.theme = v);
+
+ // 默认数据源
+ applyIfPresent(external, ExternalConfigManager.KEY_DEFAULT_DATASOURCE, v -> this.defaultDatasource = v);
log.info("外部配置已合并: base={}, export={}, projectPaths={}, damagedRepos={}, mybatisOverrides={}, "
- + "fontSizes=[title={},label={},btn={},body={},mono={}]",
+ + "fontSizes=[h1={},h2={},h3={},body={},small={},caption={},mono={},btnLg={},btn={},btnSm={}]",
baseDirectory, exportDirectory, projectPathsFile, damagedReposFile, mybatisOverrides.size(),
- fontSectionTitle, fontFieldLabel, fontButton, fontBody, fontMono);
+ fontH1, fontH2, fontH3, fontBody, fontSmall, fontCaption, fontMono, fontBtnLg, fontBtn, fontBtnSm);
}
/** 回退到 application.yml 默认值 */
@@ -167,11 +195,18 @@ public class WorkUtilsProperties {
projectPathsFile = defaults.get(ExternalConfigManager.KEY_PROJECT_PATHS);
damagedReposFile = defaults.get(ExternalConfigManager.KEY_DAMAGED_REPOS);
mybatisOverrides.clear();
- fontSectionTitle = 24;
- fontFieldLabel = 20;
- fontButton = 20;
- fontBody = 20;
- fontMono = 20;
+ fontH1 = 28;
+ fontH2 = 22;
+ fontH3 = 18;
+ fontBody = 15;
+ fontSmall = 13;
+ fontCaption = 11;
+ fontMono = 14;
+ fontBtnLg = 16;
+ fontBtn = 14;
+ fontBtnSm = 12;
+ theme = "light";
+ defaultDatasource = null;
log.info("配置已重置为默认值");
}
diff --git a/src/main/java/com/example/workutils/system/ui/MainWindow.java b/src/main/java/com/example/workutils/system/ui/MainWindow.java
index e2f2d2c..301e617 100644
--- a/src/main/java/com/example/workutils/system/ui/MainWindow.java
+++ b/src/main/java/com/example/workutils/system/ui/MainWindow.java
@@ -18,10 +18,9 @@ import javafx.stage.Stage;
import java.util.*;
/**
- * 工作工具集主窗口 —— 专业版设计
+ * 工作工具集主窗口 —— AtlantaFX 重构版
*
- * 左侧导航栏(slate-800) + 右侧内容区(slate-50)。
- * 插件默认内嵌运行,顶部统一工具栏提供「弹出」「关闭」。
+ * 左侧导航栏 + 右侧内容区,使用 CSS 类控制样式。
*/
public class MainWindow {
@@ -46,7 +45,7 @@ public class MainWindow {
private final List