Browse Source

Pull request #5829: REPORT-58252 报表块单元格行列标识去掉后的弥补方案

Merge in DESIGN/design from ~STARRYI/design:bugfix/10.0 to bugfix/10.0

* commit '5f1200d94ee31235018556e66ef032779b5ae1dd':
  REPORT-58252 报表块单元格行列标识去掉后的弥补方案
bugfix/10.0
ju|剧浩宇 3 years ago
parent
commit
535d37047b
  1. 3
      designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java
  2. 10
      designer-realize/src/main/java/com/fr/grid/Grid.java
  3. 50
      designer-realize/src/main/java/com/fr/grid/GridUI.java

3
designer-realize/src/main/java/com/fr/design/mainframe/form/FormElementCaseDesigner.java

@ -152,10 +152,13 @@ public class FormElementCaseDesigner
Grid grid = this.elementCasePane != null ? this.elementCasePane.getGrid() : null; Grid grid = this.elementCasePane != null ? this.elementCasePane.getGrid() : null;
if (grid != null) { if (grid != null) {
boolean oldTranslucent = grid.isTranslucent(); boolean oldTranslucent = grid.isTranslucent();
boolean oldShowExtraGridLine = grid.isShowExtraGridLine();
// 截缩图图时grid需支持半透明,不能用默认白色填充画布,否则会遮挡组件样式背景 // 截缩图图时grid需支持半透明,不能用默认白色填充画布,否则会遮挡组件样式背景
grid.setTranslucent(true); grid.setTranslucent(true);
grid.setShowExtraGridLine(false);
grid.paint(g2d); grid.paint(g2d);
grid.setTranslucent(oldTranslucent); grid.setTranslucent(oldTranslucent);
grid.setShowExtraGridLine(oldShowExtraGridLine);
} }
} catch (Exception e) { } catch (Exception e) {

10
designer-realize/src/main/java/com/fr/grid/Grid.java

@ -136,6 +136,8 @@ public class Grid extends BaseGridComponent {
// 截取缩略图时需透明(不能用默认白色填充),否则会遮挡组件样式的背景,其余情况的绘制可以用白色等默认颜色填充 // 截取缩略图时需透明(不能用默认白色填充),否则会遮挡组件样式的背景,其余情况的绘制可以用白色等默认颜色填充
private boolean isTranslucent = false; private boolean isTranslucent = false;
// 是否绘制单元格内容区之外的网格线
private boolean showExtraGridLine = true;
public Grid(int resolution) { public Grid(int resolution) {
this.resolution = resolution; this.resolution = resolution;
@ -1469,4 +1471,12 @@ public class Grid extends BaseGridComponent {
public void setTranslucent(boolean translucent) { public void setTranslucent(boolean translucent) {
isTranslucent = translucent; isTranslucent = translucent;
} }
public boolean isShowExtraGridLine() {
return showExtraGridLine;
}
public void setShowExtraGridLine(boolean showExtraGridLine) {
this.showExtraGridLine = showExtraGridLine;
}
} }

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

@ -292,15 +292,25 @@ public class GridUI extends ComponentUI {
} }
} }
} }
GridRange gridRange = GridRange.range(grid.getHorizontalBeginValue(), horizontalEndValue, grid.getVerticalBeginValue(), verticalEndValue) int xBeginIndex = grid.getHorizontalBeginValue();
int xEndIndex = horizontalEndValue;
int yBeginIndex = grid.getVerticalBeginValue();
int yEndIndex = verticalEndValue;
if (!grid.isShowExtraGridLine()) {
xBeginIndex = 0;
xEndIndex = Math.max(0, report.getColumnCount() - 1);
yBeginIndex = 0;
yEndIndex = Math.max(0, report.getRowCount() - 1);
}
GridRange gridRange = GridRange.range(xBeginIndex, xEndIndex, yBeginIndex, yEndIndex)
.rangeList(rowHeightList, columnWidthList) .rangeList(rowHeightList, columnWidthList)
.realSize(realWidth, realHeight); .realSize(realWidth, realHeight);
new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(), new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(), grid.isShowExtraGridLine(),
isShowVerticalPaginateLine, paperPaintHeight, isShowVerticalPaginateLine, paperPaintHeight,
paginateLineList, resolution).iterateStart2End(g2d); paginateLineList, resolution).iterateStart2End(g2d);
new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(), new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(), grid.isShowExtraGridLine(),
isShowHorizontalPaginateLine, paperPaintWidth, isShowHorizontalPaginateLine, paperPaintWidth,
paginateLineList, resolution).iterateStart2End(g2d); paginateLineList, resolution).iterateStart2End(g2d);
} }
@ -324,6 +334,7 @@ public class GridUI extends ComponentUI {
protected GridRange gridRange; protected GridRange gridRange;
protected boolean showGridLine; protected boolean showGridLine;
protected boolean showExtraGridLine;
protected boolean showPaginateLine; protected boolean showPaginateLine;
protected double paperPaintSize; protected double paperPaintSize;
@ -336,11 +347,12 @@ public class GridUI extends ComponentUI {
protected static final double THRESHOLD = 1.0E-4D; protected static final double THRESHOLD = 1.0E-4D;
DrawLineHelper(GridRange gridRange, boolean showGridLine, DrawLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize, boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) { List paginateLineList, int resolution) {
this.gridRange = gridRange; this.gridRange = gridRange;
this.showGridLine = showGridLine; this.showGridLine = showGridLine;
this.showExtraGridLine = showExtraGridLine;
this.showPaginateLine = showPaginateLine; this.showPaginateLine = showPaginateLine;
this.paperPaintSize = paperPaintSize; this.paperPaintSize = paperPaintSize;
@ -357,10 +369,10 @@ public class GridUI extends ComponentUI {
private class DrawVerticalLineHelper extends DrawLineHelper { private class DrawVerticalLineHelper extends DrawLineHelper {
DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize, boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) { List paginateLineList, int resolution) {
super(gridRange, showGridLine, showPaginateLine, super(gridRange, showGridLine, showExtraGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution); paperPaintSize, paginateLineList, resolution);
} }
@ -376,7 +388,7 @@ public class GridUI extends ComponentUI {
@Override @Override
protected void iterateStart2End(Graphics2D g2d) { protected void iterateStart2End(Graphics2D g2d) {
UNIT rowHeight, paperYAxisSumSize = FU.getInstance(0), yAxisSumSize = FU.getInstance(0); UNIT rowHeight, paperYAxisSumSize = FU.getInstance(0), maxXAxisSumSize = FU.getInstance(0), yAxisSumSize = FU.getInstance(0);
for (int i = 0; i <= gridRange.yEndIndex; i++) { for (int i = 0; i <= gridRange.yEndIndex; i++) {
if (i == 0) { if (i == 0) {
i = gridRange.yBeginIndex; i = gridRange.yBeginIndex;
@ -401,6 +413,9 @@ public class GridUI extends ComponentUI {
} }
xAxisSumSize = xAxisSumSize.add(columnWidth); xAxisSumSize = xAxisSumSize.add(columnWidth);
} }
if (xAxisSumSize.toPixF(resolution) > maxXAxisSumSize.toPixF(resolution)) {
maxXAxisSumSize = xAxisSumSize;
}
} }
if (showPaginateLine && paperYAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) { if (showPaginateLine && paperYAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize.toPixF(resolution))); paginateLineList.add(getPaginateLine2D((int) yAxisSumSize.toPixF(resolution)));
@ -410,17 +425,21 @@ public class GridUI extends ComponentUI {
} }
// paint 最后一个横线.. // paint 最后一个横线..
if (showGridLine) { if (showGridLine) {
drawLastLine(g2d, (int) yAxisSumSize.toPixF(resolution)); if (showExtraGridLine) {
drawLastLine(g2d, (int) yAxisSumSize.toPixF(resolution));
} else {
GraphHelper.drawLine(g2d, 0, yAxisSumSize.toPixF(resolution), maxXAxisSumSize.toPixF(resolution), yAxisSumSize.toPixF(resolution));
}
} }
} }
} }
private class DrawHorizontalLineHelper extends DrawLineHelper { private class DrawHorizontalLineHelper extends DrawLineHelper {
DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine,
boolean showPaginateLine, double paperPaintSize, boolean showPaginateLine, double paperPaintSize,
List paginateLineList, int resolution) { List paginateLineList, int resolution) {
super(gridRange, showGridLine, showPaginateLine, super(gridRange, showGridLine, showExtraGridLine, showPaginateLine,
paperPaintSize, paginateLineList, resolution); paperPaintSize, paginateLineList, resolution);
} }
@ -436,7 +455,7 @@ public class GridUI extends ComponentUI {
@Override @Override
protected void iterateStart2End(Graphics2D g2d) { protected void iterateStart2End(Graphics2D g2d) {
UNIT columnWidth, paperXAxisSumSize = FU.getInstance(0), xAxisSumSize = FU.getInstance(0); UNIT columnWidth, paperXAxisSumSize = FU.getInstance(0), maxYAxisSumSize = FU.getInstance(0), xAxisSumSize = FU.getInstance(0);
for (int i = 0; i <= gridRange.xEndIndex; i++) { for (int i = 0; i <= gridRange.xEndIndex; i++) {
if (i == 0) { if (i == 0) {
i = gridRange.xBeginIndex; i = gridRange.xBeginIndex;
@ -460,6 +479,9 @@ public class GridUI extends ComponentUI {
} }
yAxisSumSize = yAxisSumSize.add(rowHeight); yAxisSumSize = yAxisSumSize.add(rowHeight);
} }
if (yAxisSumSize.toPixF(resolution) > maxYAxisSumSize.toPixF(resolution)) {
maxYAxisSumSize = yAxisSumSize;
}
} }
if (showPaginateLine && paperXAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) { if (showPaginateLine && paperXAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize.toPixF(resolution))); paginateLineList.add(getPaginateLine2D((int) xAxisSumSize.toPixF(resolution)));
@ -469,7 +491,11 @@ public class GridUI extends ComponentUI {
} }
// paint 最后一个横线.. // paint 最后一个横线..
if (showGridLine) { if (showGridLine) {
drawLastLine(g2d, (int) xAxisSumSize.toPixF(resolution)); if (showExtraGridLine) {
drawLastLine(g2d, (int) xAxisSumSize.toPixD(resolution));
} else {
GraphHelper.drawLine(g2d, xAxisSumSize.toPixF(resolution), 0, xAxisSumSize.toPixF(resolution), maxYAxisSumSize.toPixF(resolution));
}
} }
} }
} }

Loading…
Cancel
Save