|
|
|
@ -183,42 +183,40 @@ public class IntelliElements {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void doIntelliAction() { |
|
|
|
|
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex++) { |
|
|
|
|
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex++) { |
|
|
|
|
TemplateCellElement sourceCellElement = getSourceCellElementByColumnRow(colIndex, rowIndex); |
|
|
|
|
public abstract void doIntelliAction(); |
|
|
|
|
|
|
|
|
|
if (sourceCellElement == null) { |
|
|
|
|
sourceCellElement = new DefaultTemplateCellElement(); |
|
|
|
|
} |
|
|
|
|
TemplateCellElement newCellElement = new DefaultTemplateCellElement(colIndex, rowIndex); |
|
|
|
|
applyStyle(newCellElement, sourceCellElement);//style
|
|
|
|
|
if (sourceCellElement.getValue() instanceof DSColumn) { |
|
|
|
|
try{ |
|
|
|
|
DSColumn dsColumn = (DSColumn)((DSColumn) sourceCellElement.getValue()).clone(); |
|
|
|
|
newCellElement.setValue(dsColumn); |
|
|
|
|
}catch (CloneNotSupportedException e){ |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr()); |
|
|
|
|
} else if (sourceCellElement.getValue() instanceof Number) { |
|
|
|
|
newCellElement.setValue(processNumber((Number) sourceCellElement.getValue())); |
|
|
|
|
} else if (sourceCellElement.getValue() instanceof BaseFormula) { |
|
|
|
|
BaseFormula formula = (BaseFormula) sourceCellElement.getValue(); |
|
|
|
|
formula = this.generateSimpleFormula(formula, 1); |
|
|
|
|
newCellElement.setValue(formula); |
|
|
|
|
} else { |
|
|
|
|
try { |
|
|
|
|
//richer:不改变原单元格
|
|
|
|
|
newCellElement.setValue(BaseUtils.cloneObject(sourceCellElement.getValue())); |
|
|
|
|
} catch (CloneNotSupportedException e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
public void expandCellValue(int colIndex, int rowIndex) { |
|
|
|
|
TemplateCellElement sourceCellElement = getSourceCellElementByColumnRow(colIndex, rowIndex); |
|
|
|
|
|
|
|
|
|
report.addCellElement(newCellElement); |
|
|
|
|
if (sourceCellElement == null) { |
|
|
|
|
sourceCellElement = new DefaultTemplateCellElement(); |
|
|
|
|
} |
|
|
|
|
TemplateCellElement newCellElement = new DefaultTemplateCellElement(colIndex, rowIndex); |
|
|
|
|
applyStyle(newCellElement, sourceCellElement);//style
|
|
|
|
|
if (sourceCellElement.getValue() instanceof DSColumn) { |
|
|
|
|
try{ |
|
|
|
|
DSColumn dsColumn = (DSColumn)((DSColumn) sourceCellElement.getValue()).clone(); |
|
|
|
|
newCellElement.setValue(dsColumn); |
|
|
|
|
}catch (CloneNotSupportedException e){ |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr()); |
|
|
|
|
} else if (sourceCellElement.getValue() instanceof Number) { |
|
|
|
|
newCellElement.setValue(processNumber((Number) sourceCellElement.getValue())); |
|
|
|
|
} else if (sourceCellElement.getValue() instanceof BaseFormula) { |
|
|
|
|
BaseFormula formula = (BaseFormula) sourceCellElement.getValue(); |
|
|
|
|
formula = this.generateSimpleFormula(formula, 1); |
|
|
|
|
newCellElement.setValue(formula); |
|
|
|
|
} else { |
|
|
|
|
try { |
|
|
|
|
//richer:不改变原单元格
|
|
|
|
|
newCellElement.setValue(BaseUtils.cloneObject(sourceCellElement.getValue())); |
|
|
|
|
} catch (CloneNotSupportedException e) { |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
report.addCellElement(newCellElement); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected abstract int getStartColumnIndex(); |
|
|
|
@ -328,6 +326,15 @@ public class IntelliElements {
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void doIntelliAction() { |
|
|
|
|
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex ++) { |
|
|
|
|
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex ++) { |
|
|
|
|
expandCellValue(colIndex, rowIndex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean havetoModify() { |
|
|
|
|
return IntelliElements.this.dragCellRectangle.width > IntelliElements.this.oldCellRectangle.width; |
|
|
|
@ -397,39 +404,48 @@ public class IntelliElements {
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void doIntelliAction() { |
|
|
|
|
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex > colEnd; colIndex --) { |
|
|
|
|
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex ++) { |
|
|
|
|
expandCellValue(colIndex, rowIndex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean havetoModify() { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int getStartRowIndex() { |
|
|
|
|
public int getStartRowIndex() { |
|
|
|
|
return IntelliElements.this.oldCellRectangle.y; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int getEndRowIndex() { |
|
|
|
|
public int getEndRowIndex() { |
|
|
|
|
return IntelliElements.this.oldCellRectangle.y + IntelliElements.this.oldCellRectangle.height; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int getStartColumnIndex() { |
|
|
|
|
return IntelliElements.this.dragCellRectangle.x; |
|
|
|
|
public int getStartColumnIndex() { |
|
|
|
|
return IntelliElements.this.oldCellRectangle.x - 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int getEndColumnIndex() { |
|
|
|
|
return IntelliElements.this.oldCellRectangle.x; |
|
|
|
|
public int getEndColumnIndex() { |
|
|
|
|
return IntelliElements.this.dragCellRectangle.x - 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public TemplateCellElement getSourceCellElementByColumnRow(int columnIndex, int rowIndex) { |
|
|
|
|
return report.getTemplateCellElement(IntelliElements.this.oldCellRectangle.x + (columnIndex - IntelliElements.this.dragCellRectangle.x) % (IntelliElements.this.oldCellRectangle.width), rowIndex); |
|
|
|
|
return report.getTemplateCellElement(columnIndex + IntelliElements.this.oldCellRectangle.width, rowIndex); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected Number processNumber(Number i) { |
|
|
|
|
return i; |
|
|
|
|
return FunctionHelper.asNumber(i.doubleValue() - 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -465,6 +481,15 @@ public class IntelliElements {
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void doIntelliAction() { |
|
|
|
|
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex ++) { |
|
|
|
|
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex < rowEnd; rowIndex ++) { |
|
|
|
|
expandCellValue(colIndex, rowIndex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean havetoModify() { |
|
|
|
|
return IntelliElements.this.dragCellRectangle.height > IntelliElements.this.oldCellRectangle.height; |
|
|
|
@ -534,38 +559,47 @@ public class IntelliElements {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean havetoModify() { |
|
|
|
|
public void doIntelliAction() { |
|
|
|
|
for (int colIndex = getStartColumnIndex(), colEnd = getEndColumnIndex(); colIndex < colEnd; colIndex++) { |
|
|
|
|
for (int rowIndex = getStartRowIndex(), rowEnd = getEndRowIndex(); rowIndex > rowEnd; rowIndex--) { |
|
|
|
|
expandCellValue(colIndex, rowIndex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean havetoModify() { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int getStartRowIndex() { |
|
|
|
|
return IntelliElements.this.dragCellRectangle.y; |
|
|
|
|
public int getStartRowIndex() { |
|
|
|
|
return IntelliElements.this.oldCellRectangle.y - 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int getEndRowIndex() { |
|
|
|
|
return IntelliElements.this.oldCellRectangle.y; |
|
|
|
|
public int getEndRowIndex() { |
|
|
|
|
return IntelliElements.this.dragCellRectangle.y - 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int getStartColumnIndex() { |
|
|
|
|
public int getStartColumnIndex() { |
|
|
|
|
return IntelliElements.this.oldCellRectangle.x; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int getEndColumnIndex() { |
|
|
|
|
public int getEndColumnIndex() { |
|
|
|
|
return IntelliElements.this.oldCellRectangle.x + IntelliElements.this.oldCellRectangle.width; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public TemplateCellElement getSourceCellElementByColumnRow(int columnIndex, int rowIndex) { |
|
|
|
|
return report.getTemplateCellElement(columnIndex, IntelliElements.this.oldCellRectangle.y + (rowIndex - IntelliElements.this.dragCellRectangle.y) % (IntelliElements.this.oldCellRectangle.height)); |
|
|
|
|
return report.getTemplateCellElement(columnIndex, rowIndex + IntelliElements.this.oldCellRectangle.height); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected Number processNumber(Number i) { |
|
|
|
|
return i; |
|
|
|
|
return FunctionHelper.asNumber(i.doubleValue() - 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|