From 0b7c65a5650c17ebf3f256c6789da632c64b294c Mon Sep 17 00:00:00 2001 From: jinsihou <540097546@qq.com> Date: Sat, 16 Dec 2023 15:15:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-99485=20=E4=BF=AE=E5=A4=8D=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E9=97=AE=E9=A2=98=201.=20storybook=E5=9C=A8windows?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E6=A0=87=E7=AD=BE=E5=AD=97=E4=BD=93=E7=BC=A9?= =?UTF-8?q?=E6=94=BE=202.=20uibutton=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/component/CustomSortPane.java | 8 ++++---- .../fr/design/gui/storybook/StoryBoard.java | 18 ++++++++++++++++- .../fr/design/gui/storybook/Storybook.java | 3 ++- .../components/ButtonTabStoryBoard.java | 12 +++++------ .../components/CheckBoxStoryBoard.java | 6 +++--- .../components/ComboBoxStoryBoard.java | 4 ++-- .../storybook/components/InputStoryBoard.java | 20 +++++++++---------- .../components/RadioButtonStoryBoard.java | 4 ++-- .../components/SliderStoryBoard.java | 2 +- .../components/ToolTipStoryBoard.java | 6 +++--- .../components/UIHeadGroupStoryBoard.java | 8 ++++---- .../main/java/com/fr/start/MainDesigner.java | 6 +++--- 12 files changed, 57 insertions(+), 40 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java index 9e2af09379..92483988d7 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/component/CustomSortPane.java @@ -74,10 +74,10 @@ public class CustomSortPane extends JPanel { } private void createToolbarPane() { - top = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top.svg"), false); - bottom = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom.svg"), false); - up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg"), false); - down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg"), false); + top = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top.svg")); + bottom = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom.svg")); + up = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up.svg")); + down = new UIButton(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/down.svg")); top.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/top_disable.svg")); bottom.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/bottom_disable.svg")); up.setDisabledIcon(IconUtils.readIcon("com/fr/design/mainframe/alphafine/images/up_disable.svg")); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/StoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/StoryBoard.java index ad7f04aa32..33d9a9c32e 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/StoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/StoryBoard.java @@ -25,6 +25,22 @@ public class StoryBoard extends Column { public StoryBoard(String title) { this.title = title; setSpacing(4); - add(cell(new UILabel(title)).with(it -> it.setFont(labelFont.deriveFont(16f).deriveFont(Font.BOLD)))); + add(cell(new UILabel(title)).with(it -> it.setFont(h2()))); + } + + protected Font h1() { + return font("h1.font"); + } + + protected Font h2() { + return font("h2.font"); + } + + protected Font h3() { + return font("h3.font"); + } + + private Font font(String key) { + return UIManager.getFont(key); } } diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java b/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java index 0ff8c70a66..2598932c06 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/Storybook.java @@ -8,6 +8,7 @@ import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLightLaf; import com.formdev.flatlaf.extras.FlatAnimatedLafChange; import com.formdev.flatlaf.util.ScaledEmptyBorder; +import com.formdev.flatlaf.util.UIScale; import com.fr.design.gui.UILookAndFeel; import com.fr.value.NotNullLazyValue; @@ -60,7 +61,7 @@ public class Storybook { public void start() { FineLightLaf.setup(); - jf = new JFrame("Story Book"); + jf = new JFrame("Story Book(dpi scale:" + UIScale.getUserScaleFactor() * 100 + "%)"); jf.setJMenuBar(initMenu()); jf.add(row( cell(new JList<>(StoryBookComponent.getValue())).with(it -> { diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java index 8f9fe8bdbe..4e2429e577 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java @@ -25,17 +25,17 @@ public class ButtonTabStoryBoard extends StoryBoard { public ButtonTabStoryBoard() { super("切换按钮组"); add( - cell(new UILabel("单行文字按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("单行文字按钮")).with(it -> it.setFont(h3())), cell(new UIButtonGroup<>(new String[]{"按钮1", "按钮2", "按钮3"})), - cell(new UILabel("单行图标按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("单行图标按钮")).with(it -> it.setFont(h3())), cell(new UIButtonGroup<>(iconArray())), - cell(new UILabel("选中切换图标按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("选中切换图标按钮")).with(it -> it.setFont(h3())), cell(new UIButtonGroup<>(iconArrayWithWhite())), - cell(new UILabel("多行按钮-偶数场景-6按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("多行按钮-偶数场景-6按钮")).with(it -> it.setFont(h3())), cell(new UITabGroup(sixTextArray())), - cell(new UILabel("多行按钮-奇数场景-5按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("多行按钮-奇数场景-5按钮")).with(it -> it.setFont(h3())), cell(new UITabGroup(fiveTextArray())), - cell(new UILabel("多行按钮-奇数场景-7按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("多行按钮-奇数场景-7按钮")).with(it -> it.setFont(h3())), cell(new UITabGroup(sevenTextArray())), flex() ); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java index 0ea08447b3..35be78304c 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java @@ -27,21 +27,21 @@ public class CheckBoxStoryBoard extends StoryBoard { public CheckBoxStoryBoard() { super("复选按钮"); add( - cell(new UILabel("水平布局")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("水平布局")).with(it -> it.setFont(h3())), row(10, cell(new UICheckBox("测试1")), cell(new UICheckBox("测试2")), cell(new UICheckBox("测试3")) ), fix(5), - cell(new UILabel("垂直布局")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("垂直布局")).with(it -> it.setFont(h3())), column(5, cell(new UICheckBox("测试1")), cell(new UICheckBox("测试2")), cell(new UICheckBox("测试3")) ), fix(5), - cell(new UILabel("禁用状态")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("禁用状态")).with(it -> it.setFont(h3())), row(10, cell(getDisabledStatus(new UICheckBox("测试"))), cell(getDisabledSelectedStatus(new UICheckBox("测试"))) diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java index 34c3554950..26dc7b7a72 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java @@ -23,11 +23,11 @@ public class ComboBoxStoryBoard extends StoryBoard { super("下拉选择框"); add( - cell(new UILabel("普通状态")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("普通状态")).with(it -> it.setFont(h3())), cell(new UIComboBox( ArrayUtils.toArray("测试1", "测试2", "测试3", "测试4") )), - cell(new UILabel("禁用状态")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("禁用状态")).with(it -> it.setFont(h3())), cell(getDisabledStatus()), flex() ); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/InputStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/InputStoryBoard.java index 1c700ba1aa..013b06b81f 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/InputStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/InputStoryBoard.java @@ -21,13 +21,13 @@ public class InputStoryBoard extends StoryBoard { public InputStoryBoard() { super("输入框"); add( - cell(new UILabel("文本框")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("文本框")).with(it -> it.setFont(h3())), cell(new UITextField("文本")), - cell(new UILabel("文本框-禁用")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("文本框-禁用")).with(it -> it.setFont(h3())), cell(new UITextField("文本")).with(it -> it.setEnabled(false)), - cell(new UILabel("文本域")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("文本域")).with(it -> it.setFont(h3())), cell(new UITextArea("下面一些近期重要通知公告、常用CRM&KMS页面链接,希望可以帮到你哦~ " + "或者你可以找我的两个好兄弟“Fine人事”、“ISC服务平台Fine人事”的工位在“企业微信工作台-ISC”下面," + "菜单栏里的内容可以解答一些常见问题 ISC服务平台”的工位在“CRM主页”," + @@ -35,7 +35,7 @@ public class InputStoryBoard extends StoryBoard { "常用入口的服务平台,如有意见建议,欢迎多多反馈Jewel-朱朱~如果觉得我可以帮到你," + "请滑到页面左下角给我点个赞吧(#^.^#)")), - cell(new UILabel("文本域-禁用")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("文本域-禁用")).with(it -> it.setFont(h3())), cell(new UITextArea("下面一些近期重要通知公告、常用CRM&KMS页面链接," + "希望可以帮到你哦~ 或者你可以找我的两个好兄弟“Fine人事”、" + "“ISC服务平台Fine人事”的工位在“企业微信工作台-ISC”下面," + @@ -44,25 +44,25 @@ public class InputStoryBoard extends StoryBoard { "常用入口的服务平台,如有意见建议,欢迎多多反馈Jewel-朱朱~如果觉得我可以帮到你," + "请滑到页面左下角给我点个赞吧(#^.^#)")).with(it -> it.setEnabled(false)), - cell(new UILabel("数字步进(0~100,步长:1)")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("数字步进(0~100,步长:1)")).with(it -> it.setFont(h3())), cell(new UISpinner(0, 100, 1, 50)), - cell(new UILabel("数字步进-禁用")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("数字步进-禁用")).with(it -> it.setFont(h3())), cell(new UISpinner(0, 100, 1, 50)).with(it -> it.setEnabled(false)), - cell(new UILabel("搜索框")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("搜索框")).with(it -> it.setFont(h3())), cell(new FineSearchPane()), - cell(new UILabel("搜索框-禁用")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("搜索框-禁用")).with(it -> it.setFont(h3())), cell(new FineSearchPane()).with(it -> { it.setEnabled(false); it.setText("搜索文本"); }), - cell(new UILabel("输入框-更多,带按钮")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("输入框-更多,带按钮")).with(it -> it.setFont(h3())), cell(new AccessibleBackgroundEditor()), - cell(new UILabel("输入框-更多,带按钮-禁用")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("输入框-更多,带按钮-禁用")).with(it -> it.setFont(h3())), cell(new AccessibleBackgroundEditor()).with(it -> it.setEnabled(false)) ); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java index a3db59e1b3..d670ec16f3 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java @@ -24,7 +24,7 @@ public class RadioButtonStoryBoard extends StoryBoard { public RadioButtonStoryBoard() { super("单选按钮"); add( - cell(new UILabel("普通")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("普通")).with(it -> it.setFont(h3())), row(10, cell(new UIRadioButton("选项一")).with(it -> { buttonGroup.add(it); @@ -33,7 +33,7 @@ public class RadioButtonStoryBoard extends StoryBoard { cell(new UIRadioButton("选项二")).with(it -> buttonGroup.add(it)), cell(new UIRadioButton("选项三")).with(it -> buttonGroup.add(it)) ), - cell(new UILabel("禁用状态")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("禁用状态")).with(it -> it.setFont(h3())), row(10, cell(new UIRadioButton("选项一")).with(it -> { buttonGroup1.add(it); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/SliderStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/SliderStoryBoard.java index 7f1c401837..48282849f1 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/SliderStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/SliderStoryBoard.java @@ -17,7 +17,7 @@ public class SliderStoryBoard extends StoryBoard { public SliderStoryBoard() { super("滑块"); add( - cell(new UILabel("面板缩放滑块")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("面板缩放滑块")).with(it -> it.setFont(h3())), row(cell(new JFormSliderPane())) ); } diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ToolTipStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ToolTipStoryBoard.java index 747fff41c3..9f318683b4 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ToolTipStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ToolTipStoryBoard.java @@ -17,14 +17,14 @@ public class ToolTipStoryBoard extends StoryBoard { public ToolTipStoryBoard() { super("提示框"); add( - cell(new UILabel("组件启用状态下的提示")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("组件启用状态下的提示")).with(it -> it.setFont(h3())), cell(new UIButton("组件")).with(it -> it.setToolTipText("组件启用状态下的提示")), - cell(new UILabel("组件禁用状态下的提示")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("组件禁用状态下的提示")).with(it -> it.setFont(h3())), cell(new UIButton("组件")).with(it -> { it.setEnabled(false); it.setToolTipText("组件禁用状态下的提示"); }), - cell(new UILabel("较长提示")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("较长提示")).with(it -> it.setFont(h3())), cell(new UIButton("组件")).with(it -> it.setToolTipText("下面一些近期重要通知公告、常用CRM&KMS页面链接," + "希望可以帮到你哦~ 或者你可以找我的两个好兄弟“Fine人事”、" + "“ISC服务平台Fine人事”的工位在“企业微信工作台-ISC”下面," + diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/UIHeadGroupStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/UIHeadGroupStoryBoard.java index fb827881b4..b6cbde028c 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/UIHeadGroupStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/UIHeadGroupStoryBoard.java @@ -24,13 +24,13 @@ public class UIHeadGroupStoryBoard extends StoryBoard { public UIHeadGroupStoryBoard() { super("属性面板&导入数据集tab"); add( - cell(new UILabel("文字Tab")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("文字Tab")).with(it -> it.setFont(h3())), cell(new UIHeadGroup(new String[]{"左按钮", "右按钮"})), - cell(new UILabel("图标Tab")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("图标Tab")).with(it -> it.setFont(h3())), cell(new UIHeadGroup(iconList())), - cell(new UILabel("文字Tab带禁用")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("文字Tab带禁用")).with(it -> it.setFont(h3())), cell(new UIHeadGroup(iconList2())), - cell(new UILabel("文字图标Tab带禁用")).with(it -> it.setFont(labelFont.deriveFont(14f))), + cell(new UILabel("文字图标Tab带禁用")).with(it -> it.setFont(h3())), cell(new UIHeadGroup(iconList3())), flex() ); diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 03e96c8d2c..21b6c7eed4 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -312,7 +312,7 @@ public class MainDesigner extends BaseDesigner { private void createSaveButton() { - saveButton = new UIButton(new LazyIcon("save"), true); + saveButton = new UIButton(new LazyIcon("save")); saveButton.setToolTipText(KeySetUtils.SAVE_TEMPLATE.getMenuKeySetName()); saveButton.set4ToolbarButton(); saveButton.addActionListener(new ActionListener() { @@ -329,7 +329,7 @@ public class MainDesigner extends BaseDesigner { private void createUndoButton() { - undo = new UIButton(new LazyIcon("undo"), true); + undo = new UIButton(new LazyIcon("undo")); undo.setToolTipText(KeySetUtils.UNDO.getMenuKeySetName()); undo.set4ToolbarButton(); undo.addActionListener(new ActionListener() { @@ -344,7 +344,7 @@ public class MainDesigner extends BaseDesigner { } private void createRedoButton() { - redo = new UIButton(new LazyIcon("redo"), true); + redo = new UIButton(new LazyIcon("redo")); redo.setToolTipText(KeySetUtils.REDO.getMenuKeySetName()); redo.set4ToolbarButton(); redo.addActionListener(new ActionListener() { From 2bb52f45e94b5a606d52e733618cfe00df48d5d5 Mon Sep 17 00:00:00 2001 From: vito Date: Sun, 17 Dec 2023 15:56:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-99485=20=E4=BF=AE=E5=A4=8D=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/storybook/StoryBoard.java | 23 ++++++++----------- .../components/ButtonTabStoryBoard.java | 12 +++++----- .../components/CheckBoxStoryBoard.java | 6 ++--- .../components/ComboBoxStoryBoard.java | 4 ++-- .../storybook/components/InputStoryBoard.java | 20 ++++++++-------- .../components/RadioButtonStoryBoard.java | 4 ++-- .../components/SliderStoryBoard.java | 2 +- .../components/ToolTipStoryBoard.java | 6 ++--- .../components/UIHeadGroupStoryBoard.java | 8 +++---- 9 files changed, 41 insertions(+), 44 deletions(-) diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/StoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/StoryBoard.java index 33d9a9c32e..5e443bf349 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/StoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/StoryBoard.java @@ -3,8 +3,7 @@ package com.fr.design.gui.storybook; import com.fine.swing.ui.layout.Column; import com.fr.design.gui.ilable.UILabel; -import javax.swing.UIManager; -import java.awt.Font; +import javax.swing.JComponent; import static com.fine.swing.ui.layout.Layouts.cell; @@ -18,29 +17,27 @@ import static com.fine.swing.ui.layout.Layouts.cell; */ public class StoryBoard extends Column { - protected static final Font labelFont = UIManager.getFont("Label.font"); - protected String title; public StoryBoard(String title) { this.title = title; setSpacing(4); - add(cell(new UILabel(title)).with(it -> it.setFont(h2()))); + add(cell(new UILabel(title)).with(this::h2)); } - protected Font h1() { - return font("h1.font"); + protected void h1(JComponent component) { + styleClass(component,"h1"); } - protected Font h2() { - return font("h2.font"); + protected void h2(JComponent component) { + styleClass(component,"h2"); } - protected Font h3() { - return font("h3.font"); + protected void h3(JComponent component) { + styleClass(component,"h3"); } - private Font font(String key) { - return UIManager.getFont(key); + private void styleClass(JComponent component, String key) { + component.putClientProperty("FlatLaf.styleClass", key); } } diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java index 4e2429e577..897e1ed5ed 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonTabStoryBoard.java @@ -25,17 +25,17 @@ public class ButtonTabStoryBoard extends StoryBoard { public ButtonTabStoryBoard() { super("切换按钮组"); add( - cell(new UILabel("单行文字按钮")).with(it -> it.setFont(h3())), + cell(new UILabel("单行文字按钮")).with(this::h3), cell(new UIButtonGroup<>(new String[]{"按钮1", "按钮2", "按钮3"})), - cell(new UILabel("单行图标按钮")).with(it -> it.setFont(h3())), + cell(new UILabel("单行图标按钮")).with(this::h3), cell(new UIButtonGroup<>(iconArray())), - cell(new UILabel("选中切换图标按钮")).with(it -> it.setFont(h3())), + cell(new UILabel("选中切换图标按钮")).with(this::h3), cell(new UIButtonGroup<>(iconArrayWithWhite())), - cell(new UILabel("多行按钮-偶数场景-6按钮")).with(it -> it.setFont(h3())), + cell(new UILabel("多行按钮-偶数场景-6按钮")).with(this::h3), cell(new UITabGroup(sixTextArray())), - cell(new UILabel("多行按钮-奇数场景-5按钮")).with(it -> it.setFont(h3())), + cell(new UILabel("多行按钮-奇数场景-5按钮")).with(this::h3), cell(new UITabGroup(fiveTextArray())), - cell(new UILabel("多行按钮-奇数场景-7按钮")).with(it -> it.setFont(h3())), + cell(new UILabel("多行按钮-奇数场景-7按钮")).with(this::h3), cell(new UITabGroup(sevenTextArray())), flex() ); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java index 35be78304c..a9f50a8ea0 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/CheckBoxStoryBoard.java @@ -27,21 +27,21 @@ public class CheckBoxStoryBoard extends StoryBoard { public CheckBoxStoryBoard() { super("复选按钮"); add( - cell(new UILabel("水平布局")).with(it -> it.setFont(h3())), + cell(new UILabel("水平布局")).with(this::h3), row(10, cell(new UICheckBox("测试1")), cell(new UICheckBox("测试2")), cell(new UICheckBox("测试3")) ), fix(5), - cell(new UILabel("垂直布局")).with(it -> it.setFont(h3())), + cell(new UILabel("垂直布局")).with(this::h3), column(5, cell(new UICheckBox("测试1")), cell(new UICheckBox("测试2")), cell(new UICheckBox("测试3")) ), fix(5), - cell(new UILabel("禁用状态")).with(it -> it.setFont(h3())), + cell(new UILabel("禁用状态")).with(this::h3), row(10, cell(getDisabledStatus(new UICheckBox("测试"))), cell(getDisabledSelectedStatus(new UICheckBox("测试"))) diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java index 26dc7b7a72..ced4781c24 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboBoxStoryBoard.java @@ -23,11 +23,11 @@ public class ComboBoxStoryBoard extends StoryBoard { super("下拉选择框"); add( - cell(new UILabel("普通状态")).with(it -> it.setFont(h3())), + cell(new UILabel("普通状态")).with(this::h3), cell(new UIComboBox( ArrayUtils.toArray("测试1", "测试2", "测试3", "测试4") )), - cell(new UILabel("禁用状态")).with(it -> it.setFont(h3())), + cell(new UILabel("禁用状态")).with(this::h3), cell(getDisabledStatus()), flex() ); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/InputStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/InputStoryBoard.java index 013b06b81f..e18e7bc8f4 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/InputStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/InputStoryBoard.java @@ -21,13 +21,13 @@ public class InputStoryBoard extends StoryBoard { public InputStoryBoard() { super("输入框"); add( - cell(new UILabel("文本框")).with(it -> it.setFont(h3())), + cell(new UILabel("文本框")).with(this::h3), cell(new UITextField("文本")), - cell(new UILabel("文本框-禁用")).with(it -> it.setFont(h3())), + cell(new UILabel("文本框-禁用")).with(this::h3), cell(new UITextField("文本")).with(it -> it.setEnabled(false)), - cell(new UILabel("文本域")).with(it -> it.setFont(h3())), + cell(new UILabel("文本域")).with(this::h3), cell(new UITextArea("下面一些近期重要通知公告、常用CRM&KMS页面链接,希望可以帮到你哦~ " + "或者你可以找我的两个好兄弟“Fine人事”、“ISC服务平台Fine人事”的工位在“企业微信工作台-ISC”下面," + "菜单栏里的内容可以解答一些常见问题 ISC服务平台”的工位在“CRM主页”," + @@ -35,7 +35,7 @@ public class InputStoryBoard extends StoryBoard { "常用入口的服务平台,如有意见建议,欢迎多多反馈Jewel-朱朱~如果觉得我可以帮到你," + "请滑到页面左下角给我点个赞吧(#^.^#)")), - cell(new UILabel("文本域-禁用")).with(it -> it.setFont(h3())), + cell(new UILabel("文本域-禁用")).with(this::h3), cell(new UITextArea("下面一些近期重要通知公告、常用CRM&KMS页面链接," + "希望可以帮到你哦~ 或者你可以找我的两个好兄弟“Fine人事”、" + "“ISC服务平台Fine人事”的工位在“企业微信工作台-ISC”下面," + @@ -44,25 +44,25 @@ public class InputStoryBoard extends StoryBoard { "常用入口的服务平台,如有意见建议,欢迎多多反馈Jewel-朱朱~如果觉得我可以帮到你," + "请滑到页面左下角给我点个赞吧(#^.^#)")).with(it -> it.setEnabled(false)), - cell(new UILabel("数字步进(0~100,步长:1)")).with(it -> it.setFont(h3())), + cell(new UILabel("数字步进(0~100,步长:1)")).with(this::h3), cell(new UISpinner(0, 100, 1, 50)), - cell(new UILabel("数字步进-禁用")).with(it -> it.setFont(h3())), + cell(new UILabel("数字步进-禁用")).with(this::h3), cell(new UISpinner(0, 100, 1, 50)).with(it -> it.setEnabled(false)), - cell(new UILabel("搜索框")).with(it -> it.setFont(h3())), + cell(new UILabel("搜索框")).with(this::h3), cell(new FineSearchPane()), - cell(new UILabel("搜索框-禁用")).with(it -> it.setFont(h3())), + cell(new UILabel("搜索框-禁用")).with(this::h3), cell(new FineSearchPane()).with(it -> { it.setEnabled(false); it.setText("搜索文本"); }), - cell(new UILabel("输入框-更多,带按钮")).with(it -> it.setFont(h3())), + cell(new UILabel("输入框-更多,带按钮")).with(this::h3), cell(new AccessibleBackgroundEditor()), - cell(new UILabel("输入框-更多,带按钮-禁用")).with(it -> it.setFont(h3())), + cell(new UILabel("输入框-更多,带按钮-禁用")).with(this::h3), cell(new AccessibleBackgroundEditor()).with(it -> it.setEnabled(false)) ); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java index d670ec16f3..d4dd6f3eaa 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/RadioButtonStoryBoard.java @@ -24,7 +24,7 @@ public class RadioButtonStoryBoard extends StoryBoard { public RadioButtonStoryBoard() { super("单选按钮"); add( - cell(new UILabel("普通")).with(it -> it.setFont(h3())), + cell(new UILabel("普通")).with(this::h3), row(10, cell(new UIRadioButton("选项一")).with(it -> { buttonGroup.add(it); @@ -33,7 +33,7 @@ public class RadioButtonStoryBoard extends StoryBoard { cell(new UIRadioButton("选项二")).with(it -> buttonGroup.add(it)), cell(new UIRadioButton("选项三")).with(it -> buttonGroup.add(it)) ), - cell(new UILabel("禁用状态")).with(it -> it.setFont(h3())), + cell(new UILabel("禁用状态")).with(this::h3), row(10, cell(new UIRadioButton("选项一")).with(it -> { buttonGroup1.add(it); diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/SliderStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/SliderStoryBoard.java index 48282849f1..8238ff83ee 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/SliderStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/SliderStoryBoard.java @@ -17,7 +17,7 @@ public class SliderStoryBoard extends StoryBoard { public SliderStoryBoard() { super("滑块"); add( - cell(new UILabel("面板缩放滑块")).with(it -> it.setFont(h3())), + cell(new UILabel("面板缩放滑块")).with(this::h3), row(cell(new JFormSliderPane())) ); } diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ToolTipStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ToolTipStoryBoard.java index 9f318683b4..e5cbd1d704 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ToolTipStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ToolTipStoryBoard.java @@ -17,14 +17,14 @@ public class ToolTipStoryBoard extends StoryBoard { public ToolTipStoryBoard() { super("提示框"); add( - cell(new UILabel("组件启用状态下的提示")).with(it -> it.setFont(h3())), + cell(new UILabel("组件启用状态下的提示")).with(this::h3), cell(new UIButton("组件")).with(it -> it.setToolTipText("组件启用状态下的提示")), - cell(new UILabel("组件禁用状态下的提示")).with(it -> it.setFont(h3())), + cell(new UILabel("组件禁用状态下的提示")).with(this::h3), cell(new UIButton("组件")).with(it -> { it.setEnabled(false); it.setToolTipText("组件禁用状态下的提示"); }), - cell(new UILabel("较长提示")).with(it -> it.setFont(h3())), + cell(new UILabel("较长提示")).with(this::h3), cell(new UIButton("组件")).with(it -> it.setToolTipText("下面一些近期重要通知公告、常用CRM&KMS页面链接," + "希望可以帮到你哦~ 或者你可以找我的两个好兄弟“Fine人事”、" + "“ISC服务平台Fine人事”的工位在“企业微信工作台-ISC”下面," + diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/UIHeadGroupStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/UIHeadGroupStoryBoard.java index b6cbde028c..b7223fa0c1 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/UIHeadGroupStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/UIHeadGroupStoryBoard.java @@ -24,13 +24,13 @@ public class UIHeadGroupStoryBoard extends StoryBoard { public UIHeadGroupStoryBoard() { super("属性面板&导入数据集tab"); add( - cell(new UILabel("文字Tab")).with(it -> it.setFont(h3())), + cell(new UILabel("文字Tab")).with(this::h3), cell(new UIHeadGroup(new String[]{"左按钮", "右按钮"})), - cell(new UILabel("图标Tab")).with(it -> it.setFont(h3())), + cell(new UILabel("图标Tab")).with(this::h3), cell(new UIHeadGroup(iconList())), - cell(new UILabel("文字Tab带禁用")).with(it -> it.setFont(h3())), + cell(new UILabel("文字Tab带禁用")).with(this::h3), cell(new UIHeadGroup(iconList2())), - cell(new UILabel("文字图标Tab带禁用")).with(it -> it.setFont(h3())), + cell(new UILabel("文字图标Tab带禁用")).with(this::h3), cell(new UIHeadGroup(iconList3())), flex() );