Browse Source

REPORT-99485 修复工具栏部分按钮有底色问题

1. 修复工具栏部分按钮有底色问题
2. 添加新的svg绘制库依赖
3. 左右半圆角矩形从type解耦
newui
vito 10 months ago
parent
commit
ccb798b5b5
  1. 1
      build.gradle
  2. 10
      designer-base/src/main/java/com/fine/theme/light/ui/FineButtonUI.java
  3. 5
      designer-base/src/main/java/com/fine/theme/utils/FineClientProperties.java
  4. 9
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java
  5. 13
      designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java
  6. 8
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

1
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'

10
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;
}

5
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";

9
designer-base/src/main/java/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -268,11 +268,10 @@ public class UIButtonGroup<T> 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();

13
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);
}

8
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; \

Loading…
Cancel
Save