Browse Source

REPORT-8608 安全性之水印交互验收问题=>表单部分

master
plough 7 years ago
parent
commit
c26b03e7bf
  1. 17
      designer-form/src/com/fr/design/mainframe/FormDesignerUI.java
  2. 21
      designer-realize/src/com/fr/grid/GridUI.java

17
designer-form/src/com/fr/design/mainframe/FormDesignerUI.java

@ -19,6 +19,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.base.iofileattr.WatermarkAttr;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
@ -31,7 +32,10 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.page.WatermarkPainter;
import com.fr.report.core.ReportUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper; import com.fr.stable.CoreGraphHelper;
@ -46,6 +50,7 @@ public class FormDesignerUI extends ComponentUI {
private FormDesigner designer; private FormDesigner designer;
private SelectionModel selectionModel; private SelectionModel selectionModel;
private Rectangle2D.Double back_or_selection_rect = new Rectangle2D.Double(0, 0, 0, 0); private Rectangle2D.Double back_or_selection_rect = new Rectangle2D.Double(0, 0, 0, 0);
private WatermarkPainter watermarkPainter;
private float time; private float time;
public FormDesignerUI() { public FormDesignerUI() {
@ -111,6 +116,18 @@ public class FormDesignerUI extends ComponentUI {
// 当前正在添加的组件 // 当前正在添加的组件
paintAddingBean(g, addingModel); paintAddingBean(g, addingModel);
} }
paintWatermark((Graphics2D) g);
}
// 绘制水印
private void paintWatermark(Graphics2D g) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget());
// 不要每次都 new 一个 WatermarkPainter
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g, 0, designer.getParaHeight(), designer.getArea().getBounds());
} }
private int[] getActualLine(int i) { private int[] getActualLine(int i) {

21
designer-realize/src/com/fr/grid/GridUI.java

@ -22,6 +22,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.main.FineBook;
import com.fr.page.PaperSettingProvider; import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportPage; import com.fr.page.ReportPage;
import com.fr.page.ReportSettingsProvider; import com.fr.page.ReportSettingsProvider;
@ -98,6 +99,7 @@ public class GridUI extends ComponentUI {
protected int resolution; protected int resolution;
private boolean isAuthority = false; private boolean isAuthority = false;
private WatermarkPainter watermarkPainter;
public GridUI(int resolution) { public GridUI(int resolution) {
super(); super();
@ -162,9 +164,6 @@ public class GridUI extends ComponentUI {
// denny: make that the background can move with scroll // denny: make that the background can move with scroll
paintScrollBackground(g2d, grid, background, psetting, reportSettings); paintScrollBackground(g2d, grid, background, psetting, reportSettings);
} }
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(((WorkSheet) elementCase).getBook());
new WatermarkPainter(watermark).paint(g2d, this.back_or_selection_rect.getBounds());
} }
private void clearBackground(Graphics2D g2d, Grid grid) { private void clearBackground(Graphics2D g2d, Grid grid) {
@ -1095,9 +1094,25 @@ public class GridUI extends ComponentUI {
// 画Drag格子的边框. // 画Drag格子的边框.
this.paintDragCellBorder(g2d, grid); this.paintDragCellBorder(g2d, grid);
// 画水印
if (elementCase instanceof WorkSheet) {
paintWatermark(g2d, ((WorkSheet) elementCase).getBook());
}
grid.ajustEditorComponentBounds(); // refresh size grid.ajustEditorComponentBounds(); // refresh size
} }
// 绘制水印
private void paintWatermark(Graphics2D g2d, FineBook book) {
WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(book);
// 不要每次都 new 一个 WatermarkPainter
if (watermarkPainter == null || !ComparatorUtils.equals(watermarkPainter.getWatermark(), watermark)) {
watermarkPainter = new WatermarkPainter(watermark);
}
watermarkPainter.paint(g2d, gridSize.width, gridSize.height);
}
private void dealWithSizeBeforePaint(Grid grid, TemplateElementCase elementCase) { private void dealWithSizeBeforePaint(Grid grid, TemplateElementCase elementCase) {
// 取出所有的行高和列宽的List // 取出所有的行高和列宽的List

Loading…
Cancel
Save