Browse Source

Merge pull request #154 in DESIGN/design from ~PLOUGH/10-design:release/10.0 to release/10.0

* commit 'c8d7760c4e05aff02acf173cbfdf77859425a173':
  REPORT-8608 - 安全性之水印交互验收问题=>聚合报表部分
  REPORT-9019 绝对布局适应区域,减少不同分辨率下组件坐标的计算误差
master
plough 7 years ago
parent
commit
262eb5b8ed
  1. 8
      designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java
  2. 45
      designer-realize/src/com/fr/poly/PolyDesignUI.java

8
designer-form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -248,10 +248,10 @@ public class XWAbsoluteLayout extends XLayoutContainer {
for (int i = 0; i < this.getComponentCount(); i++) {
XCreator creator = getXCreator(i);
Rectangle rec = new Rectangle(creator.getBounds());
rec.x = (int) (rec.x / prevContainerPercent * containerPercent);
rec.y = (int) (rec.y / prevContainerPercent * containerPercent);
rec.height = (int) (rec.height / prevContainerPercent * containerPercent);
rec.width = (int) (rec.width / prevContainerPercent * containerPercent);
rec.x = (int)Math.round (rec.x / prevContainerPercent * containerPercent);
rec.y = (int)Math.round (rec.y / prevContainerPercent * containerPercent);
rec.height = (int)Math.round (rec.height / prevContainerPercent * containerPercent);
rec.width = (int)Math.round (rec.width / prevContainerPercent * containerPercent);
BoundsWidget wgt = (BoundsWidget) toData().getBoundsWidget(creator.toData());
wgt.setBounds(rec);
creator.setBounds(rec);

45
designer-realize/src/com/fr/poly/PolyDesignUI.java

@ -3,30 +3,23 @@
*/
package com.fr.poly;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
import javax.swing.plaf.ComponentUI;
import com.fr.base.GraphHelper;
import com.fr.base.Margin;
import com.fr.base.PaperSize;
import com.fr.base.ScreenResolution;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.design.utils.ComponentUtils;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.main.FineBook;
import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider;
import com.fr.page.WatermarkPainter;
import com.fr.poly.creator.BlockCreator;
import com.fr.poly.creator.ECBlockCreator;
import com.fr.poly.creator.ECBlockEditor;
import com.fr.poly.model.AddedData;
import com.fr.poly.model.AddingData;
import com.fr.report.core.ReportUtils;
import com.fr.report.report.Report;
import com.fr.report.report.TemplateReport;
import com.fr.report.stable.ReportConstants;
@ -34,6 +27,21 @@ import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.unit.UNIT;
import javax.swing.JComponent;
import javax.swing.JScrollBar;
import javax.swing.plaf.ComponentUI;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
import java.util.ArrayList;
/**
* @author richer
* @since 6.5.3 聚合报表设计块的ui类
@ -48,6 +56,7 @@ public class PolyDesignUI extends ComponentUI {
private PolyDesigner designer;
private int resolution;
private float time;
private WatermarkPainter watermarkPainter;
public PolyDesignUI(int resolution) {
if (resolution == 0){
@ -97,6 +106,18 @@ public class PolyDesignUI extends ComponentUI {
paintAddingData(g2d, addData);
}
paintPaginateLine(g2d);
paintWatermark(g2d, designer.getTarget().getBook(), c.getWidth(), c.getHeight());
}
// 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book, int width, int height) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book);
// 不要每次都 new 一个 WatermarkPainter
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g2d, width, height);
}
private void paintAddedData(Graphics g) {

Loading…
Cancel
Save