Browse Source

REPORT-56602 页面设置的纸张大小与实际分页精度不符

bugfix/10.0
kerry 3 years ago
parent
commit
ef5917765f
  1. 62
      designer-realize/src/main/java/com/fr/grid/GridUI.java

62
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -10,12 +10,15 @@ import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground;
import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
@ -48,6 +51,7 @@ import com.fr.stable.Constants;
import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU;
import com.fr.stable.AssistUtils;
import com.fr.stable.unit.UNIT;
import com.fr.third.antlr.ANTLRException;
import com.fr.third.guava.collect.HashMultimap;
@ -372,41 +376,41 @@ public class GridUI extends ComponentUI {
@Override
protected void iterateStart2End(Graphics2D g2d) {
float rowHeight, paperYAxisSumSize = 0, yAxisSumSize = 0;
UNIT rowHeight, paperYAxisSumSize = FU.getInstance(0), yAxisSumSize = FU.getInstance(0);
for (int i = 0; i <= gridRange.yEndIndex; i++) {
if (i == 0) {
i = gridRange.yBeginIndex;
for (int k = 0; k < gridRange.yBeginIndex; k++) {
rowHeight = gridRange.rowHeightList.get(k).toPixF(resolution);
paperYAxisSumSize += rowHeight;
if (paperYAxisSumSize >= paperPaintSize) {
rowHeight = gridRange.rowHeightList.get(k);
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight);
if (paperYAxisSumSize.toPixF(resolution) >= paperPaintSize) {
paperYAxisSumSize = rowHeight;
}
}
}
rowHeight = gridRange.rowHeightList.get(i).toPixF(resolution);
paperYAxisSumSize += rowHeight;
rowHeight = gridRange.rowHeightList.get(i);
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight);
if (showGridLine) {
float columnWidth, xAxisSumSize = 0;
UNIT columnWidth, xAxisSumSize = FU.getInstance(0);
for (int j = gridRange.xBeginIndex; j <= gridRange.xEndIndex; j++) {
columnWidth = gridRange.columnWidthList.get(j).toPixF(resolution);
columnWidth = gridRange.columnWidthList.get(j);
if (!mergeCellElementTable.get(CellPosition.value(i - 1, j)).contains(CellPosition.BOTTOM)) {
tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize + columnWidth, yAxisSumSize);
tmpLine2D.setLine(xAxisSumSize.toPixF(resolution), yAxisSumSize.toPixF(resolution), xAxisSumSize.add(columnWidth).toPixF(resolution), yAxisSumSize.toPixF(resolution));
g2d.draw(tmpLine2D);
}
xAxisSumSize += columnWidth;
xAxisSumSize = xAxisSumSize.add(columnWidth);
}
}
if (showPaginateLine && paperYAxisSumSize - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize));
if (showPaginateLine && paperYAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize.toPixF(resolution)));
paperYAxisSumSize = rowHeight;
}
yAxisSumSize += rowHeight;
yAxisSumSize = yAxisSumSize.add(rowHeight);
}
// paint 最后一个横线..
if (showGridLine) {
drawLastLine(g2d, (int) yAxisSumSize);
drawLastLine(g2d, (int) yAxisSumSize.toPixF(resolution));
}
}
}
@ -432,40 +436,40 @@ public class GridUI extends ComponentUI {
@Override
protected void iterateStart2End(Graphics2D g2d) {
float columnWidth, paperXAxisSumSize = 0, xAxisSumSize = 0;
UNIT columnWidth, paperXAxisSumSize = FU.getInstance(0), xAxisSumSize = FU.getInstance(0);
for (int i = 0; i <= gridRange.xEndIndex; i++) {
if (i == 0) {
i = gridRange.xBeginIndex;
for (int k = 0; k < gridRange.xBeginIndex; k++) {
columnWidth = gridRange.columnWidthList.get(k).toPixF(resolution);
paperXAxisSumSize += columnWidth;
if (paperXAxisSumSize >= paperPaintSize) {
columnWidth = gridRange.columnWidthList.get(k);
paperXAxisSumSize = paperXAxisSumSize.add(columnWidth);
if (paperXAxisSumSize.toPixF(resolution) >= paperPaintSize) {
paperXAxisSumSize = columnWidth;
}
}
}
columnWidth = gridRange.columnWidthList.get(i).toPixF(resolution);
paperXAxisSumSize += columnWidth;
columnWidth = gridRange.columnWidthList.get(i);
paperXAxisSumSize = paperXAxisSumSize.add(columnWidth);
if (showGridLine) {
float rowHeight, yAxisSumSize = 0;
UNIT rowHeight, yAxisSumSize = FU.getInstance(0);
for (int j = gridRange.yBeginIndex; j <= gridRange.yEndIndex; j++) {
rowHeight = gridRange.rowHeightList.get(j).toPixF(resolution);
rowHeight = gridRange.rowHeightList.get(j);
if (!mergeCellElementTable.get(CellPosition.value(j, i - 1)).contains(CellPosition.RIGHT)) {
tmpLine2D.setLine(xAxisSumSize, yAxisSumSize, xAxisSumSize, yAxisSumSize + rowHeight);
tmpLine2D.setLine(xAxisSumSize.toPixF(resolution), yAxisSumSize.toPixF(resolution), xAxisSumSize.toPixF(resolution), yAxisSumSize.add(rowHeight).toPixF(resolution));
g2d.draw(tmpLine2D);
}
yAxisSumSize += rowHeight;
yAxisSumSize = yAxisSumSize.add(rowHeight);
}
}
if (showPaginateLine && paperXAxisSumSize - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize));
if (showPaginateLine && paperXAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize.toPixF(resolution)));
paperXAxisSumSize = columnWidth;
}
xAxisSumSize += columnWidth;
xAxisSumSize = xAxisSumSize.add(columnWidth);
}
// paint 最后一个横线..
if (showGridLine) {
drawLastLine(g2d, (int) xAxisSumSize);
drawLastLine(g2d, (int) xAxisSumSize.toPixF(resolution));
}
}
}

Loading…
Cancel
Save