Browse Source

REPORT-58052 &&REPORT-57959

【主题切换】模板背景设置图片默认,整体预览部分显示有问题
【主题切换】细节定制-组件样式-背景中设置圆角,左侧图示看着会重叠
research/11.0
kerry 3 years ago
parent
commit
dd9001a372
  1. 30
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java
  2. 19
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java

30
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<FormTheme> {
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<FormTheme> {
}
};
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<FormTheme> {
@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<FormTheme> {
}
public void paint(Graphics g) {
// 禁止双缓冲
ArrayList<JComponent> dbcomponents = new ArrayList<JComponent>();
@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);
}
//柱形图

19
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<ReportTheme
chartPreviewPane.refresh(theme);
repaint();
}
@Override
public void paintComponent(Graphics g) {
paintBackground((Graphics2D) g);
}
public void paint(Graphics g) {
// 禁止双缓冲
ArrayList<JComponent> dbcomponents = new ArrayList<JComponent>();
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));
}

Loading…
Cancel
Save