MoMeak 7 years ago
parent
commit
31a8ec8364
  1. 25
      designer/src/com/fr/grid/selection/CellSelection.java
  2. 2
      designer_base/src/com/fr/design/menu/KeySetUtils.java

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

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

2
designer_base/src/com/fr/design/menu/KeySetUtils.java

@ -384,7 +384,7 @@ public class KeySetUtils {
@Override @Override
public String getMenuName() { public String getMenuName() {
return "EXCEL"+Inter.getLocText("FR-Designer_ExportAndOutput"); return "EXCEL" + Inter.getLocText("FR-Designer_ExportAndOutput");
} }
@Override @Override

Loading…
Cancel
Save