Browse Source

REPORT-55491 【交互验收】【组件背景分离】在组件属性下的「主体背景」设置,在配置界面不生效,看不到效果

【问题原因】
1. 绘制图表块时,填充了白色背景,导致组件样式背景被覆盖
2. 图表进入编辑模式下,ChartComponent被绘制两次,差
了一个像素,又因为ChartComponent支持半透明,导致出现了
重影
【改动思路】
1. 表单布局面板上预览报表块时,不使用白色背景填充,保持透明
2. DesignerEditor绘制Editor时,补充下差了的一个
像素(默认灰色边框)
final/10.0
Starryi 3 years ago
parent
commit
ada9631983
  1. 12
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  2. 2
      designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java
  3. 3
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

12
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -43,6 +43,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
public ChartComponent() { public ChartComponent() {
super(); super();
setOpaque(true);
addMouseListener(this); addMouseListener(this);
addMouseMotionListener(this); addMouseMotionListener(this);
} }
@ -148,11 +149,12 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
chartCollection4Design.setPredefinedStyleName(getGlobalPredefinedStyleName(), false); chartCollection4Design.setPredefinedStyleName(getGlobalPredefinedStyleName(), false);
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
Paint oldPaint = g2d.getPaint(); if (this.isOpaque()) {
Paint oldPaint = g2d.getPaint();
g2d.setPaint(Color.WHITE); g2d.setPaint(Color.WHITE);
g2d.fillRect(0, 0, this.getBounds().width, this.getBounds().height); g2d.fillRect(0, 0, this.getBounds().width, this.getBounds().height);
g2d.setPaint(oldPaint); g2d.setPaint(oldPaint);
}
g2d.translate(ChartConstants.PREGAP4BOUNDS/2, ChartConstants.PREGAP4BOUNDS/2); g2d.translate(ChartConstants.PREGAP4BOUNDS/2, ChartConstants.PREGAP4BOUNDS/2);

2
designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java

@ -93,7 +93,7 @@ public class DesignerEditor<T extends JComponent> implements PropertyChangeListe
comp.setSize(new Dimension(width, height)); comp.setSize(new Dimension(width, height));
LayoutUtils.layoutContainer(comp); LayoutUtils.layoutContainer(comp);
comp.setBounds(comp.getX() + x, comp.getY() + y, width, height); comp.setBounds(comp.getX() + x - 1, comp.getY() + y - 1, width, height);
Graphics clipg = g.create(x, y, width, height); Graphics clipg = g.create(x, y, width, height);
this.comp.paint(clipg); this.comp.paint(clipg);
} }

3
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -231,7 +231,9 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
public void paintForeground(Graphics2D g) { public void paintForeground(Graphics2D g) {
Dimension size = getSize(); Dimension size = getSize();
PaddingMargin margin = toData().getMargin(); PaddingMargin margin = toData().getMargin();
designerEditor.paintEditor(g, size, margin); designerEditor.paintEditor(g, size, margin);
if (coverPanel != null) { if (coverPanel != null) {
int horizonMargin = margin != null ? margin.getLeft() + margin.getRight() : 0; int horizonMargin = margin != null ? margin.getLeft() + margin.getRight() : 0;
int verticalMargin = margin != null ? margin.getTop() + margin.getBottom() : 0; int verticalMargin = margin != null ? margin.getTop() + margin.getBottom() : 0;
@ -289,6 +291,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
final MiddleChartComponent chartComponent = DesignModuleFactory.getChartComponent(((BaseChartEditor) data).getChartCollection()); final MiddleChartComponent chartComponent = DesignModuleFactory.getChartComponent(((BaseChartEditor) data).getChartCollection());
if (chartComponent != null) { if (chartComponent != null) {
JComponent jChart = chartComponent; JComponent jChart = chartComponent;
chartComponent.setOpaque(false);
jChart.setBorder(BorderFactory.createLineBorder(Color.lightGray)); jChart.setBorder(BorderFactory.createLineBorder(Color.lightGray));
designerEditor = new DesignerEditor<JComponent>(jChart); designerEditor = new DesignerEditor<JComponent>(jChart);
chartComponent.addStopEditingListener(designerEditor); chartComponent.addStopEditingListener(designerEditor);

Loading…
Cancel
Save