Browse Source

Merge pull request #10615 in DESIGN/design from final/11.0 to release/11.0

* commit '08cfd2fabe6e2751710900a57767d684b7d5c137':
  REPORT-80695 模板全局查找替换2期 校验入口字符串获取逻辑修改
  REPORT-80695 模板全局查找替换2期 增加替换tip
  REPORT-82745 二次新建模板计数异常
release/11.0
superman 2 years ago
parent
commit
0f0e324b8a
  1. 27
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateNameHelper.java
  2. 9
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

27
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<BigInteger> 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

9
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();
@ -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++;
}

Loading…
Cancel
Save