From f90fa77a28952cb376743015b3edf260096a71b6 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 13:01:11 +0800 Subject: [PATCH 1/3] =?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); } } From 2f0a6e485c7b444c28dfb22be7ada47cbcc5a73f Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 13:23:52 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-55709=20frm=E4=B8=ADbody=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E8=AE=BE=E7=BD=AE=E4=BA=86=E8=83=8C=E6=99=AF=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E9=80=8F=E6=98=8E=E5=BA=A6=E8=AE=BE=E7=BD=AE0%?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=80=8F=E6=98=8E=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 绘制背景时没有考虑透明度 【改动思路】 绘制组件主体背景和标题背景时设置透明度 --- .../designer/creator/XBorderStyleWidgetCreator.java | 4 ++++ .../java/com/fr/design/designer/creator/XLabel.java | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index 26d65cb5d..645f38706 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -226,7 +226,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ public void paintBackground(Graphics2D g2d) { Background background4Painting = getBackground4Painting(); if (background4Painting != null) { + BorderPacker style = toData().getBorderStyle(); + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, style.getAlpha())); background4Painting.paint(g2d, new Rectangle2D.Double(0, 0, getWidth(), getHeight())); + g2d.setComposite(oldComposite); } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java b/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java index 154091a29..13358f2b2 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java @@ -19,6 +19,7 @@ import com.fr.form.ui.Label; import com.fr.form.ui.container.WParameterLayout; import com.fr.general.Background; +import com.fr.general.act.BorderPacker; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; import com.fr.stable.core.PropertyChangeAdapter; @@ -91,8 +92,13 @@ public class XLabel extends XWidgetCreator { Label label = (Label) data; Dimension size = this.getSize(); //先画背景,再画标题 - if (toData().getBackground() != null) { - toData().getBackground().paint(g, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight())); + Background background = label.getBackground(); + if (background != null) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, label.getBackgroundOpacity())); + background.paint(g, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight())); + g2d.setComposite(oldComposite); } if (label.getWidgetValue() != null) { Graphics2D g2d = (Graphics2D) g.create(); From e527377c5cd696b02b462aadab3ed27278e084c2 Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 13:43:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-55694=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=BB=84=E4=BB=B6/=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E9=94=81=E5=AE=9A=E6=97=B6=EF=BC=8C=E9=80=9A=E8=BF=87=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E8=AE=BE=E7=BD=AE=E9=9D=A2=E6=9D=BF=E5=85=88=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AE=BD=E5=BA=A6=E6=97=B6=EF=BC=8C=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=E4=B8=8D=E5=8F=98=EF=BC=9B=E4=BD=86=E5=87=8F=E5=B0=8F=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E6=97=B6=EF=BC=8C=E9=AB=98=E5=BA=A6=E4=BC=9A1?= =?UTF-8?q?=E5=8D=95=E4=BD=8D1=E5=8D=95=E4=BD=8D=E5=87=8F=E5=B0=8F?= =?UTF-8?q?=EF=BC=8C=E6=9C=80=E5=90=8E=E7=BB=84=E4=BB=B6=E5=8F=98=E6=88=90?= =?UTF-8?q?=E4=B8=80=E6=9D=A1=E6=A8=AA=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 1. 直接编辑宽度和高度,互相联动,存在小数舍入的问题,比如20.75,只取20,导致越来越小 2. 在锁定比例功能从未启动到启动时,需要保存尺寸比例,并持久化,否则再次打开模版后,原有的比例数据 就消失了 【改动思路】 1. WidgetBoundPane.java中widthSpinner和heightSpinner互相关联时, 使用Math.round取整,而不是直接取整数部分 2. 在启用比例锁定时,保存当前的aspectRatioBackup,除非关闭比例锁定,否则不更新改值 3. 高度或宽度为0时,取消比例锁定,避免出现除0问题 4. 绝对布局内组件移入移出时,重新计算锁定的尺寸比例 --- .../ui/designer/component/WidgetBoundPane.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index 2fdec31e1..a462a8aed 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -265,11 +265,13 @@ public class WidgetBoundPane extends BasicPane { @Override public void stateChanged(ChangeEvent e) { if (isLockEnabled() && isLocked()) { - setLocked(false); - aspectRatioBackup = -1; - } else if (aspectRatioBackup > 0) { - double value = mHeightSpinner.getValue() * aspectRatioBackup; - mWidthSpinner.setValue(Math.round(value), false); + if (mHeightSpinner.getValue() == 0) { + setLocked(false); + aspectRatioBackup = -1; + }else if (aspectRatioBackup > 0) { + double value = mHeightSpinner.getValue() * aspectRatioBackup; + mWidthSpinner.setValue(Math.round(value), false); + } } } });