From f90fa77a28952cb376743015b3edf260096a71b6 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 13:01:11 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55553=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E7=8E=B0=E5=9C=A8=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E7=9A=84?= =?UTF-8?q?=E5=B1=82=E6=AC=A1=E6=95=88=E6=9E=9C=E5=92=8C=E8=A7=86=E8=A7=89?= =?UTF-8?q?=E7=A8=BF=E4=B8=8D=E4=B8=80=E6=A0=B7=EF=BC=8C=E5=B1=82=E6=AC=A1?= =?UTF-8?q?=E9=97=B4=E9=9A=94=E4=B8=8D=E6=B8=85=E6=99=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1.windows上边框线没显示出来 2.变动下层级结构,突出背景只作用于控件主体 【改动思路】 1. 绘制边框线时,边框线的大小应该是thickness的2倍 2. 修改Body样式面板的效果,去除多余的文字标签 3. 修改层级结构 --- .../fr/design/gui/xpane/LayoutStylePane.java | 89 +++++++++++++------ 1 file changed, 63 insertions(+), 26 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index 81ce5fa7e..c0ad60ad4 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -1,10 +1,8 @@ package com.fr.design.gui.xpane; -import com.fr.base.GraphHelper; import com.fr.base.Utils; import com.fr.base.svg.IconUtils; import com.fr.design.beans.BasicBeanPane; -import com.fr.design.constants.UIConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.formula.TinyFormulaPane; @@ -13,7 +11,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -105,42 +102,46 @@ public class LayoutStylePane extends BasicBeanPane { boolean currentIsRootLayout = currentEditingTemplate != null && !currentEditingTemplate.isJWorkBook() && ((JForm)currentEditingTemplate).isSelectRootPane(); JPanel titlePane = createTitleStylePane(); + JPanel bodyContentPane = currentIsRootLayout ? createBodyContentPane4RootLayout() : createBodyContentPane(); + JPanel backgroundPane = createBackgroundStylePane(); + if (titlePane != null) { container.add(titlePane, BorderLayout.NORTH); if (currentIsRootLayout) { titlePane.setVisible(false); } } + JPanel nextContainerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.add(nextContainerPane, BorderLayout.CENTER); - //界面上表单主体只有背景和透明度可以设置 - JPanel mainStylePane = currentIsRootLayout ? createMainStylePane4RootLayout() : createMainStylePane4WidgetLayout(); - if (mainStylePane != null) { - container.add(mainStylePane, BorderLayout.CENTER); + if (bodyContentPane != null) { + //界面上表单主体只有背景和透明度可以设置 + nextContainerPane.add(bodyContentPane, BorderLayout.NORTH); + } + if (backgroundPane != null) { + nextContainerPane.add(backgroundPane, BorderLayout.CENTER); + if (currentIsRootLayout) { + backgroundPane.setVisible(false); + } } this.add(container, BorderLayout.CENTER); } - protected void initMainComponents() { + protected JPanel createBackgroundStylePane() { borderStyleCombo = new UIComboBox(BORDER_STYLE); borderLineAndImagePane = new BorderLineAndImagePane(); cornerSpinner = new UISpinner(0,1000,1,0); - backgroundPane = new LayoutBackgroundSpecialPane(); - backgroundOpacityPane = new UIPercentDragPane(); - } - protected JPanel createMainStylePane4WidgetLayout() { - initMainComponents(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] rowSize = {p, p, p, p, p}; + double[] rowSize = {p, p, p, p}; double[] columnSize = {SETTING_LABEL_WIDTH, f}; JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style")), null}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo}, {this.borderLineAndImagePane, null}, - {this.createMainBackgroundAndOpacityPane(), null}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner}, }, rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); @@ -153,16 +154,23 @@ public class LayoutStylePane extends BasicBeanPane { return container; } - protected JPanel createMainStylePane4RootLayout() { - initMainComponents(); + protected JPanel createBodyContentPane() { + backgroundPane = new LayoutBackgroundSpecialPane(); + backgroundOpacityPane = new UIPercentDragPane(); + double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] rowSize = {p, p}; double[] columnSize = {SETTING_LABEL_WIDTH, f}; + JPanel bodyBackground = createBackgroundAndOpacityPane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Fill"), + this.backgroundPane, + this.backgroundOpacityPane); + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ - {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null}, - {this.createMainBackgroundAndOpacityPane(), null}, + {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Content")), null}, + {bodyBackground, null}, }, rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); @@ -174,11 +182,31 @@ public class LayoutStylePane extends BasicBeanPane { return container; } - protected JPanel createMainBackgroundAndOpacityPane() { - return createBackgroundAndOpacityPane( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Background"), + protected JPanel createBodyContentPane4RootLayout() { + backgroundPane = new LayoutBackgroundSpecialPane(); + backgroundOpacityPane = new UIPercentDragPane(); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] rowSize = {p}; + double[] columnSize = {SETTING_LABEL_WIDTH, f}; + + JPanel bodyBackground = createBackgroundAndOpacityPane( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Fill"), this.backgroundPane, this.backgroundOpacityPane); + + JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ + {bodyBackground, null}, + }, + rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); + contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); + + JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); + container.setBorder(new BottomLineBorder()); + container.add(contentPane, BorderLayout.NORTH); + + return container; } protected void initTitleComponents() { @@ -489,16 +517,25 @@ public class LayoutStylePane extends BasicBeanPane { protected static class BottomLineBorder extends LineBorder { public BottomLineBorder() { - super(Color.lightGray, 1); + super(new Color(217, 218, 221), 1); } @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D g2d = (Graphics2D) g; + Color oldColor = g2d.getColor(); - g2d.setColor(this.lineColor); - GraphHelper.drawLine(g, 0, height, width, height, 1); + Stroke oldStroke = g2d.getStroke(); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + g2d.setColor(getLineColor()); + g2d.setStroke(new BasicStroke(getThickness() * 2)); + g2d.drawLine(0, height, width, height); + + g2d.setStroke(oldStroke); g2d.setColor(oldColor); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } }