From dd9001a37289c422d57d69e7300ce83adea2571f Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 26 Aug 2021 17:10:01 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-58052=20&&REPORT-57959=20=E3=80=90?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=88=87=E6=8D=A2=E3=80=91=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E8=AE=BE=E7=BD=AE=E5=9B=BE=E7=89=87=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=EF=BC=8C=E6=95=B4=E4=BD=93=E9=A2=84=E8=A7=88=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=98=BE=E7=A4=BA=E6=9C=89=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=E3=80=90=E4=B8=BB=E9=A2=98=E5=88=87=E6=8D=A2=E3=80=91=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E5=AE=9A=E5=88=B6-=E7=BB=84=E4=BB=B6=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F-=E8=83=8C=E6=99=AF=E4=B8=AD=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=9C=86=E8=A7=92=EF=BC=8C=E5=B7=A6=E4=BE=A7=E5=9B=BE=E7=A4=BA?= =?UTF-8?q?=E7=9C=8B=E7=9D=80=E4=BC=9A=E9=87=8D=E5=8F=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../theme/preview/FormThemePreviewPane.java | 30 ++++++++++--------- .../theme/preview/ReportThemePreviewPane.java | 19 +++++------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java index bca48fac7..0fc194492 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java @@ -12,7 +12,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.theme.TemplateThemePreviewPane; import com.fr.design.mainframe.theme.preview.ecpreview.ECComponentPreviewPane; -import com.fr.design.utils.ComponentUtils; import com.fr.general.Background; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.PiePlot4VanChart; @@ -24,10 +23,10 @@ import com.fr.plugin.chart.type.RadiusType; import com.fr.plugin.chart.vanchart.VanChart; import com.fr.stable.Constants; import com.fr.stable.StringUtils; - -import javax.swing.JComponent; import javax.swing.JPanel; -import java.util.ArrayList; +import java.awt.AlphaComposite; +import java.awt.Composite; +import java.awt.Graphics2D; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -44,6 +43,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { private Background background; private ChartComponentPreviewPane columnChartPreviewPane; private ChartComponentPreviewPane pieChartPreviewPane; + private float alpha = 1.0F; public FormThemePreviewPane() { setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -72,9 +72,9 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { } }; pieChartPanel.setLayout(new BorderLayout()); - pieChartPreviewPane = createChartPreviewPane(initPieChart(), 300, 368); + pieChartPreviewPane = createChartPreviewPane(initPieChart(), 217, 368); pieChartPanel.add(pieChartPreviewPane, BorderLayout.CENTER); - chartContent.add(columnChartPanel, BorderLayout.WEST); + chartContent.add(columnChartPanel, BorderLayout.CENTER); chartContent.add(pieChartPanel, BorderLayout.EAST); return chartContent; } @@ -89,6 +89,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { @Override public void refresh(FormTheme theme) { background = theme.getBodyStyle().getStyle().getBackground(); + alpha = theme.getBodyStyle().getStyle().getAlpha(); elementCasePane.refresh(theme); columnChartPreviewPane.refresh(theme); pieChartPreviewPane.refresh(theme); @@ -96,18 +97,19 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { } - public void paint(Graphics g) { - // 禁止双缓冲 - ArrayList dbcomponents = new ArrayList(); + @Override + public void paintComponent(Graphics g) { + paintBackground((Graphics2D) g); + } + private void paintBackground(Graphics2D g2d) { if (background == null) { background = ColorBackground.getInstance(Color.WHITE); } - background.paint(g, new Rectangle2D.Double(0, 0, 517, 532)); - paintChildren(g); - // 恢复双缓冲 - ComponentUtils.resetBuffer(dbcomponents); - + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); + background.paint(g2d, new Rectangle2D.Double(0, 0, 517, 532)); + g2d.setComposite(oldComposite); } //柱形图 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java index 71aad36ec..f4e23853d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java @@ -12,7 +12,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.theme.TemplateThemePreviewPane; import com.fr.design.mainframe.theme.preview.ecpreview.ECReportPreviewPane; -import com.fr.design.utils.ComponentUtils; import com.fr.general.Background; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.axis.VanChartAxis; @@ -21,8 +20,7 @@ import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.plugin.chart.vanchart.VanChart; -import javax.swing.JComponent; -import java.util.ArrayList; +import java.awt.Graphics2D; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; @@ -57,19 +55,16 @@ public class ReportThemePreviewPane extends TemplateThemePreviewPane dbcomponents = new ArrayList(); - + private void paintBackground(Graphics2D g2d) { if (background == null) { background = ColorBackground.getInstance(Color.WHITE); } - background.paint(g, new Rectangle2D.Double(0, 0, 517, 532)); - paintChildren(g); - // 恢复双缓冲 - ComponentUtils.resetBuffer(dbcomponents); - + background.paint(g2d, new Rectangle2D.Double(0, 0, 517, 532)); }