Browse Source

Merge remote-tracking branch 'origin/newui' into newui

newui
Leo.Qin 12 months ago
parent
commit
69b41c1b82
  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.fr.design:design-i18n:' + frDevVersion
implementation 'com.formdev:flatlaf:3.2' implementation 'com.formdev:flatlaf:3.2'
implementation 'com.formdev:flatlaf-extras:3.2.1' 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.fanruan.vito:gui-inspector:1.0.1'
implementation 'com.fine.swing.ui:layout:1.0-SNAPSHOT' implementation 'com.fine.swing.ui:layout:1.0-SNAPSHOT'
testImplementation 'org.easymock:easymock:3.5.1' 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.Graphics2D;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER;
/** /**
* 按钮UI * 按钮UI
@ -42,7 +42,7 @@ public class FineButtonUI extends FlatButtonUI {
*/ */
public static boolean isLeftRoundButton(Component c) { public static boolean isLeftRoundButton(Component c) {
return c instanceof JButton 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) { public static boolean isRightRoundButton(Component c) {
return c instanceof JButton 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); return new FineButtonUI(false);
} }
static String getButtonTypeStr(AbstractButton c) { static String getButtonBorderTypeStr(AbstractButton c) {
Object value = c.getClientProperty(BUTTON_TYPE); Object value = c.getClientProperty(BUTTON_BORDER);
if (value instanceof String) { if (value instanceof String) {
return (String) value; 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 ----------------------- //--------------------------- ButtonGroup -----------------------
String BUTTON_TYPE_GROUP = "group"; String BUTTON_TYPE_GROUP = "group";
String BUTTON_TYPE_LEFT_ROUND_RECT = "leftRoundRect"; String BUTTON_BORDER = "buttonBorder";
String BUTTON_TYPE_RIGHT_ROUND_RECT = "rightRoundRect"; String BUTTON_BORDER_LEFT_ROUND_RECT = "leftRoundRect";
String BUTTON_BORDER_RIGHT_ROUND_RECT = "rightRoundRect";
//--------------------------- PopupMenu ----------------------- //--------------------------- PopupMenu -----------------------
String MENU_ITEM_TYPE = "MenuItemType"; 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) { public void setForToolBarButtonGroup(boolean isToolBarComponent) {
if (isToolBarComponent) { if (isToolBarComponent) {
inToolbar = true; inToolbar = true;
for (UIToggleButton uiToggleButton : labelButtonList) { for (UIToggleButton button : labelButtonList) {
uiToggleButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); button.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON);
FineUIStyle.setStyle(uiToggleButton, IN_TOOLBAR_GROUP); FineUIStyle.setStyle(button, IN_TOOLBAR_GROUP);
uiToggleButton.set4ToolbarButton(); button.setBorderPainted(false);
uiToggleButton.setBorderPainted(false);
} }
} }
repaint(); 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.awt.event.MouseEvent;
import java.util.function.Consumer; 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_BORDER;
import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE_RIGHT_ROUND_RECT; 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_LEFT;
import static com.fine.theme.utils.FineUIStyle.IN_TOOLBAR_RIGHT; 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.STYLE_PRIMARY;
import static com.fine.theme.utils.FineUIStyle.setStyle; import static com.fine.theme.utils.FineUIStyle.setStyle;
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; 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) { public UICombinationButton(UIButton left, UIButton right) {
setOpaque(false);
leftButton = left; leftButton = left;
leftButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_LEFT_ROUND_RECT); leftButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_LEFT_ROUND_RECT);
rightButton = right; rightButton = right;
rightButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_RIGHT_ROUND_RECT); rightButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_RIGHT_ROUND_RECT);
leftButton.addMouseListener(new MouseAdapter() { leftButton.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -139,8 +142,10 @@ public class UICombinationButton extends JPanel {
public void set4Toolbar() { public void set4Toolbar() {
leftButton.setBorderPainted(false); leftButton.setBorderPainted(false);
leftButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON);
setStyle(leftButton, IN_TOOLBAR_LEFT); setStyle(leftButton, IN_TOOLBAR_LEFT);
rightButton.setBorderPainted(false); rightButton.setBorderPainted(false);
rightButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON);
setStyle(rightButton, IN_TOOLBAR_RIGHT); setStyle(rightButton, IN_TOOLBAR_RIGHT);
} }

8
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -1241,10 +1241,10 @@ CellOtherSetPane.height=$Component.defaultHeight
background : #fff background : #fff
[style]Button.inToolbarLeft = \ [style]Button.inToolbarLeft = \
margin : 3,3,3,3 toolbar.margin : 4,4,4,4
[style]Button.inToolbarRight = \ [style]Button.inToolbarRight = \
margin : 0,0,0,0 toolbar.margin : 1,0,1,0
[style]Button.tabAction = \ [style]Button.tabAction = \
toolbar.margin : 5,11,5,11 toolbar.margin : 5,11,5,11
@ -1267,8 +1267,8 @@ CellOtherSetPane.height=$Component.defaultHeight
opaque: true opaque: true
[style]ToggleButton.inToolbarGroup = \ [style]ToggleButton.inToolbarGroup = \
margin : 4,4,4,4; \ margin: 4,4,4,4;
background : #fff
[style]Menu.menuToolBar=\ [style]Menu.menuToolBar=\
selectionBackground : $brand.normal; \ selectionBackground : $brand.normal; \
selectionForeground : $text.white; \ selectionForeground : $text.white; \

Loading…
Cancel
Save