Browse Source

REPORT-4450 聚合报表在缩放后编辑报表块,会出现单元格错乱

master
MoMeak 7 years ago
parent
commit
685c496d8a
  1. 30
      designer/src/com/fr/poly/PolyDesignUI.java
  2. 9
      designer/src/com/fr/poly/PolyUtils.java
  3. 1
      designer/src/com/fr/poly/creator/ECBlockEditor.java

30
designer/src/com/fr/poly/PolyDesignUI.java

@ -3,12 +3,7 @@
*/
package com.fr.poly;
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.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.text.DecimalFormat;
@ -29,6 +24,7 @@ import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider;
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.report.Report;
@ -101,6 +97,7 @@ public class PolyDesignUI extends ComponentUI {
paintAddingData(g2d, addData);
}
paintPaginateLine(g2d);
designer.repaint();
}
private void paintAddedData(Graphics g) {
@ -109,8 +106,8 @@ public class PolyDesignUI extends ComponentUI {
BlockCreator creator = addedData.getAddedAt(i);
// richer:如果当前这个组件正在编辑,那么他是完全被他的编辑器所遮挡的,不需要画出来
if (creator == designer.getSelection()) {
paintPositionLine(g, creator.getX(time), creator.getY(time),
(int) (designer.getHorizontalValue()*time), (int) (designer.getVerticalValue()*time));
paintPositionLine(g, Math.round(creator.getX() * time), Math.round(creator.getY() * time),
Math.round(designer.getHorizontalValue()*time), Math.round(designer.getVerticalValue()*time));
if (creator.getEditor().isDragging()) {
creator.getEditor().paintAbsorptionline(g);
//如果与其他块重合了, 需要画出提示禁止重叠
@ -121,8 +118,8 @@ public class PolyDesignUI extends ComponentUI {
creator.getEditor().hideForbiddenWindow();
}
} else {
paintCreator(g, creator, (int) (creator.getX()*time - designer.getHorizontalValue()*time), (int) (creator.getY()*time - designer.getVerticalValue()*time),
(int) (creator.getWidth()*time), (int) (creator.getHeight()*time));
paintCreator(g, creator, creator.getX() - designer.getHorizontalValue(), creator.getY() - designer.getVerticalValue(),
creator.getWidth(), creator.getHeight());
}
}
}
@ -223,16 +220,19 @@ public class PolyDesignUI extends ComponentUI {
ArrayList<JComponent> dbcomponents = new ArrayList<JComponent>();
// richer:禁止双缓冲行为,否则会出现两个图像
ComponentUtils.disableBuffer(comp, dbcomponents);
// Graphics clipg = g.create(x, y, width*resolution/ScreenResolution.getScreenResolution(), height*resolution/ScreenResolution.getScreenResolution());
//
if (comp instanceof ECBlockCreator) {
Graphics clipg = g.create((int) (x * time), (int) (y * time), (int) (width * time), (int) (height * time));
comp.paint(clipg);
clipg.dispose();
}else {
BufferedImage img = CoreGraphHelper.createBufferedImage(comp.getWidth(), comp.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = img.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
comp.printAll(g2d);
g2d.dispose();
g.drawImage(img,x,y,width,height,null);
g.drawImage(img, (int) (x * time), (int) (y * time), (int) (width * time), (int) (height * time),null);
}
// comp.paint(clipg);
// clipg.dispose();
ComponentUtils.resetBuffer(dbcomponents);
}

9
designer/src/com/fr/poly/PolyUtils.java

@ -115,11 +115,10 @@ public class PolyUtils {
AddedData addedData = designer.getAddedData();
for (int count = addedData.getAddedCount() - 1; count >= 0; count--) {
BlockCreator creator = addedData.getAddedAt(count);
float times = (float) designer.getResolution()/ScreenResolution.getScreenResolution();
int cx = (int) (creator.getX() * times);
int cy = (int) (creator.getY() * times);
int cw = (int) (creator.getWidth() * times);
int ch = (int) (creator.getHeight() * times);
int cx = creator.getX();
int cy = creator.getY();
int cw = creator.getWidth();
int ch = creator.getHeight();
if (x >= cx && x <= (cx + cw)) {
if(y >= cy && y <= (cy + ch)) {
return creator;

1
designer/src/com/fr/poly/creator/ECBlockEditor.java

@ -34,6 +34,7 @@ import java.awt.*;
*/
public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
private static final int HEIGHT_MORE = 5;
private int resolution = ScreenResolution.getScreenResolution();
public ECBlockEditor(PolyDesigner designer, ECBlockCreator creator) {
super(designer, creator);

Loading…
Cancel
Save