From ccb798b5b57608a56bd8678612db3f33b1692a69 Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 9 Jan 2024 14:28:41 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-99485=20=E4=BF=AE=E5=A4=8D=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=E9=83=A8=E5=88=86=E6=8C=89=E9=92=AE=E6=9C=89?= =?UTF-8?q?=E5=BA=95=E8=89=B2=E9=97=AE=E9=A2=98=201.=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F=E9=83=A8=E5=88=86=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=9C=89=E5=BA=95=E8=89=B2=E9=97=AE=E9=A2=98=202.=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=96=B0=E7=9A=84svg=E7=BB=98=E5=88=B6=E5=BA=93?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=203.=20=E5=B7=A6=E5=8F=B3=E5=8D=8A=E5=9C=86?= =?UTF-8?q?=E8=A7=92=E7=9F=A9=E5=BD=A2=E4=BB=8Etype=E8=A7=A3=E8=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + .../java/com/fine/theme/light/ui/FineButtonUI.java | 10 +++++----- .../com/fine/theme/utils/FineClientProperties.java | 5 +++-- .../com/fr/design/gui/ibutton/UIButtonGroup.java | 9 ++++----- .../fr/design/gui/ibutton/UICombinationButton.java | 13 +++++++++---- .../fine/theme/light/ui/laf/FineLightLaf.properties | 8 ++++---- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index 0ebf3e9cb6..9cabeff69e 100644 --- a/build.gradle +++ b/build.gradle @@ -89,6 +89,7 @@ allprojects { implementation 'com.fr.design:design-i18n:' + frDevVersion implementation 'com.formdev:flatlaf:3.2' implementation 'com.formdev:flatlaf-extras:3.2.1' + implementation 'com.github.weisj:jsvg:1.2.0' implementation 'com.fanruan.vito:gui-inspector:1.0.1' implementation 'com.fine.swing.ui:layout:1.0-SNAPSHOT' testImplementation 'org.easymock:easymock:3.5.1' diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineButtonUI.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineButtonUI.java index d5b3c17f74..73fb532f9b 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineButtonUI.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineButtonUI.java @@ -15,7 +15,7 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Path2D; -import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; +import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER; /** * 按钮UI @@ -42,7 +42,7 @@ public class FineButtonUI extends FlatButtonUI { */ public static boolean isLeftRoundButton(Component c) { return c instanceof JButton - && FineClientProperties.BUTTON_TYPE_LEFT_ROUND_RECT.equals(getButtonTypeStr((JButton) c)); + && FineClientProperties.BUTTON_BORDER_LEFT_ROUND_RECT.equals(getButtonBorderTypeStr((JButton) c)); } /** @@ -53,7 +53,7 @@ public class FineButtonUI extends FlatButtonUI { */ public static boolean isRightRoundButton(Component c) { return c instanceof JButton - && FineClientProperties.BUTTON_TYPE_RIGHT_ROUND_RECT.equals(getButtonTypeStr((JButton) c)); + && FineClientProperties.BUTTON_BORDER_RIGHT_ROUND_RECT.equals(getButtonBorderTypeStr((JButton) c)); } /** @@ -103,8 +103,8 @@ public class FineButtonUI extends FlatButtonUI { return new FineButtonUI(false); } - static String getButtonTypeStr(AbstractButton c) { - Object value = c.getClientProperty(BUTTON_TYPE); + static String getButtonBorderTypeStr(AbstractButton c) { + Object value = c.getClientProperty(BUTTON_BORDER); if (value instanceof String) { return (String) value; } diff --git a/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java b/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java index 8883f88da4..acbbcb1577 100644 --- a/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java +++ b/designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java @@ -14,8 +14,9 @@ public interface FineClientProperties extends FlatClientProperties { //--------------------------- ButtonGroup ----------------------- String BUTTON_TYPE_GROUP = "group"; - String BUTTON_TYPE_LEFT_ROUND_RECT = "leftRoundRect"; - String BUTTON_TYPE_RIGHT_ROUND_RECT = "rightRoundRect"; + String BUTTON_BORDER = "buttonBorder"; + String BUTTON_BORDER_LEFT_ROUND_RECT = "leftRoundRect"; + String BUTTON_BORDER_RIGHT_ROUND_RECT = "rightRoundRect"; //--------------------------- PopupMenu ----------------------- String MENU_ITEM_TYPE = "MenuItemType"; diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java index 20693ee80e..7505eeb773 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -268,11 +268,10 @@ public class UIButtonGroup extends Column implements GlobalNameObserver, UIOb public void setForToolBarButtonGroup(boolean isToolBarComponent) { if (isToolBarComponent) { inToolbar = true; - for (UIToggleButton uiToggleButton : labelButtonList) { - uiToggleButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); - FineUIStyle.setStyle(uiToggleButton, IN_TOOLBAR_GROUP); - uiToggleButton.set4ToolbarButton(); - uiToggleButton.setBorderPainted(false); + for (UIToggleButton button : labelButtonList) { + button.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); + FineUIStyle.setStyle(button, IN_TOOLBAR_GROUP); + button.setBorderPainted(false); } } repaint(); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java index 80d74bcdc4..70f229d2a3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java @@ -10,13 +10,15 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.function.Consumer; -import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE_LEFT_ROUND_RECT; -import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE_RIGHT_ROUND_RECT; +import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER; +import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER_LEFT_ROUND_RECT; +import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER_RIGHT_ROUND_RECT; import static com.fine.theme.utils.FineUIStyle.IN_TOOLBAR_LEFT; import static com.fine.theme.utils.FineUIStyle.IN_TOOLBAR_RIGHT; import static com.fine.theme.utils.FineUIStyle.STYLE_PRIMARY; import static com.fine.theme.utils.FineUIStyle.setStyle; import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; +import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON; /** * 双按钮组件 @@ -69,10 +71,11 @@ public class UICombinationButton extends JPanel { } public UICombinationButton(UIButton left, UIButton right) { + setOpaque(false); leftButton = left; - leftButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_LEFT_ROUND_RECT); + leftButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_LEFT_ROUND_RECT); rightButton = right; - rightButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_RIGHT_ROUND_RECT); + rightButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_RIGHT_ROUND_RECT); leftButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -139,8 +142,10 @@ public class UICombinationButton extends JPanel { public void set4Toolbar() { leftButton.setBorderPainted(false); + leftButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); setStyle(leftButton, IN_TOOLBAR_LEFT); rightButton.setBorderPainted(false); + rightButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); setStyle(rightButton, IN_TOOLBAR_RIGHT); } 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..0cbfbeb31d 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 @@ -1237,10 +1237,10 @@ CellOtherSetPane.height=$Component.defaultHeight background : #fff [style]Button.inToolbarLeft = \ - margin : 3,3,3,3 + toolbar.margin : 4,4,4,4 [style]Button.inToolbarRight = \ - margin : 0,0,0,0 + toolbar.margin : 1,0,1,0 [style]Button.tabAction = \ toolbar.margin : 5,11,5,11 @@ -1263,8 +1263,8 @@ CellOtherSetPane.height=$Component.defaultHeight opaque: true [style]ToggleButton.inToolbarGroup = \ - margin : 4,4,4,4; \ - background : #fff + margin: 4,4,4,4; + [style]Menu.menuToolBar=\ selectionBackground : $brand.normal; \ selectionForeground : $text.white; \