From eab0e8e48cc7e5c7dcfde7160daea6d714910301 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 8 Nov 2022 10:07:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-82745=20=E4=BA=8C=E6=AC=A1=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E6=A8=A1=E6=9D=BF=E8=AE=A1=E6=95=B0=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/JTemplateNameHelper.java | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java index 96ca5b4843..0f245d8bb4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.TemplateTreePane; import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.stable.StringUtils; @@ -19,8 +20,6 @@ public class JTemplateNameHelper { private static final int PREFIX_NUM = 3000; - private static short currentIndex = 0;// 此变量用于多次新建模板时,让名字不重复 - public static String newTemplateNameByIndex(String prefix) { // 用于获取左侧模板的文件名,如左侧已包含"WorkBook1.cpt, WorkBook12.cpt, WorkBook177.cpt" // 那么新建的文件名将被命名为"WorkBook178.cpt",即取最大数+1 @@ -37,13 +36,33 @@ public class JTemplateNameHelper { reportNum.add(index); } } + //把当前编辑面板的模板名也加进来判断 + addHistoryTemplateName2List(reportNum, prefix); Collections.sort(reportNum); BigInteger idx = reportNum.size() > 0 ? reportNum.get(reportNum.size() - 1).add(BigInteger.valueOf(1)) : BigInteger.valueOf(1); - idx = idx.add(BigInteger.valueOf(currentIndex)); - currentIndex++; return prefix + idx; } + /** + * 将当前打开的模板列表的模板名处理一下加进来,以便于获取左侧模板文件名与当前模板列表的最大值 + * + * @param reportNum 存储后缀的列表 + * @param prefix 前缀 + */ + private static void addHistoryTemplateName2List(List reportNum, String prefix) { + int len = HistoryTemplateListCache.getInstance().getHistoryCount(); + for (int i = 0; i < len; i++) { + JTemplate jTemplate = HistoryTemplateListCache.getInstance().get(i); + if (jTemplate != null) { + String templateName = jTemplate.getTemplateName(); + BigInteger index = getFileNameIndex(prefix, templateName); + if (index != null) { + reportNum.add(index); + } + } + } + } + /** * @return java.lang.Integer WorkBook11.cpt则返回11,如果没有找到index返回null * @Description 返回文件名中的index From f531098ff1c733a1f63825c4fedfa84857ffc680 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Tue, 8 Nov 2022 15:48:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-80695=20=E6=A8=A1=E6=9D=BF=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E6=9F=A5=E6=89=BE=E6=9B=BF=E6=8D=A22=E6=9C=9F=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9B=BF=E6=8D=A2tip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/replace/ui/ITReplaceMainDialog.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java index e5ba60f703..67fae2e141 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java @@ -260,6 +260,10 @@ public class ITReplaceMainDialog extends UIDialog { for (Info info : searchContentResultList) { if (!info.getContent().isWrongful() && isSupportReplace(info)) { info.setValue(info, searchStr, replaceStr, info.getContent().getOperatorArray()); + contentReplaceCount++; + } + if (info.getContent().isWrongful()) { + contentReplaceFailedCount++; } if (info.getContent().isSelected()) { info.getContent().setReplaced(true); @@ -318,13 +322,10 @@ public class ITReplaceMainDialog extends UIDialog { for (Info info : searchContentResultList) { if (isAllow2Replace(info)) { if (!info.isLegalValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(), searchStr, replaceStr)) { - contentReplaceFailedCount++; checkValidList.add(info); serialNumber.add(count); info.getContent().setWrongful(true); info.getContent().setReplaced(true); - } else { - contentReplaceCount++; } count++; } From a0cbf5d6a34d635348d44d15e24a7b149e07d54d Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 9 Nov 2022 09:32:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-80695=20=E6=A8=A1=E6=9D=BF=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E6=9F=A5=E6=89=BE=E6=9B=BF=E6=8D=A22=E6=9C=9F=20?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=85=A5=E5=8F=A3=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/replace/ui/ITReplaceMainDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java index 67fae2e141..da5604bd70 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java @@ -212,7 +212,7 @@ public class ITReplaceMainDialog extends UIDialog { * 模板内容替换相关 */ private void replace4Content() { - String type = ((UITextField) (northPane.getFindCombobox().getEditor().getEditorComponent())).getText(); + String type = GeneralUtils.objectToString(northPane.getFindCombobox().getSelectedItem()); String searchStr = ((UITextField) (northPane.getFindInputCombobox().getEditor().getEditorComponent())).getText(); String replaceStr = ((UITextField) (northPane.getReplaceInputCombobox().getEditor().getEditorComponent())).getText(); clearContentCount();