From d657b5d8bde751e00727b710d75b906ad626d2f5 Mon Sep 17 00:00:00 2001 From: hades Date: Thu, 5 May 2022 18:52:09 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-70446=20=E4=BA=A4=E4=BA=92=E8=A7=86?= =?UTF-8?q?=E8=A7=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/component/ProductNewsImagePanel.java | 2 +- .../fr/design/mainframe/alphafine/question/QuestionPane.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java index e87b6f199..dd1b3c483 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java @@ -56,7 +56,7 @@ public class ProductNewsImagePanel extends JPanel { } Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); if (!readSet.contains(productNews.getId())) { - g2.drawImage(NEW_TIP_IMAGE, 0, 0, this); + g2.drawImage(NEW_TIP_IMAGE, 0, 0, (int) (NEW_TIP_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE), (int) (NEW_TIP_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE), this); } g2.setColor(BACKGROUND_COLOR); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java index 2726824b7..81617d0d8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java @@ -39,7 +39,9 @@ public class QuestionPane extends JPanel { } else { g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, getWidth(), getHeight(), this); } - g2.drawImage(QUESTION_IMAGE, (getWidth() - QUESTION_IMAGE.getWidth(this)) / 2, (getHeight() - QUESTION_IMAGE.getHeight(this)) / 2, this); + int imageWidth = (int) (QUESTION_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE); + int imageHeight = (int) (QUESTION_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE); + g2.drawImage(QUESTION_IMAGE, (getWidth() - imageWidth) / 2, (getHeight() - imageHeight) / 2, imageWidth, imageHeight, this); } From 5f8806250a469f8f08a1913337021b71e38fc857 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 6 May 2022 11:02:53 +0800 Subject: [PATCH 2/4] =?UTF-8?q?REPORT-70387=20=E6=AC=A1=E7=AE=A1=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E8=BF=9E=E6=8E=A5=EF=BC=8C=E4=BC=9A=E7=9C=8B=E5=88=B0?= =?UTF-8?q?=E7=89=B9=E5=AE=9A=E7=9A=84=E6=B2=A1=E6=9C=89=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/datapane/connect/ConnectionComboBoxPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java index fe69024a8..640fb2762 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java @@ -142,7 +142,7 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel { if (StringUtils.isNotBlank(s)) { // 之前的写法有多线程问题,nameList异步尚未初始化完成的时候,这里可能无法匹配设置数据连接名称,导致DBTableDataPane打开后连接面板空白 // 这里的需求无非是设置上一次使用的数据连接,做个简单检查这个连接是否存在即可,存在就设置 - if (ConnectionConfig.getInstance().getConnection(s) != null) { + if (nameList.contains(s)) { this.setSelectedItem(s); } } From f2bdb747137a97b67b79cf716230122c24af0005 Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 6 May 2022 16:42:15 +0800 Subject: [PATCH 3/4] =?UTF-8?q?REPORT-70446=20=E4=BA=A4=E4=BA=92=E8=A7=86?= =?UTF-8?q?=E8=A7=89=E4=BF=AE=E6=94=B9=20svg=E5=9B=BE=E7=89=87=E7=BB=98?= =?UTF-8?q?=E5=88=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/ProductNewsImagePanel.java | 6 ++++- .../alphafine/question/QuestionPane.java | 23 +++++++++++++++---- .../mainframe/alphafine/images/group_new.svg | 2 +- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java index dd1b3c483..b46d094d8 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/component/ProductNewsImagePanel.java @@ -2,8 +2,10 @@ package com.fr.design.mainframe.alphafine.component; import com.fr.base.GraphHelper; import com.fr.base.svg.SVGLoader; +import com.fr.base.svg.SystemScaleUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.alphafine.model.ProductNews; +import com.fr.design.utils.SvgPaintUtils; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -56,7 +58,9 @@ public class ProductNewsImagePanel extends JPanel { } Set readSet = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().getReadSet(); if (!readSet.contains(productNews.getId())) { - g2.drawImage(NEW_TIP_IMAGE, 0, 0, (int) (NEW_TIP_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE), (int) (NEW_TIP_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE), this); + SvgPaintUtils.beforePaint(g2); + g2.drawImage(NEW_TIP_IMAGE, 0, 0, this); + SvgPaintUtils.afterPaint(g2); } g2.setColor(BACKGROUND_COLOR); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java index 81617d0d8..e0d528894 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/question/QuestionPane.java @@ -1,7 +1,9 @@ package com.fr.design.mainframe.alphafine.question; import com.fr.base.svg.SVGLoader; +import com.fr.base.svg.SystemScaleUtils; import com.fr.design.mainframe.alphafine.AlphaFineUtil; +import com.fr.design.utils.SvgPaintUtils; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -23,6 +25,10 @@ public class QuestionPane extends JPanel { private static final Image QUESTION_BACKGROUND_IMAGE = SVGLoader.load("/com/fr/design/mainframe/alphafine/images/groupbackgroud.svg"); + private static final int WIDTH = 40; + + private static final int HEIGHT = 40; + public QuestionPane() { this.setBackground(new Color(0, 0, 0, 0)); @@ -34,14 +40,21 @@ public class QuestionPane extends JPanel { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + SvgPaintUtils.beforePaint(g2); + // 宽高保持 + int width = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getWidth() * SVGLoader.SYSTEM_SCALE) : getWidth(); + int height = SystemScaleUtils.isJreHiDPIEnabled() ? (int) (getHeight() * SVGLoader.SYSTEM_SCALE) : getHeight(); + if (AlphaFineUtil.unread()) { - g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, getWidth(), getHeight(), this); + g2.drawImage(NEW_MESSAGE_IMAGE, 0, 0, width, height, this); } else { - g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, getWidth(), getHeight(), this); + g2.drawImage(QUESTION_BACKGROUND_IMAGE, 0, 0, width, height, this); } - int imageWidth = (int) (QUESTION_IMAGE.getWidth(this) / SVGLoader.SYSTEM_SCALE); - int imageHeight = (int) (QUESTION_IMAGE.getHeight(this) / SVGLoader.SYSTEM_SCALE); - g2.drawImage(QUESTION_IMAGE, (getWidth() - imageWidth) / 2, (getHeight() - imageHeight) / 2, imageWidth, imageHeight, this); + + int imageWidth = QUESTION_IMAGE.getWidth(this); + int imageHeight = QUESTION_IMAGE.getHeight(this); + g2.drawImage(QUESTION_IMAGE, (width - imageWidth) / 2, (height - imageHeight) / 2, imageWidth, imageHeight,this); + SvgPaintUtils.afterPaint(g2); } diff --git a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg index af299d12b..9b25587c4 100644 --- a/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg +++ b/designer-realize/src/main/resources/com/fr/design/mainframe/alphafine/images/group_new.svg @@ -1,4 +1,4 @@ - + From 5e3cf961e56c1ba3275668dff59f68942bbb38fe Mon Sep 17 00:00:00 2001 From: hades Date: Fri, 6 May 2022 16:42:56 +0800 Subject: [PATCH 4/4] =?UTF-8?q?REPORT-70446=20=E6=B7=BB=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/utils/SvgPaintUtils.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java diff --git a/designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java b/designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java new file mode 100644 index 000000000..fdb460eb4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java @@ -0,0 +1,28 @@ +package com.fr.design.utils; + +import com.fr.base.svg.SVGLoader; +import com.fr.base.svg.SystemScaleUtils; +import java.awt.Graphics2D; + +/** + * 用于绘制svg图片缩放(高分屏下) + * + * @author hades + * @version 11.0 + * Created by hades on 2022/5/6 + */ +public class SvgPaintUtils { + + public static void beforePaint(Graphics2D g2) { + if (SystemScaleUtils.isJreHiDPIEnabled()) { + g2.scale(1 / SVGLoader.SYSTEM_SCALE, 1 / SVGLoader.SYSTEM_SCALE); + } + } + + public static void afterPaint(Graphics2D g2) { + if (SystemScaleUtils.isJreHiDPIEnabled()) { + g2.scale(SVGLoader.SYSTEM_SCALE, SVGLoader.SYSTEM_SCALE); + } + } + +}