From e133d4958947774279e82c988b676c246a24db95 Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Tue, 9 Jan 2024 14:54:21 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-107973=20=E8=83=8C=E6=99=AF=E8=89=B2?= =?UTF-8?q?=E9=80=8F=E6=98=8E=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/utils/FineUIStyle.java | 1 + .../mainframe/EastRegionContainerPane.java | 15 ++++------ .../fr/design/mainframe/JFormSliderPane.java | 3 ++ .../mainframe/loghandler/LogMessageBar.java | 4 +++ .../ui/NotificationCenterPane.java | 4 +++ .../light/ui/laf/FineLightLaf.properties | 4 +++ .../components/ButtonStoryBoard.java | 28 +++++++++++++++++++ .../alphafine/component/AlphaFinePane.java | 4 +++ 8 files changed, 54 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java index 82172be6f7..e0bc20d5ca 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java @@ -16,6 +16,7 @@ public interface FineUIStyle { String IN_TOOLBAR_GROUP = "inToolbarGroup"; String STYLE_PRIMARY = "primary"; String STYLE_SECONDARY = "secondary"; + String STYLE_TEXT = "text"; String STYLE_SIZE_MEDIUM = "mediumSize"; String STYLE_SIZE_SMALL = "smallSize"; String MENU_BAR = "menuBar"; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index acf32c4ef1..1b782dd300 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe; import com.fine.theme.icon.LazyIcon; -import com.fine.theme.light.ui.RectangleButtonUI; import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.FlatDarkLaf; @@ -14,7 +13,6 @@ import com.fr.design.constants.UIConstants; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.PropertyItemPaneProvider; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.icontainer.UIEastResizableContainer; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.VerticalFlowLayout; @@ -70,6 +68,9 @@ import java.util.List; import java.util.Map; import java.util.Set; +import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT; +import static com.fine.theme.utils.FineUIStyle.setStyle; + public class EastRegionContainerPane extends UIEastResizableContainer { private static volatile EastRegionContainerPane THIS; private Map propertyItemMap; @@ -974,7 +975,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } public void resetButtonIcon() { - button.setBackground(null); + button.setBackground(new Color(0, 0, 0, 0)); if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { iconSuffix = ICON_SUFFIX_NORMAL; button.setIcon(new LazyIcon(getBtnIconId())); @@ -1003,7 +1004,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { }; button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED)); button.set4LargeToolbarButton(); - button.setUI(new RectangleButtonUI(false)); + setStyle(button, STYLE_TEXT); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -1279,11 +1280,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } else if (StringUtils.equals(type, DOWN_BUTTON)) { popupButton = new UIButton(new LazyIcon("expand_popup")); } - popupButton.setUI(new UIButtonUI()); - popupButton.setBorderPainted(false); - popupButton.setBorder(null); - popupButton.setBackground(null); - popupButton.setExtraPainted(false); + setStyle(popupButton, STYLE_TEXT); popupButton.addActionListener(e -> { this.buttonType = type; onPop(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java b/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java index 38a8d9d757..78da7a6e63 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fine.theme.icon.LazyIcon; import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.gui.ibutton.UIButton; @@ -106,6 +107,7 @@ public class JFormSliderPane extends JPanel { }; downButton.setBorderPainted(false); downButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Down")); + setStyle(downButton, FineUIStyle.STYLE_TEXT); upButton = new UIButton(new LazyIcon("zoomIn")) { public Point getToolTipLocation(MouseEvent event) { return new Point(event.getX(), event.getY() - TOOLTIP_Y); @@ -117,6 +119,7 @@ public class JFormSliderPane extends JPanel { upButton.setActionCommand("more"); downButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener); + setStyle(upButton, FineUIStyle.STYLE_TEXT); } private void initShowValField() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java index 0712327eca..292c2d593f 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.loghandler; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIStyle; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; @@ -9,6 +10,8 @@ import java.awt.BorderLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import static com.fine.theme.utils.FineUIStyle.setStyle; + /** * 日志消息 * @@ -40,6 +43,7 @@ public class LogMessageBar extends BasicPane { logButton = new UIButton(new LazyIcon("logMsg")); logButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_Log_Message")); logButton.set4ToolbarButton(); + setStyle(logButton, FineUIStyle.STYLE_TEXT); add(logButton); logButton.addMouseListener(new MouseAdapter() { @Override diff --git a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java index 817afcdcd6..120535d313 100644 --- a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java +++ b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java @@ -1,6 +1,7 @@ package com.fr.design.notification.ui; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIStyle; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.i18n.Toolkit; @@ -11,6 +12,8 @@ import java.awt.BorderLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import static com.fine.theme.utils.FineUIStyle.setStyle; + public class NotificationCenterPane extends BasicPane { private static NotificationCenterPane notificationCenterPane = new NotificationCenterPane(); private static UIButton notificationCenterButton; @@ -22,6 +25,7 @@ public class NotificationCenterPane extends BasicPane { notificationCenterButton.setIcon(new LazyIcon("notification")); notificationCenterButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Show_Notification")); notificationCenterButton.set4ToolbarButton(); + setStyle(notificationCenterButton, FineUIStyle.STYLE_TEXT); this.add(notificationCenterButton); notificationCenterButton.addMouseListener(new MouseAdapter() { @Override diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties index d6994d04cf..d7801f8dc5 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties @@ -1228,6 +1228,10 @@ CellOtherSetPane.height=$Component.defaultHeight focusedBorderColor : $Button.focusedBorderColor; \ focusColor : $Component.focusColor; \ borderWidth : 1 +[style]Button.text=\ + background : fade($Button.background,0%); \ + borderWidth : 0; \ + disabledBackground : fade($Button.background,0%); [style]CombinationButton.primary = \ background : @BrandColor; \ diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java index 67c369518a..54181cf0d6 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/ButtonStoryBoard.java @@ -18,6 +18,7 @@ import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.row; import static com.fine.theme.utils.FineUIStyle.STYLE_PRIMARY; import static com.fine.theme.utils.FineUIStyle.STYLE_SIZE_SMALL; +import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT; import static com.fine.theme.utils.FineUIStyle.joinStyle; import static com.fine.theme.utils.FineUIStyle.setStyle; @@ -131,6 +132,33 @@ public class ButtonStoryBoard extends StoryBoard { ) ) ), + column(16, + cell(new UILabel(STYLE_TEXT)).with(this::h2), + row(20, + cell(new UILabel("正常")), + cell(new UIButton("按钮")) + .with(it -> setStyle(it, STYLE_TEXT)), + cell(new UIButton("按钮", new LazyIcon("add"))) + .with(it -> setStyle(it, STYLE_TEXT)), + cell(new UIButton(new LazyIcon("multi"))) + .with(it -> setStyle(it, STYLE_TEXT)) + ), + row(20, + cell(new UILabel("禁用")), + cell(new UIButton("按钮")).with(it -> { + setStyle(it, STYLE_TEXT); + it.setEnabled(false); + }), + cell(new UIButton("保存", new LazyIcon("save").disabled())).with(it -> { + setStyle(it, STYLE_TEXT); + it.setEnabled(false); + }), + cell(new UIButton(new LazyIcon("add").disabled())).with(it -> { + setStyle(it, STYLE_TEXT); + it.setEnabled(false); + }) + ) + ), cell(new UILabel("JButton")).with(this::h2), row(20, cell(new UILabel("medium")), diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java index 34569667b2..151afd7580 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.alphafine.component; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.utils.FineUIStyle; import com.fr.design.actions.help.alphafine.AlphaFineContext; import com.fr.design.actions.help.alphafine.AlphaFineListener; import com.fr.design.dialog.BasicPane; @@ -13,6 +14,8 @@ import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import static com.fine.theme.utils.FineUIStyle.setStyle; + /** * Created by XiaXiang on 2017/3/21. */ @@ -30,6 +33,7 @@ public class AlphaFinePane extends BasicPane { refreshButton.setIcon(new LazyIcon(("search"))); refreshButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_AlphaFine_Learn_More_About")); refreshButton.set4ToolbarButton(); + setStyle(refreshButton, FineUIStyle.STYLE_TEXT); this.add(refreshButton); refreshButton.addActionListener(new ActionListener() { @Override