|
|
@ -10,12 +10,15 @@ import com.fr.base.background.ColorBackground; |
|
|
|
import com.fr.base.background.ImageFileBackground; |
|
|
|
import com.fr.base.background.ImageFileBackground; |
|
|
|
import com.fr.base.iofile.attr.WatermarkAttr; |
|
|
|
import com.fr.base.iofile.attr.WatermarkAttr; |
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
import com.fr.base.vcs.DesignerMode; |
|
|
|
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
|
|
|
|
import com.fr.design.fun.ReportLengthUNITProvider; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
import com.fr.design.mainframe.ElementCasePane; |
|
|
|
import com.fr.design.mainframe.ElementCasePane; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
import com.fr.design.roleAuthority.ReportAndFSManagePane; |
|
|
|
import com.fr.design.roleAuthority.ReportAndFSManagePane; |
|
|
|
|
|
|
|
import com.fr.design.unit.UnitConvertUtil; |
|
|
|
import com.fr.general.Background; |
|
|
|
import com.fr.general.Background; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.grid.selection.CellSelection; |
|
|
|
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.script.CalculatorUtils; |
|
|
|
import com.fr.stable.unit.FU; |
|
|
|
import com.fr.stable.unit.FU; |
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
|
|
|
|
import com.fr.stable.unit.UNIT; |
|
|
|
import com.fr.third.antlr.ANTLRException; |
|
|
|
import com.fr.third.antlr.ANTLRException; |
|
|
|
import com.fr.third.guava.collect.HashMultimap; |
|
|
|
import com.fr.third.guava.collect.HashMultimap; |
|
|
|
|
|
|
|
|
|
|
@ -288,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); |
|
|
|
} |
|
|
|
} |
|
|
@ -320,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; |
|
|
@ -332,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; |
|
|
|
|
|
|
|
|
|
|
@ -353,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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -372,51 +388,58 @@ public class GridUI extends ComponentUI { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void iterateStart2End(Graphics2D g2d) { |
|
|
|
protected void iterateStart2End(Graphics2D g2d) { |
|
|
|
float rowHeight, paperYAxisSumSize = 0, yAxisSumSize = 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; |
|
|
|
for (int k = 0; k < gridRange.yBeginIndex; k++) { |
|
|
|
for (int k = 0; k < gridRange.yBeginIndex; k++) { |
|
|
|
rowHeight = gridRange.rowHeightList.get(k).toPixF(resolution); |
|
|
|
rowHeight = gridRange.rowHeightList.get(k); |
|
|
|
|
|
|
|
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight); |
|
|
|
paperYAxisSumSize += rowHeight; |
|
|
|
if (paperYAxisSumSize.toPixF(resolution) >= paperPaintSize) { |
|
|
|
if (paperYAxisSumSize >= paperPaintSize) { |
|
|
|
|
|
|
|
paperYAxisSumSize = rowHeight; |
|
|
|
paperYAxisSumSize = rowHeight; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
rowHeight = gridRange.rowHeightList.get(i).toPixF(resolution); |
|
|
|
|
|
|
|
paperYAxisSumSize += rowHeight; |
|
|
|
rowHeight = gridRange.rowHeightList.get(i); |
|
|
|
|
|
|
|
paperYAxisSumSize = paperYAxisSumSize.add(rowHeight); |
|
|
|
if (showGridLine) { |
|
|
|
if (showGridLine) { |
|
|
|
float columnWidth, xAxisSumSize = 0; |
|
|
|
UNIT columnWidth, xAxisSumSize = FU.getInstance(0); |
|
|
|
for (int j = gridRange.xBeginIndex; j <= gridRange.xEndIndex; j++) { |
|
|
|
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)) { |
|
|
|
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); |
|
|
|
g2d.draw(tmpLine2D); |
|
|
|
} |
|
|
|
} |
|
|
|
xAxisSumSize += columnWidth; |
|
|
|
xAxisSumSize = xAxisSumSize.add(columnWidth); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (xAxisSumSize.toPixF(resolution) > maxXAxisSumSize.toPixF(resolution)) { |
|
|
|
|
|
|
|
maxXAxisSumSize = xAxisSumSize; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (showPaginateLine && paperYAxisSumSize - paperPaintSize > THRESHOLD) { |
|
|
|
if (showPaginateLine && paperYAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) { |
|
|
|
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize)); |
|
|
|
paginateLineList.add(getPaginateLine2D((int) yAxisSumSize.toPixF(resolution))); |
|
|
|
paperYAxisSumSize = rowHeight; |
|
|
|
paperYAxisSumSize = rowHeight; |
|
|
|
} |
|
|
|
} |
|
|
|
yAxisSumSize += rowHeight; |
|
|
|
yAxisSumSize = yAxisSumSize.add(rowHeight); |
|
|
|
} |
|
|
|
} |
|
|
|
// paint 最后一个横线..
|
|
|
|
// paint 最后一个横线..
|
|
|
|
if (showGridLine) { |
|
|
|
if (showGridLine) { |
|
|
|
drawLastLine(g2d, (int) yAxisSumSize); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -432,40 +455,47 @@ public class GridUI extends ComponentUI { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void iterateStart2End(Graphics2D g2d) { |
|
|
|
protected void iterateStart2End(Graphics2D g2d) { |
|
|
|
float columnWidth, paperXAxisSumSize = 0, xAxisSumSize = 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; |
|
|
|
for (int k = 0; k < gridRange.xBeginIndex; k++) { |
|
|
|
for (int k = 0; k < gridRange.xBeginIndex; k++) { |
|
|
|
columnWidth = gridRange.columnWidthList.get(k).toPixF(resolution); |
|
|
|
columnWidth = gridRange.columnWidthList.get(k); |
|
|
|
paperXAxisSumSize += columnWidth; |
|
|
|
paperXAxisSumSize = paperXAxisSumSize.add(columnWidth); |
|
|
|
if (paperXAxisSumSize >= paperPaintSize) { |
|
|
|
if (paperXAxisSumSize.toPixF(resolution) >= paperPaintSize) { |
|
|
|
paperXAxisSumSize = columnWidth; |
|
|
|
paperXAxisSumSize = columnWidth; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
columnWidth = gridRange.columnWidthList.get(i).toPixF(resolution); |
|
|
|
columnWidth = gridRange.columnWidthList.get(i); |
|
|
|
paperXAxisSumSize += columnWidth; |
|
|
|
paperXAxisSumSize = paperXAxisSumSize.add(columnWidth); |
|
|
|
if (showGridLine) { |
|
|
|
if (showGridLine) { |
|
|
|
float rowHeight, yAxisSumSize = 0; |
|
|
|
UNIT rowHeight, yAxisSumSize = FU.getInstance(0); |
|
|
|
for (int j = gridRange.yBeginIndex; j <= gridRange.yEndIndex; j++) { |
|
|
|
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)) { |
|
|
|
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); |
|
|
|
g2d.draw(tmpLine2D); |
|
|
|
} |
|
|
|
} |
|
|
|
yAxisSumSize += rowHeight; |
|
|
|
yAxisSumSize = yAxisSumSize.add(rowHeight); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (yAxisSumSize.toPixF(resolution) > maxYAxisSumSize.toPixF(resolution)) { |
|
|
|
|
|
|
|
maxYAxisSumSize = yAxisSumSize; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (showPaginateLine && paperXAxisSumSize - paperPaintSize > THRESHOLD) { |
|
|
|
if (showPaginateLine && paperXAxisSumSize.toPixF(resolution) - paperPaintSize > THRESHOLD) { |
|
|
|
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize)); |
|
|
|
paginateLineList.add(getPaginateLine2D((int) xAxisSumSize.toPixF(resolution))); |
|
|
|
paperXAxisSumSize = columnWidth; |
|
|
|
paperXAxisSumSize = columnWidth; |
|
|
|
} |
|
|
|
} |
|
|
|
xAxisSumSize += columnWidth; |
|
|
|
xAxisSumSize = xAxisSumSize.add(columnWidth); |
|
|
|
} |
|
|
|
} |
|
|
|
// paint 最后一个横线..
|
|
|
|
// paint 最后一个横线..
|
|
|
|
if (showGridLine) { |
|
|
|
if (showGridLine) { |
|
|
|
drawLastLine(g2d, (int) xAxisSumSize); |
|
|
|
if (showExtraGridLine) { |
|
|
|
|
|
|
|
drawLastLine(g2d, (int) xAxisSumSize.toPixD(resolution)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
GraphHelper.drawLine(g2d, xAxisSumSize.toPixF(resolution), 0, xAxisSumSize.toPixF(resolution), maxYAxisSumSize.toPixF(resolution)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|