|
|
|
@ -36,6 +36,7 @@ import com.fr.report.cell.cellattr.CellGUIAttr;
|
|
|
|
|
import com.fr.report.elementcase.TemplateElementCase; |
|
|
|
|
import com.fr.stable.ColumnRow; |
|
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.unit.FU; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
@ -242,10 +243,10 @@ public class CellSelection extends Selection {
|
|
|
|
|
} |
|
|
|
|
FU [] columnWidth = new FU[columnSpan]; |
|
|
|
|
FU [] rowHeight = new FU[rowSpan]; |
|
|
|
|
for(int i = 0; i < columnSpan; i++){ |
|
|
|
|
for (int i = 0; i < columnSpan; i++){ |
|
|
|
|
columnWidth[i] = ec.getColumnWidth(this.column + i); |
|
|
|
|
} |
|
|
|
|
for(int j = 0; j < rowSpan; j++){ |
|
|
|
|
for (int j = 0; j < rowSpan; j++){ |
|
|
|
|
rowHeight[j] = ec.getRowHeight(this.row + j); |
|
|
|
|
} |
|
|
|
|
transferable.addObject(new CellElementsClip(this.columnSpan, this.rowSpan, columnWidth, rowHeight, list.toArray(new TemplateCellElement[list.size()]))); |
|
|
|
@ -257,6 +258,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param ePane 区域 |
|
|
|
|
* @return 成功返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean pasteCellElementsClip(CellElementsClip ceClip, ElementCasePane ePane) { |
|
|
|
|
TemplateElementCase ec = ePane.getEditingElementCase(); |
|
|
|
|
CellSelection cs = ceClip.pasteAt(ec, column, row); |
|
|
|
@ -273,6 +275,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param ePane 区域 |
|
|
|
|
* @return 成功返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean pasteString(String str, ElementCasePane ePane) { |
|
|
|
|
// 主要需要处理Excel当中的类型.
|
|
|
|
|
// Excel 的剪贴板格式
|
|
|
|
@ -297,7 +300,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
ec.setCellValue(column + c, row + r, number); |
|
|
|
|
} else { |
|
|
|
|
// alex:对于100,000,000这种数值,先做一个取巧的解决方法
|
|
|
|
|
String newStr = Utils.replaceAllString(lineTextArray[c], ",", ""); |
|
|
|
|
String newStr = Utils.replaceAllString(lineTextArray[c], ",", StringUtils.EMPTY); |
|
|
|
|
number = Utils.string2Number(newStr); |
|
|
|
|
if (number != null) { |
|
|
|
|
ec.setCellValue(column + c, row + r, Utils.string2Number(newStr)); |
|
|
|
@ -320,6 +323,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param ePane 区域 |
|
|
|
|
* @return 成功返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean pasteOtherType(Object ob, ElementCasePane ePane) { |
|
|
|
|
TemplateElementCase ec = ePane.getEditingElementCase(); |
|
|
|
|
|
|
|
|
@ -341,6 +345,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param ePane 区域 |
|
|
|
|
* @return 是则返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean canMergeCells(ElementCasePane ePane) { |
|
|
|
|
|
|
|
|
|
return !this.isSelectedOneCell(ePane); |
|
|
|
@ -351,6 +356,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param ePane 区域 |
|
|
|
|
* @return 成功返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean mergeCells(ElementCasePane ePane) { |
|
|
|
|
|
|
|
|
|
TemplateElementCase ec = ePane.getEditingElementCase(); |
|
|
|
@ -373,6 +379,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param ePane 区域 |
|
|
|
|
* @return 是则返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean canUnMergeCells(ElementCasePane ePane) { |
|
|
|
|
TemplateElementCase ec = ePane.getEditingElementCase(); |
|
|
|
|
|
|
|
|
@ -393,6 +400,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param ePane 区域 |
|
|
|
|
* @return 成功返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean unMergeCells(ElementCasePane ePane) { |
|
|
|
|
TemplateElementCase ec = ePane.getEditingElementCase(); |
|
|
|
|
|
|
|
|
@ -483,17 +491,18 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param ePane 区域 |
|
|
|
|
* @return 成功返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean clear(Clear type, ElementCasePane ePane) { |
|
|
|
|
TemplateElementCase ec = ePane.getEditingElementCase(); |
|
|
|
|
boolean isClear = true; |
|
|
|
|
int cellRectangleCount = getCellRectangleCount(); |
|
|
|
|
for (int rect = 0; rect < cellRectangleCount; rect++) { |
|
|
|
|
isClear = clearCell(type, ec, rect); |
|
|
|
|
isClear = hasclearCell(type, ec, rect); |
|
|
|
|
} |
|
|
|
|
return isClear; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean clearCell(Clear type, TemplateElementCase ec, int rect) { |
|
|
|
|
private boolean hasclearCell(Clear type, TemplateElementCase ec, int rect) { |
|
|
|
|
List<CellElement> removeElementList = new ArrayList<CellElement>(); |
|
|
|
|
Rectangle cellRectangle = getCellRectangle(rect); |
|
|
|
|
column = cellRectangle.x; |
|
|
|
@ -541,6 +550,8 @@ public class CellSelection extends Selection {
|
|
|
|
|
((TemplateCellElement) element).setWidget(null); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -608,6 +619,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param ePane 区域 |
|
|
|
|
* @return 成功返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean triggerDeleteAction(ElementCasePane ePane) { |
|
|
|
|
final TemplateElementCase ec = ePane.getEditingElementCase(); |
|
|
|
|
final RowColumnPane rcPane = new RowColumnPane(); |
|
|
|
@ -638,6 +650,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
* @param cr 行列 |
|
|
|
|
* @return 包含返回true |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public boolean containsColumnRow(ColumnRow cr) { |
|
|
|
|
return new Rectangle(column, row, columnSpan, rowSpan).contains(cr.column, cr.row); |
|
|
|
|
} |
|
|
|
@ -678,7 +691,7 @@ public class CellSelection extends Selection {
|
|
|
|
|
if (cellElement != null && b) { |
|
|
|
|
value = cellElement.getValue(); |
|
|
|
|
} |
|
|
|
|
value = value == null ? "" : value; |
|
|
|
|
value = value == null ? StringUtils.EMPTY : value; |
|
|
|
|
//之前是少了个bigInteger,刚kunsnat又发现少了个bigDecimal,数字类型的都用stringEditor,没必要那个样子
|
|
|
|
|
QuickEditor editor = ActionFactory.getCellEditor((value instanceof Number) ? (Number.class) : (value.getClass())); |
|
|
|
|
if (editor == null) { |
|
|
|
|