Browse Source

Merge pull request #541 in BA/design from ~KERRY/design:dev to dev

* commit '48f4dbb2e3eed98e283047bac4f5d8ff8f813e06':
  REPORT-747 单元格拷贝可复制宽高
master
superman 8 years ago
parent
commit
7eefd0ee2c
  1. 20
      designer/src/com/fr/design/cell/clipboard/CellElementsClip.java
  2. 2
      designer/src/com/fr/grid/GridUtils.java
  3. 2
      designer/src/com/fr/grid/selection/CellSelection.java

20
designer/src/com/fr/design/cell/clipboard/CellElementsClip.java

@ -17,12 +17,16 @@ import com.fr.report.elementcase.TemplateElementCase;
* The clip of CellElement.
*/
public class CellElementsClip implements Cloneable, java.io.Serializable {
private int column;
private int row;
private int columnSpan = 0;
private int rowSpan = 0;
private TemplateCellElement[] clips;
public CellElementsClip(int columnSpan, int rowSpan, TemplateCellElement[] clips) {
public CellElementsClip(int column, int row, int columnSpan, int rowSpan, TemplateCellElement[] clips) {
this.column = column;
this.row = row;
this.columnSpan = columnSpan;
this.rowSpan = rowSpan;
@ -81,10 +85,20 @@ public class CellElementsClip implements Cloneable, java.io.Serializable {
column + cellElement.getColumn(), row + cellElement.getRow()
), false);
}
//设置单元格的宽高
pasteWidthAndHeight(ec, column, row, columnSpan, rowSpan);
return new CellSelection(column, row, columnSpan, rowSpan);
}
public void pasteWidthAndHeight(TemplateElementCase ec, int column, int row, int columnSpan, int rowSpan){
for(int i = 0; i<columnSpan; i++){
for(int j = 0; j<rowSpan; j++){
ec.setColumnWidth(column + i, ec.getColumnWidth(this.column + i));
ec.setRowHeight(row + j, ec.getRowHeight(this.row + j));
}
}
}
public void pasteAtRegion(TemplateElementCase ec,
int startColumn, int startRow,
int column, int row,

2
designer/src/com/fr/grid/GridUtils.java

@ -288,7 +288,7 @@ public class GridUtils {
}
}
elementsTransferable.addObject(new CellElementsClip(
elementsTransferable.addObject(new CellElementsClip(cs.getColumn(), cs.getRow(),
cs.getColumnSpan(), cs.getRowSpan(), elList.toArray(new TemplateCellElement[elList.size()])
));
}

2
designer/src/com/fr/grid/selection/CellSelection.java

@ -237,7 +237,7 @@ public class CellSelection extends Selection {
list.add((TemplateCellElement) cellElement.deriveCellElement(cellElement.getColumn() - column, cellElement.getRow() - row));
}
transferable.addObject(new CellElementsClip(this.columnSpan, this.rowSpan, list.toArray(new TemplateCellElement[list.size()])));
transferable.addObject(new CellElementsClip(this.column, this.row, this.columnSpan, this.rowSpan, list.toArray(new TemplateCellElement[list.size()])));
}
/**

Loading…
Cancel
Save