|
|
|
@ -291,15 +291,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) |
|
|
|
|
.realSize(realWidth, realHeight); |
|
|
|
|
|
|
|
|
|
new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(), |
|
|
|
|
new DrawVerticalLineHelper(gridRange, grid.isShowGridLine(), grid.isShowExtraGridLine(), |
|
|
|
|
isShowVerticalPaginateLine, paperPaintHeight, |
|
|
|
|
paginateLineList, resolution).iterateStart2End(g2d); |
|
|
|
|
|
|
|
|
|
new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(), |
|
|
|
|
new DrawHorizontalLineHelper(gridRange, grid.isShowGridLine(), grid.isShowExtraGridLine(), |
|
|
|
|
isShowHorizontalPaginateLine, paperPaintWidth, |
|
|
|
|
paginateLineList, resolution).iterateStart2End(g2d); |
|
|
|
|
} |
|
|
|
@ -323,6 +333,7 @@ public class GridUI extends ComponentUI {
|
|
|
|
|
protected GridRange gridRange; |
|
|
|
|
|
|
|
|
|
protected boolean showGridLine; |
|
|
|
|
protected boolean showExtraGridLine; |
|
|
|
|
protected boolean showPaginateLine; |
|
|
|
|
|
|
|
|
|
protected double paperPaintSize; |
|
|
|
@ -335,11 +346,12 @@ public class GridUI extends ComponentUI {
|
|
|
|
|
|
|
|
|
|
protected static final double THRESHOLD = 1.0E-4D; |
|
|
|
|
|
|
|
|
|
DrawLineHelper(GridRange gridRange, boolean showGridLine, |
|
|
|
|
DrawLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine, |
|
|
|
|
boolean showPaginateLine, double paperPaintSize, |
|
|
|
|
List paginateLineList, int resolution) { |
|
|
|
|
this.gridRange = gridRange; |
|
|
|
|
this.showGridLine = showGridLine; |
|
|
|
|
this.showExtraGridLine = showExtraGridLine; |
|
|
|
|
this.showPaginateLine = showPaginateLine; |
|
|
|
|
this.paperPaintSize = paperPaintSize; |
|
|
|
|
|
|
|
|
@ -356,10 +368,10 @@ public class GridUI extends ComponentUI {
|
|
|
|
|
|
|
|
|
|
private class DrawVerticalLineHelper extends DrawLineHelper { |
|
|
|
|
|
|
|
|
|
DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, |
|
|
|
|
DrawVerticalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine, |
|
|
|
|
boolean showPaginateLine, double paperPaintSize, |
|
|
|
|
List paginateLineList, int resolution) { |
|
|
|
|
super(gridRange, showGridLine, showPaginateLine, |
|
|
|
|
super(gridRange, showGridLine, showExtraGridLine, showPaginateLine, |
|
|
|
|
paperPaintSize, paginateLineList, resolution); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -375,7 +387,7 @@ public class GridUI extends ComponentUI {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
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++) { |
|
|
|
|
if (i == 0) { |
|
|
|
|
i = gridRange.yBeginIndex; |
|
|
|
@ -400,6 +412,9 @@ public class GridUI extends ComponentUI {
|
|
|
|
|
} |
|
|
|
|
xAxisSumSize = xAxisSumSize.add(columnWidth); |
|
|
|
|
} |
|
|
|
|
if (xAxisSumSize.toPixF(resolution) > maxXAxisSumSize.toPixF(resolution)) { |
|
|
|
|
maxXAxisSumSize = xAxisSumSize; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (showPaginateLine && paperYAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) { |
|
|
|
|
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize.toPixF(resolution))); |
|
|
|
@ -409,17 +424,21 @@ public class GridUI extends ComponentUI {
|
|
|
|
|
} |
|
|
|
|
// paint 最后一个横线..
|
|
|
|
|
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 { |
|
|
|
|
|
|
|
|
|
DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, |
|
|
|
|
DrawHorizontalLineHelper(GridRange gridRange, boolean showGridLine, boolean showExtraGridLine, |
|
|
|
|
boolean showPaginateLine, double paperPaintSize, |
|
|
|
|
List paginateLineList, int resolution) { |
|
|
|
|
super(gridRange, showGridLine, showPaginateLine, |
|
|
|
|
super(gridRange, showGridLine, showExtraGridLine, showPaginateLine, |
|
|
|
|
paperPaintSize, paginateLineList, resolution); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -435,7 +454,7 @@ public class GridUI extends ComponentUI {
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
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++) { |
|
|
|
|
if (i == 0) { |
|
|
|
|
i = gridRange.xBeginIndex; |
|
|
|
@ -459,6 +478,9 @@ public class GridUI extends ComponentUI {
|
|
|
|
|
} |
|
|
|
|
yAxisSumSize = yAxisSumSize.add(rowHeight); |
|
|
|
|
} |
|
|
|
|
if (yAxisSumSize.toPixF(resolution) > maxYAxisSumSize.toPixF(resolution)) { |
|
|
|
|
maxYAxisSumSize = yAxisSumSize; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (showPaginateLine && paperXAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) { |
|
|
|
|
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize.toPixF(resolution))); |
|
|
|
@ -468,7 +490,11 @@ public class GridUI extends ComponentUI {
|
|
|
|
|
} |
|
|
|
|
// paint 最后一个横线..
|
|
|
|
|
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)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|