From 5c71e21ec27dc3b20e706ece93893da271f11b72 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 29 Aug 2017 11:02:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-2897=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E4=BF=AE=E6=94=B9=20=E8=B0=83=E6=95=B4=E5=8F=B3?= =?UTF-8?q?=E5=87=BB=E8=8F=9C=E5=8D=95=E9=A1=BA=E5=BA=8F=EF=BC=8C=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E5=A4=9A=E4=BD=99=E7=9A=84...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/cell/CellAttributeAction.java | 5 +++-- .../src/com/fr/design/actions/edit/HyperlinkAction.java | 2 +- designer/src/com/fr/grid/selection/CellSelection.java | 8 ++++---- designer_base/src/com/fr/design/menu/KeySetUtils.java | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/designer/src/com/fr/design/actions/cell/CellAttributeAction.java b/designer/src/com/fr/design/actions/cell/CellAttributeAction.java index 949d72de0c..e2455a1599 100644 --- a/designer/src/com/fr/design/actions/cell/CellAttributeAction.java +++ b/designer/src/com/fr/design/actions/cell/CellAttributeAction.java @@ -1,5 +1,6 @@ package com.fr.design.actions.cell; +import com.fr.base.BaseUtils; import com.fr.design.menu.KeySetUtils; import com.fr.general.Inter; @@ -9,9 +10,9 @@ import com.fr.general.Inter; public class CellAttributeAction extends CellAttributeTableAction { public CellAttributeAction() { this.setMenuKeySet(KeySetUtils.CELL_OTHER_ATTR); - this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); + this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - // this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellAttr.png")); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellAttr.png")); } @Override diff --git a/designer/src/com/fr/design/actions/edit/HyperlinkAction.java b/designer/src/com/fr/design/actions/edit/HyperlinkAction.java index 2fcc46901f..38fc9bece5 100644 --- a/designer/src/com/fr/design/actions/edit/HyperlinkAction.java +++ b/designer/src/com/fr/design/actions/edit/HyperlinkAction.java @@ -17,7 +17,7 @@ public class HyperlinkAction extends UpdateAction { public HyperlinkAction() { this.setMenuKeySet(KeySetUtils.HYPER_LINK); - this.setName(getMenuKeySet().getMenuKeySetName() + "..."); + this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/hyperLink.png")); } diff --git a/designer/src/com/fr/grid/selection/CellSelection.java b/designer/src/com/fr/grid/selection/CellSelection.java index 890affae32..ea3234e85f 100644 --- a/designer/src/com/fr/grid/selection/CellSelection.java +++ b/designer/src/com/fr/grid/selection/CellSelection.java @@ -434,9 +434,10 @@ public class CellSelection extends Selection { popup.add(new CleanAuthorityAction(ePane).createMenuItem()); return popup; } - popup.add(DeprecatedActionManager.getCellMenu(ePane).createJMenu()); popup.add(new EditCellAction(ePane).createMenuItem()); + popup.add(DeprecatedActionManager.getCellMenu(ePane).createJMenu()); // richer:add global style menu + popup.add(new CellExpandAttrAction().createMenuItem()); if (!ConfigManager.getProviderInstance().hasStyle()) { UIMenu styleMenu = new UIMenu(KeySetUtils.GLOBAL_STYLE.getMenuName()); styleMenu.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); @@ -455,13 +456,12 @@ public class CellSelection extends Selection { } else { popup.add(new StyleAction().createMenuItem()); } + popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu()); + popup.add(new CellAttributeAction().createMenuItem()); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (jTemplate.isJWorkBook()){ //表单中报表块编辑屏蔽掉 控件设置 popup.add(new CellWidgetAttrAction().createMenuItem()); } - popup.add(new CellExpandAttrAction().createMenuItem()); - popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu()); - popup.add(new CellAttributeAction().createMenuItem()); popup.add(new ConditionAttributesAction().createMenuItem()); popup.add(new HyperlinkAction().createMenuItem()); // cut, copy and paste diff --git a/designer_base/src/com/fr/design/menu/KeySetUtils.java b/designer_base/src/com/fr/design/menu/KeySetUtils.java index 401da7fb99..01022433e6 100644 --- a/designer_base/src/com/fr/design/menu/KeySetUtils.java +++ b/designer_base/src/com/fr/design/menu/KeySetUtils.java @@ -756,7 +756,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("ExpandD-Cell_Expand_Attributes"); + return Inter.getLocText("FR-Designer_Expand"); } @Override @@ -978,7 +978,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("M_Format_A-Cell_Attributes"); + return Inter.getLocText("FR-Designer_Other"); } @Override From 31a8ec836435e8a018daa8b1a59d4a7c6a26a443 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 29 Aug 2017 16:25:04 +0800 Subject: [PATCH 2/2] PMD --- .../com/fr/grid/selection/CellSelection.java | 25 ++++++++++++++----- .../src/com/fr/design/menu/KeySetUtils.java | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/designer/src/com/fr/grid/selection/CellSelection.java b/designer/src/com/fr/grid/selection/CellSelection.java index ea3234e85f..31a73cc622 100644 --- a/designer/src/com/fr/grid/selection/CellSelection.java +++ b/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.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 removeElementList = new ArrayList(); 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) { diff --git a/designer_base/src/com/fr/design/menu/KeySetUtils.java b/designer_base/src/com/fr/design/menu/KeySetUtils.java index 01022433e6..8166c9f36b 100644 --- a/designer_base/src/com/fr/design/menu/KeySetUtils.java +++ b/designer_base/src/com/fr/design/menu/KeySetUtils.java @@ -384,7 +384,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return "EXCEL"+Inter.getLocText("FR-Designer_ExportAndOutput"); + return "EXCEL" + Inter.getLocText("FR-Designer_ExportAndOutput"); } @Override