From a7fca6cfb6184b8f37ca881ee79bafc263dd96a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 11 Jan 2024 11:56:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-111995=20=E3=80=90UI=E7=BF=BB?= =?UTF-8?q?=E6=96=B0=E3=80=91=E4=BC=98=E5=8C=96=E4=B8=9C=E5=8C=BA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/controlpane/UIControlPane.java | 50 +++++++------------ .../mainframe/EastRegionContainerPane.java | 15 +----- 2 files changed, 21 insertions(+), 44 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index f083f86f2..2ed774966 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -1,11 +1,14 @@ package com.fr.design.gui.controlpane; +import com.fine.theme.light.ui.FineButtonBorder; +import com.fine.theme.utils.FineUIScale; +import com.fine.theme.utils.FineUIStyle; +import com.formdev.flatlaf.ui.FlatUIUtils; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory; import com.fr.design.gui.ifilechooser.JavaFxNativeFileChooser; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; @@ -46,15 +49,15 @@ import java.awt.event.MouseMotionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.row; + /** * Created by plough on 2017/7/21. */ public abstract class UIControlPane extends JControlPane { private UIToolbar topToolBar; protected Window popupEditDialog; - private static final int TOP_TOOLBAR_HEIGHT = 20; - private static final int TOP_TOOLBAR_WIDTH = 156; // 可能因为用了tablelayout,要比其他地方多一个像素,看起来才正常 - private static final int TOP_TOOLBAR_WIDTH_SHORT = 76; UIControlPane() { super(); @@ -135,40 +138,26 @@ public abstract class UIControlPane extends JControlPane { leftContentPane.add(toolBarPane, BorderLayout.NORTH); // 顶部标签及add按钮 - topToolBar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI() { - @Override - public void paint(Graphics g, JComponent c) { - Graphics2D g2 = (Graphics2D) g; - g2.setColor(UIConstants.SELECT_TAB); - g2.fillRect(0, 0, c.getWidth(), c.getHeight()); - } - }); - topToolBar.setBorder(null); + topToolBar = new UIToolbar(); topToolBar.setLayout(new BorderLayout()); ShortCut addItem = shortCutFactory.addItemShortCut().getShortCut(); addItem.intoJToolBar(topToolBar); JPanel leftTopPane = getLeftTopPane(topToolBar); - leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0)); + leftTopPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); leftPane.add(leftTopPane, BorderLayout.NORTH); return leftPane; } protected JPanel getLeftTopPane(UIToolbar topToolBar) { - UILabel addItemLabel = FRWidgetFactory.createLineWrapLabel(getAddItemText()); - - topToolBar.setPreferredSize( - new Dimension( - isNewStyle() ? TOP_TOOLBAR_WIDTH : TOP_TOOLBAR_WIDTH_SHORT, - TOP_TOOLBAR_HEIGHT - )); - JPanel toolBarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - toolBarPane.add(topToolBar, BorderLayout.NORTH); - - JPanel leftTopPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - leftTopPane.add(toolBarPane, BorderLayout.EAST); - leftTopPane.add(addItemLabel, BorderLayout.CENTER); - return leftTopPane; + return row(10, + cell(FRWidgetFactory.createLineWrapLabel(getAddItemText())), + cell(topToolBar).with(it -> { + it.setBorderPainted(true); + it.setBorder(new FineButtonBorder()); + it.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE)); + }).weight(1.0) + ).getComponent(); } /** @@ -179,7 +168,6 @@ public abstract class UIControlPane extends JControlPane { } protected ShortCut4JControlPane[] createShortcuts() { -// return AbstractShortCutFactory.getInstance(this).createNewShortCuts(); return shortCutFactory.createShortCuts(); } @@ -219,8 +207,7 @@ public abstract class UIControlPane extends JControlPane { editPaneWrapper.add(editPane, BorderLayout.CENTER); editPaneWrapper.setBorder(BorderFactory.createLineBorder(UIConstants.POP_DIALOG_BORDER, 1)); this.getContentPane().add(editPaneWrapper, BorderLayout.CENTER); - setSize(WIDTH, HEIGHT); -// pack(); + setSize(FineUIScale.scale(new Dimension(WIDTH, HEIGHT))); this.setVisible(false); initListener(); } @@ -386,6 +373,7 @@ public abstract class UIControlPane extends JControlPane { contentPane.setBackground(originColor); contentPane.setLayout(new BorderLayout()); titleLabel = new UILabel(title); + FineUIStyle.setStyle(titleLabel, FineUIStyle.LABEL_BOLD); contentPane.add(titleLabel, BorderLayout.WEST); contentPane.setBorder(new EmptyBorder(5, 14, 6, 0)); 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 f060bf0ff..ccfed418d 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 @@ -3,6 +3,7 @@ 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.FineUIStyle; import com.fine.theme.utils.FineUIUtils; import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.ui.FlatLineBorder; @@ -337,18 +338,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { "configuredroles", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION_DISABLED}, new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}); - PropertyItem aiChat = new PropertyItem( - KEY_AI_CHAT, - "设计器助手", - "widgetlib", - new PropertyMode[]{PropertyMode.REPORT}, - new PropertyMode[]{PropertyMode.REPORT}, - null, - null, - e -> { - - }); - propertyItemMap.put(KEY_CELL_ELEMENT, cellElement); propertyItemMap.put(KEY_CELL_ATTR, cellAttr); propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement); @@ -356,7 +345,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap.put(KEY_CONDITION_ATTR, conditionAttr); propertyItemMap.put(KEY_HYPERLINK, hyperlink); propertyItemMap.put(KEY_WIDGET_LIB, widgetLib); - propertyItemMap.put(KEY_AI_CHAT, aiChat); propertyItemMap.put(KEY_AUTHORITY_EDITION, authorityEdition); propertyItemMap.put(KEY_CONFIGURED_ROLES, configuredRoles); } @@ -1264,6 +1252,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); UILabel label = new UILabel(title); + FineUIStyle.setStyle(label, FineUIStyle.LABEL_BOLD); contentPane.add(label, BorderLayout.CENTER); popupButton = createPopupButton(buttonType); From e76877cb0ffee3400221fb023ed5c2f03985d47e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Thu, 11 Jan 2024 12:02:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-111995=20=E3=80=90UI=E7=BF=BB?= =?UTF-8?q?=E6=96=B0=E3=80=91=E4=BC=98=E5=8C=96=E4=B8=9C=E5=8C=BA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/foldablepane/HeaderPane.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java b/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java index 209a4195b..7e5878922 100644 --- a/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java +++ b/designer-base/src/main/java/com/fr/design/foldablepane/HeaderPane.java @@ -27,6 +27,7 @@ public class HeaderPane extends JPanel { private int fontSize; private final Icon triangleDown; private final Icon triangleRight; + private static final int ICON_FIX = -2; public void setPressed(boolean pressed) { this.isPressed = pressed; @@ -56,10 +57,11 @@ public class HeaderPane extends JPanel { g2d.fillRect(0, insets.top / 2, this.getWidth(), this.getHeight() - (insets.top + insets.bottom) / 2); int iconY = (this.getHeight() - triangleDown.getIconHeight()) / 2; + // 折叠面板需要icon显示左边缘对齐,fix一下 if (this.isShow) { - triangleDown.paintIcon(this, g2d, 0, iconY); + triangleDown.paintIcon(this, g2d, FineUIScale.scale(ICON_FIX), iconY); } else { - triangleRight.paintIcon(this, g2d, 0, iconY); + triangleRight.paintIcon(this, g2d, FineUIScale.scale(ICON_FIX), iconY); } g2d.setFont(getFont()); @@ -70,7 +72,7 @@ public class HeaderPane extends JPanel { int ascent = metrics.getAscent(); int descent = metrics.getDescent(); - float titleX = triangleDown.getIconWidth() + float titleX = triangleDown.getIconWidth() + FineUIScale.scale(ICON_FIX) + FineUIScale.scale(UIManager.getInt("ExpandablePane.HeaderPane.hGap")); float titleY = (getHeight() - (ascent + descent)) / 2.0f + ascent; FlatUIUtils.setRenderingHints(g2d);