From b7c2ce4c0e759ddda858731007f2758e5b1d98ba Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Wed, 6 Dec 2023 18:39:35 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-107973=20=E4=B8=BB=E9=A1=B5=E5=8F=8A?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E8=A7=86=E8=A7=89=E6=A0=B7=E5=BC=8F=E7=BF=BB?= =?UTF-8?q?=E6=96=B0=20=E3=80=90=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=E3=80=91rt=20=E3=80=90=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF?= =?UTF-8?q?=E3=80=91=E5=8F=AF=E6=8A=98=E5=8F=A0=E9=9D=A2=E6=9D=BF=E7=BF=BB?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fine/theme/light/ui/FineLightIconSet.java | 9 ++- .../fr/design/foldablepane/HeaderPane.java | 64 ++++++++++--------- .../design/foldablepane/UIExpandablePane.java | 9 ++- .../theme/icon/triangle/triangle_down.svg | 4 ++ .../icon/triangle/triangle_down_small.svg | 4 ++ .../theme/icon/triangle/triangle_left.svg | 4 ++ .../icon/triangle/triangle_left_small.svg | 4 ++ .../theme/icon/triangle/triangle_right.svg | 4 ++ .../icon/triangle/triangle_right_small.svg | 4 ++ .../light/ui/laf/FineLightLaf.properties | 7 ++ .../cell/settingpane/CellOtherSetPane.java | 21 +++--- 11 files changed, 89 insertions(+), 45 deletions(-) create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_down.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_down_small.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_left.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_left_small.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_right.svg create mode 100755 designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_right_small.svg diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java index 16aed93baf..40ee8c30aa 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java @@ -142,8 +142,15 @@ public class FineLightIconSet extends AbstractIconSet { new SvgIconSource("param_view", "com/fine/theme/icon/param/view.svg", true, 18), // 北区菜单栏 - new SvgIconSource("notification", "com/fine/theme/icon/notification/notification.svg") + new SvgIconSource("notification", "com/fine/theme/icon/notification/notification.svg"), + // 三角 + new SvgIconSource("triangle_down", "com/fine/theme/icon/triangle/triangle_down.svg"), + new SvgIconSource("triangle_down_small", "com/fine/theme/icon/triangle/triangle_down_small.svg"), + new SvgIconSource("triangle_left", "com/fine/theme/icon/triangle/triangle_left.svg"), + new SvgIconSource("triangle_left_small", "com/fine/theme/icon/triangle/triangle_left_small.svg"), + new SvgIconSource("triangle_right", "com/fine/theme/icon/triangle/triangle_right.svg"), + new SvgIconSource("triangle_right_small", "com/fine/theme/icon/triangle/triangle_right_small.svg") ); } } 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 07e0172373..a71cc5204f 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 @@ -1,39 +1,42 @@ package com.fr.design.foldablepane; +import com.fine.theme.icon.LazyIcon; import com.fr.base.GraphHelper; -import com.fr.design.constants.UIConstants; +import javax.swing.BorderFactory; +import javax.swing.Icon; import javax.swing.JFrame; import javax.swing.JPanel; +import javax.swing.UIManager; +import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; -import java.awt.Image; +import java.awt.Insets; /** * Created by MoMeak on 2017/7/5. */ public class HeaderPane extends JPanel { private static final long serialVersionUID = 1L; - private static final int TITLE_X = 5; - private static final int LEFT_X = 16; - private static final int LEFT_Y = 6; - private static final int NORMAL_FONTSIZE = 12; private int headWidth; private int headHeight; private Color bgColor; private boolean isShow; private boolean isPressed = false; private String title; - private Image image; private int fontSize; + private final Icon triangleDown; + private final Icon triangleRight; + private final int hGap; public void setPressed(boolean pressed) { this.isPressed = pressed; } - public void setShow(boolean isShow) { this.isShow = isShow; } @@ -58,45 +61,44 @@ public class HeaderPane extends JPanel { @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); -// g2d.setColor(isPressed ? UIConstants.POPUP_TITLE_BACKGROUND : UIConstants.COMPONENT_BACKGROUND_COLOR); - headWidth = this.getWidth(); g2d.setColor(getBackground()); - g2d.fillRect(0, 0, headWidth, headHeight); -// g2d.setFont(new Font("SimSun", 0, fontSize)); - g2d.setPaint(getForeground()); - int leftWdith = headWidth - LEFT_X; + g2d.fillRect(0, 0, this.getWidth(), this.getHeight()); + + int iconY = (this.getHeight() - triangleDown.getIconHeight()) / 2; if (this.isShow) { - image = UIConstants.DRAG_DOWN_SELECTED_SMALL; - g2d.drawImage(image, leftWdith, LEFT_Y, null); + triangleDown.paintIcon(this, g2d, 0, iconY); } else { - image = UIConstants.DRAG_LEFT_NORMAL_SMALL; - g2d.drawImage(image, leftWdith, LEFT_Y, null); + triangleRight.paintIcon(this, g2d, 0, iconY); } - GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1); - } + g2d.setFont(getFont()); + g2d.setPaint(getForeground()); + g2d.setComposite(AlphaComposite.SrcOver.derive((float) getForeground().getAlpha() / 255)); - @Override - public Dimension getPreferredSize() { - return new Dimension(this.getWidth(), headHeight); - } + FontMetrics metrics = g2d.getFontMetrics(); + int ascent = metrics.getAscent(); + int descent = metrics.getDescent(); - @Override - public Dimension getSize() { - return new Dimension(this.getWidth(), headHeight); + double titleY = (double) (getHeight() - (ascent + descent)) / 2 + ascent; + GraphHelper.drawString(g2d, this.title, triangleDown.getIconWidth() + this.hGap, titleY); + g2d.dispose(); } public HeaderPane(Color bgColor) { - this.bgColor = bgColor; this.isShow = true; - + triangleDown = new LazyIcon("triangle_down"); + triangleRight = new LazyIcon("triangle_right"); + this.hGap = UIManager.getInt("ExpandablePane.HeaderPane.hGap"); + this.setPreferredSize(new Dimension(UIManager.getInt("HeaderPane.width"), UIManager.getInt("HeaderPane.height"))); + Insets insets = UIManager.getInsets("ExpandablePane.HeaderPane.borderInsets"); + this.setForeground(UIManager.getColor("color.text.highlight")); + this.setFont(getFont().deriveFont(Font.BOLD)); + this.setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.right)); } public HeaderPane(Color bgColor, String title, int headHeight) { this(bgColor); this.title = title; - this.headHeight = headHeight; - this.fontSize = NORMAL_FONTSIZE; } public static void main(String[] args) { diff --git a/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java b/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java index 9ed2d9757b..7d27031468 100644 --- a/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java +++ b/designer-base/src/main/java/com/fr/design/foldablepane/UIExpandablePane.java @@ -1,7 +1,10 @@ package com.fr.design.foldablepane; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Color; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -42,7 +45,7 @@ public class UIExpandablePane extends JPanel { } private void initComponents() { - this.setLayout(new BorderLayout()); + this.setLayout(new BorderLayout(0, UIManager.getInt("ExpandablePane.vGap"))); headerPanel = new HeaderPane(color, title, headHeight); headerPanel.addMouseListener(new PanelAction()); diff --git a/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_down.svg b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_down.svg new file mode 100755 index 0000000000..7a0d1e3443 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_down.svg @@ -0,0 +1,4 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_down_small.svg b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_down_small.svg new file mode 100755 index 0000000000..b513a4de7f --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_down_small.svg @@ -0,0 +1,4 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_left.svg b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_left.svg new file mode 100755 index 0000000000..0e9c0637ba --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_left.svg @@ -0,0 +1,4 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_left_small.svg b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_left_small.svg new file mode 100755 index 0000000000..7307860955 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_left_small.svg @@ -0,0 +1,4 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_right.svg b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_right.svg new file mode 100755 index 0000000000..cfdd78d161 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_right.svg @@ -0,0 +1,4 @@ + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_right_small.svg b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_right_small.svg new file mode 100755 index 0000000000..af6ac0335a --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/triangle/triangle_right_small.svg @@ -0,0 +1,4 @@ + + + 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 1574aeb674..64685e8553 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 @@ -92,6 +92,7 @@ ViewportUI = com.formdev.flatlaf.ui.FlatViewportUI color.brand.normal=#2576EF color.text.white=#ffffff color.text.placeholder=#0A1C3878 +color.text.highlight=#0A1C38E6 # general background and foreground (text color) @@ -1061,6 +1062,12 @@ Tree.hash = darken($Tree.background,10%) #---- West ---- West.border = #DADEE7 +#---- ExpandablePane ---- +ExpandablePane.HeaderPane.borderInsets=0, 6, 0, 6 +ExpandablePane.HeaderPane.hGap=2 +ExpandablePane.vGap=10 +HeaderPane.width=248 +HeaderPane.height=24 #---- East ---- East.border = #DADEE7 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 5ac64d401a..6f01d9e192 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -141,17 +141,18 @@ public class CellOtherSetPane extends AbstractCellAttrPane { * @return 面板 */ public JPanel createContentPane() { - JPanel contentPane = FRGUIPaneFactory.createVerticalFlowLayout_F_Pane(true, VerticalFlowLayout.TOP, 0, 0, true); - - contentPane.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane())); - contentPane.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advaced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane())); - contentPane.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane())); - contentPane.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Desensitization"), HEAD_WDITH, HEAD_HEIGTH, desensitizePane())); - // VerticalFlowLayout 与 实现的滚动条有冲突,因此再加一层panel - JPanel jPanel = new JPanel(); - jPanel.add(contentPane); + + Component[][] components = new Component[][]{ + new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Basic"), HEAD_WDITH, HEAD_HEIGTH, basicPane())}, + new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advaced"), HEAD_WDITH, HEAD_HEIGTH, seniorPane())}, + new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Pagination"), HEAD_WDITH, HEAD_HEIGTH, pagePane())}, + new Component[]{new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Desensitization"), HEAD_WDITH, HEAD_HEIGTH, desensitizePane())} + }; + + JPanel tableLayoutPane = TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p, p, p}, new double[]{f}); + initAllNames(); - return jPanel; + return tableLayoutPane; } private JPanel desensitizePane() {