Browse Source

Merge pull request #9894 in DESIGN/design from release/11.0 to bugfix/11.0

* commit '494d0f0a0f8625556e3fca5fb12df99ff41af1d5':
  REPORT-79341 【运营产品化二期】立即使用下载的模板名称目前是开头加了(1),是否可按浏览器规则 修改了重名规则 添加了异常处理
  REPORT-79182 选中的文件下有锁定的模板,异常提示
  REPORT-79343 【运营产品化二期】立即使用后打开的模板仍提示报存 1、打开前刷新目录
  代码质量问题
  REPORT-78748 搜索结果很多时,设计器界面处于卡死的状态
  REPORT-73421 模板web属性-填报页面设置-填报当前编辑行背景设置 的取色器中 未适配 主题色
  REPORT-79301 关于EDT模态框事件(嵌套事件)具体输出哪个时间
bugfix/11.0
superman 2 years ago
parent
commit
7e829bd305
  1. 4
      designer-base/src/main/java/com/fr/design/carton/CartonThreadExecutorPool.java
  2. 18
      designer-base/src/main/java/com/fr/design/carton/EventDispatchThreadHangMonitor.java
  3. 3
      designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java
  4. 28
      designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java
  5. 19
      designer-base/src/main/java/com/fr/design/file/FileOperationHelper.java
  6. 1
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  7. 5
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  8. 17
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/TemplateTreeSearchManager.java
  9. 2
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/common/TemplateDirSearchCallBack.java
  10. 2
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/common/TemplateSearchCallBack.java
  11. 3
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/common/TemplateSearchTask.java
  12. 2
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pre/TemplatePreSearchCallBack.java
  13. 2
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pre/TemplatePreSearchTask.java
  14. 6
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java
  15. 16
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java
  16. 3
      designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java

4
designer-base/src/main/java/com/fr/design/carton/CartonThreadExecutorPool.java

@ -65,7 +65,7 @@ public class CartonThreadExecutorPool extends ThreadPoolExecutor {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time"), simpleDateFormatThreadSafe.format(System.currentTimeMillis())); jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time"), simpleDateFormatThreadSafe.format(System.currentTimeMillis()));
jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number"), "swingWorker_" + hangNumber); jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number"), "swingWorker_" + hangNumber);
jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Duration_Task_Execute"), timeSoFar()); jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Duration_Task_Execute"), timeSoFar() + "ms");
jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Stack_Info"), stackTrace); jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Stack_Info"), stackTrace);
EventDispatchThreadHangMonitor.outPutJournalLog(jsonObject.toString(), SwitchForSwingChecker.TIMER_CHECK_FLAG); EventDispatchThreadHangMonitor.outPutJournalLog(jsonObject.toString(), SwitchForSwingChecker.TIMER_CHECK_FLAG);
EventDispatchThreadHangMonitor.checkForDeadlock(); EventDispatchThreadHangMonitor.checkForDeadlock();
@ -128,7 +128,7 @@ public class CartonThreadExecutorPool extends ThreadPoolExecutor {
jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time"), simpleDateFormatThreadSafe.format(System.currentTimeMillis())); jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time"), simpleDateFormatThreadSafe.format(System.currentTimeMillis()));
jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number"), "swingWorker_" + concurrentHashMap.get(currentThreadId).hangNumber); jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number"), "swingWorker_" + concurrentHashMap.get(currentThreadId).hangNumber);
jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Task_Start_Time"), simpleDateFormatThreadSafe.format(concurrentHashMap.get(currentThreadId).startTime)); jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Task_Start_Time"), simpleDateFormatThreadSafe.format(concurrentHashMap.get(currentThreadId).startTime));
jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Task_Total_Time"), runTime); jsonObject.put(Toolkit.i18nText("Fine-Design_Basic_Carton_Task_Total_Time"), runTime + "ms");
EventDispatchThreadHangMonitor.outPutJournalLog(jsonObject.toString(), SwitchForSwingChecker.EASY_CHECK_FLAG); EventDispatchThreadHangMonitor.outPutJournalLog(jsonObject.toString(), SwitchForSwingChecker.EASY_CHECK_FLAG);
} }

18
designer-base/src/main/java/com/fr/design/carton/EventDispatchThreadHangMonitor.java

@ -179,7 +179,7 @@ public final class EventDispatchThreadHangMonitor extends EventQueue {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time"), simpleDateFormat.format(System.currentTimeMillis())); jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time"), simpleDateFormat.format(System.currentTimeMillis()));
jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number"), "eventQueue_" + hangNumber); jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number"), "eventQueue_" + hangNumber);
jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Duration_Task_Execute"), timeSoFar()); jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Duration_Task_Execute"), timeSoFar() + "ms");
jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Stack_Info"), stackTrace); jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Stack_Info"), stackTrace);
outPutJournalLog(jsonObject.toString(), SwitchForSwingChecker.TIMER_CHECK_FLAG); outPutJournalLog(jsonObject.toString(), SwitchForSwingChecker.TIMER_CHECK_FLAG);
checkForDeadlock(); checkForDeadlock();
@ -195,13 +195,27 @@ public final class EventDispatchThreadHangMonitor extends EventQueue {
//事件处理完后的时间判断 //事件处理完后的时间判断
public void dispose() { public void dispose() {
if (timeSoFar() > UNREASONABLE_DISPATCH_DURATION_MS) { if (timeSoFar() > UNREASONABLE_DISPATCH_DURATION_MS) {
exportCartonLog(true);
} else if (lastReportedStack != null){
exportCartonLog(false);
}
}
/**
*
* @param flag 判断一下输出日志时要输出哪个时间
*/
private void exportCartonLog(boolean flag) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time"), simpleDateFormat.format(System.currentTimeMillis())); jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time"), simpleDateFormat.format(System.currentTimeMillis()));
jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number"), "eventQueue_" + hangNumber); jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number"), "eventQueue_" + hangNumber);
jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Task_Start_Time"), simpleDateFormat.format(startDispatchTimeMillis)); jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Task_Start_Time"), simpleDateFormat.format(startDispatchTimeMillis));
if (flag) {
jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Task_Total_Time"), timeSoFar() + "ms"); jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Task_Total_Time"), timeSoFar() + "ms");
outPutJournalLog(jsonObject.toString(), SwitchForSwingChecker.EASY_CHECK_FLAG); } else {
jsonObject.put(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Carton_Task_Total_Time"), totalTime() + "ms");
} }
outPutJournalLog(jsonObject.toString(), SwitchForSwingChecker.EASY_CHECK_FLAG);
} }
} }

3
designer-base/src/main/java/com/fr/design/carton/SwitchForSwingChecker.java

@ -180,7 +180,7 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter {
CartonUploadMessage cartonUploadMessage = new CartonUploadMessage(); CartonUploadMessage cartonUploadMessage = new CartonUploadMessage();
JSONObject x = (JSONObject) jsonObject; JSONObject x = (JSONObject) jsonObject;
cartonUploadMessage.setHangCount(x.getString(Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number"))); cartonUploadMessage.setHangCount(x.getString(Toolkit.i18nText("Fine-Design_Basic_Carton_Event_Number")));
cartonUploadMessage.setSlowTime(x.getString(Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time")) + "ms"); cartonUploadMessage.setSlowTime(x.getString(Toolkit.i18nText("Fine-Design_Basic_Carton_Output_Time")));
cartonUploadMessage.setThreadTime("undefined"); cartonUploadMessage.setThreadTime("undefined");
//这个跟输出到文件中的格式匹配,参考EventDis里的stackTraceToString方法 //这个跟输出到文件中的格式匹配,参考EventDis里的stackTraceToString方法
String indentation = " "; String indentation = " ";
@ -308,4 +308,5 @@ public class SwitchForSwingChecker implements XMLReadable, XMLWriter {
writer.attr("easyChecker", easyChecker); writer.attr("easyChecker", easyChecker);
writer.end(); writer.end();
} }
} }

28
designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java

@ -207,7 +207,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
for (ExpandMutableTreeNode treeNode : treeNodeList) { for (ExpandMutableTreeNode treeNode : treeNodeList) {
FileOperationHelper.getInstance().checkFreeOrLock(treeNode, pasteNodes, lockedNodes); FileOperationHelper.getInstance().checkFreeOrLock(treeNode, pasteNodes, lockedNodes);
} }
if (pasteNodes.isEmpty()) { if (pasteNodes.isEmpty() || !lockedNodes.isEmpty()) {
//提示:复制的文件都不能黏贴 //提示:复制的文件都不能黏贴
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Confirm_Paste_Unlock_File"), Toolkit.i18nText("Fine-Design_Basic_Confirm_Paste_Unlock_File"),
@ -215,18 +215,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
WARNING_MESSAGE); WARNING_MESSAGE);
return; return;
} }
if (lockedNodes.isEmpty()) {
doPaste(targetDir, pasteNodes); doPaste(targetDir, pasteNodes);
} else {
if (FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Confirm_Paste_Other_File"),
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
YES_NO_OPTION)
== JOptionPane.YES_OPTION) {
// 黏贴其他可黏贴的文件
doPaste(targetDir, pasteNodes);
}
}
} }
/** /**
@ -329,13 +318,14 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
WARNING_MESSAGE); WARNING_MESSAGE);
return; return;
} }
// 筛选可以移动的文件
ArrayList<ExpandMutableTreeNode> moveNodes = new ArrayList<>();
ArrayList<ExpandMutableTreeNode> lockedNodes = new ArrayList<>();
for (ExpandMutableTreeNode treeNode : getFileTree().getSelectedTreeNodes()) {
FileOperationHelper.getInstance().checkFreeOrLock(treeNode, moveNodes, lockedNodes);
}
ExpandMutableTreeNode[] selectedTreeNodes = getFileTree().getSelectedTreeNodes(); if (!lockedNodes.isEmpty()) {
for (ExpandMutableTreeNode treeNode : selectedTreeNodes) {
if (treeNode.getUserObject() instanceof FileNode) {
FileNode node = (FileNode) treeNode.getUserObject();
String lock = node.getLock();
if (lock != null && !lock.equals(node.getUserID())) {
// 提醒被锁定模板无法移动 // 提醒被锁定模板无法移动
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Unable_Move_Locked_File"), Toolkit.i18nText("Fine-Design_Basic_Unable_Move_Locked_File"),
@ -343,8 +333,6 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
WARNING_MESSAGE); WARNING_MESSAGE);
return; return;
} }
}
}
new TemplateMoveDialog(); new TemplateMoveDialog();
} }

19
designer-base/src/main/java/com/fr/design/file/FileOperationHelper.java

@ -40,10 +40,10 @@ public class FileOperationHelper {
HistoryTemplateListCache.getInstance().deleteFile(nodeFILE); HistoryTemplateListCache.getInstance().deleteFile(nodeFILE);
FineLoggerFactory.getLogger().info("template {} move to {} success.", sourceFileNode.getEnvPath(), targetDir); FineLoggerFactory.getLogger().info("template {} move to {} success.", sourceFileNode.getEnvPath(), targetDir);
} else { } else {
//删除失败,将复制过去的文件删掉 //删除源文件失败,将复制过去的文件删掉
TemplateResourceManager.getResource().delete(new FileNodeFILE(targetPath)); TemplateResourceManager.getResource().delete(new FileNodeFILE(new FileNode(targetPath, sourceFileNode.isDirectory())));
FineLoggerFactory.getLogger().error("template {} move to {} failed.", sourceFileNode.getEnvPath(), targetDir); FineLoggerFactory.getLogger().error("template {} move to {} failed.", sourceFileNode.getEnvPath(), targetDir);
targetPath = StringUtils.EMPTY; throw new ResourceIOException(String.format("template %s move to %s failed", sourceFileNode.getEnvPath(), targetDir));
} }
} }
return targetPath; return targetPath;
@ -79,13 +79,16 @@ public class FileOperationHelper {
public boolean checkFreeOrLock(ExpandMutableTreeNode node, ArrayList<ExpandMutableTreeNode> dNodes, ArrayList<ExpandMutableTreeNode> lNodes) { public boolean checkFreeOrLock(ExpandMutableTreeNode node, ArrayList<ExpandMutableTreeNode> dNodes, ArrayList<ExpandMutableTreeNode> lNodes) {
// 自己没锁 // 自己没锁
boolean selfEmptyLock = false; boolean selfEmptyLock = false;
boolean dir = false;
Object userObj = node.getUserObject(); Object userObj = node.getUserObject();
if (userObj instanceof FileNode) { if (userObj instanceof FileNode) {
String lock = ((FileNode) userObj).getLock(); FileNode fileNode = (FileNode) userObj;
selfEmptyLock = lock == null || ((FileNode) userObj).getUserID().equals(lock); String lock = fileNode.getLock();
selfEmptyLock = lock == null || fileNode.getUserID().equals(lock);
dir = fileNode.isDirectory();
} }
if (node.isLeaf()) { if (!dir) {
if (selfEmptyLock) { if (selfEmptyLock) {
dNodes.add(node); dNodes.add(node);
} else { } else {
@ -130,7 +133,9 @@ public class FileOperationHelper {
FileNode[] fileNodes = TemplateTreePane.getInstance().getTemplateFileTree().listFile(sourceDir); FileNode[] fileNodes = TemplateTreePane.getInstance().getTemplateFileTree().listFile(sourceDir);
if (ArrayUtils.isEmpty(fileNodes)) { if (ArrayUtils.isEmpty(fileNodes)) {
//空目录:相当于新建一个目录 //空目录:相当于新建一个目录
DesignerFrameFileDealerPane.getInstance().getSelectedOperation().mkdir(targetDir); if (!DesignerFrameFileDealerPane.getInstance().getSelectedOperation().mkdir(targetDir)) {
throw new ResourceIOException(String.format("copy dir failed: from %s to %s.", sourceDir, targetDir));
}
return; return;
} }
for (FileNode fileNode : fileNodes) { for (FileNode fileNode : fileNodes) {

1
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -393,6 +393,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
if (TemplateTreeSearchManager.getInstance().isInSearchMode()) { if (TemplateTreeSearchManager.getInstance().isInSearchMode()) {
TemplateTreeSearchManager.getInstance().deleteMatchedNode(deletedPaths); TemplateTreeSearchManager.getInstance().deleteMatchedNode(deletedPaths);
TemplateTreeSearchManager.getInstance().updateTemplateTree(); TemplateTreeSearchManager.getInstance().updateTemplateTree();
TemplateTreeSearchManager.getInstance().setRefreshing(false);
} else { } else {
TreePath[] paths = reportletsTree.getSelectionPaths(); TreePath[] paths = reportletsTree.getSelectionPaths();
if (paths == null) { if (paths == null) {

5
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -35,6 +35,8 @@ public class TemplateFileTree extends EnvFileTree {
protected Map<String, ExpandMutableTreeNode> allTreeNode = new ConcurrentHashMap<>(); protected Map<String, ExpandMutableTreeNode> allTreeNode = new ConcurrentHashMap<>();
protected Map<String, ExpandMutableTreeNode> calculateNode = new ConcurrentHashMap<>(); protected Map<String, ExpandMutableTreeNode> calculateNode = new ConcurrentHashMap<>();
protected Map<String, List<String>> currentTreeMode = new ConcurrentHashMap<>(); protected Map<String, List<String>> currentTreeMode = new ConcurrentHashMap<>();
private static final int MAX_NODE_EXPAND_NUM = 50;
private static final int MAX_MATCHED_NODE_NUM = 500;
public TemplateFileTree() { public TemplateFileTree() {
super(ProjectConstants.REPORTLETS_NAME, null, null); super(ProjectConstants.REPORTLETS_NAME, null, null);
@ -272,8 +274,11 @@ public class TemplateFileTree extends EnvFileTree {
refreshTreeNode4TreeSearch(root); refreshTreeNode4TreeSearch(root);
sortTreeNode(root); sortTreeNode(root);
((DefaultTreeModel) this.getModel()).reload(root); ((DefaultTreeModel) this.getModel()).reload(root);
if (currentTreeMode.keySet().size() < MAX_NODE_EXPAND_NUM || TemplateTreeSearchManager.getInstance().matchesNode().length < MAX_MATCHED_NODE_NUM) {
//要展开的节点比较多的话,全部展开会有性能问题
root.expandCurrentTreeNode(this); root.expandCurrentTreeNode(this);
} }
}
/** /**
* 重新对整个目录树排序 * 重新对整个目录树排序

17
designer-base/src/main/java/com/fr/design/mainframe/manager/search/TemplateTreeSearchManager.java

@ -12,7 +12,9 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -129,7 +131,14 @@ public class TemplateTreeSearchManager {
setTreeSearchStatus(TreeSearchStatus.SEARCHING); setTreeSearchStatus(TreeSearchStatus.SEARCHING);
rendererHelper.replaceTreeRenderer(getCurrentTemplateTree(), searchText); rendererHelper.replaceTreeRenderer(getCurrentTemplateTree(), searchText);
FineLoggerFactory.getLogger().debug("start template search for search text: {}", searchText); FineLoggerFactory.getLogger().debug("start template search for search text: {}", searchText);
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
treeSearcher.startSearch(searchText); treeSearcher.startSearch(searchText);
return null;
}
}.execute();
} }
/** /**
@ -203,7 +212,13 @@ public class TemplateTreeSearchManager {
} }
public void deleteMatchedNode(Set<FileNode> fileNodes) { public void deleteMatchedNode(Set<FileNode> fileNodes) {
treeSearcher.getMatchSets().removeAll(fileNodes); Set<FileNode> deleteNode = new HashSet<>();
for (FileNode matchedNode : treeSearcher.getMatchSets()) {
if (fileNodes.stream().anyMatch(fileNode -> fileNode.getEnvPath().equals(matchedNode.getEnvPath()))) {
deleteNode.add(matchedNode);
}
}
treeSearcher.getMatchSets().removeAll(deleteNode);
} }
/** /**

2
designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/common/TemplateDirSearchCallBack.java

@ -24,10 +24,8 @@ public class TemplateDirSearchCallBack implements TreeSearchCallback {
if (TemplateDirTreeSearchManager.getInstance().getTreeSearchStatus() != TreeSearchStatus.SEARCHING) { if (TemplateDirTreeSearchManager.getInstance().getTreeSearchStatus() != TreeSearchStatus.SEARCHING) {
return; return;
} }
if (treeSearchResult.isSuccess()) {
// 添加结果 // 添加结果
addToTreeSearcher(treeSearchResult); addToTreeSearcher(treeSearchResult);
}
if (treeSearcher.getCalculatedCount() == treeSearcher.getAllDirSize()) { if (treeSearcher.getCalculatedCount() == treeSearcher.getAllDirSize()) {
updateTemplateTree(); updateTemplateTree();
} }

2
designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/common/TemplateSearchCallBack.java

@ -24,10 +24,8 @@ public class TemplateSearchCallBack implements TreeSearchCallback {
if (TemplateTreeSearchManager.getInstance().getTreeSearchStatus() != TreeSearchStatus.SEARCHING) { if (TemplateTreeSearchManager.getInstance().getTreeSearchStatus() != TreeSearchStatus.SEARCHING) {
return; return;
} }
if (treeSearchResult.isSuccess()) {
// 添加结果 // 添加结果
addToTreeSearcher(treeSearchResult); addToTreeSearcher(treeSearchResult);
}
updateTemplateTree(); updateTemplateTree();
} }

3
designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/common/TemplateSearchTask.java

@ -63,7 +63,8 @@ public class TemplateSearchTask implements TreeSearchTask {
* @param fileNode * @param fileNode
*/ */
private TreeSearchResult dealWithErrorTemplateWrapper(FileNode fileNode) { private TreeSearchResult dealWithErrorTemplateWrapper(FileNode fileNode) {
return new TemplateSearchResult.Builder().buildSuccess(false).build(); return new TemplateSearchResult.Builder().buildSuccess(false)
.buildAddToCalculated(Arrays.asList(fileNode.getEnvPath())).build();
} }
/** /**

2
designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pre/TemplatePreSearchCallBack.java

@ -17,10 +17,8 @@ public class TemplatePreSearchCallBack extends TemplateSearchCallBack {
@Override @Override
public void done(TreeSearchResult searchResult) { public void done(TreeSearchResult searchResult) {
if (searchResult.isSuccess()) {
addToTreeSearcher(searchResult); addToTreeSearcher(searchResult);
} }
}
/** /**
* 将结果添加到未计算的集合中 * 将结果添加到未计算的集合中

2
designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pre/TemplatePreSearchTask.java

@ -37,7 +37,7 @@ public class TemplatePreSearchTask implements TreeSearchTask {
FineLoggerFactory.getLogger().info("[Template Search] calculate {} child nodes success. total child node num is: {}", fileNode.getEnvPath(), allChildNode.size()); FineLoggerFactory.getLogger().info("[Template Search] calculate {} child nodes success. total child node num is: {}", fileNode.getEnvPath(), allChildNode.size());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("[Template Search] calculate {} child nodes failed", fileNode.getEnvPath()); FineLoggerFactory.getLogger().error("[Template Search] calculate {} child nodes failed", fileNode.getEnvPath());
result = new TemplateSearchResult.Builder().buildSuccess(false).build(); result = new TemplateSearchResult.Builder().buildAddToNotCalculated(new ArrayList<>()).buildSuccess(false).build();
} }
callback.done(result); callback.done(result);
} }

6
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/action/StartUseAction.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine.action;
import com.fr.common.util.Strings; import com.fr.common.util.Strings;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.alphafine.download.FineMarketConstants; import com.fr.design.mainframe.alphafine.download.FineMarketConstants;
import com.fr.design.mainframe.alphafine.download.FineMarketDownloadManager; import com.fr.design.mainframe.alphafine.download.FineMarketDownloadManager;
@ -59,7 +60,7 @@ public class StartUseAction implements ActionListener {
} }
File fileNeedOpen = new File(fileName); File fileNeedOpen = new File(fileName);
if (fileName.endsWith(FineMarketConstants.ZIP)) { if (fileName.endsWith(FineMarketConstants.ZIP)) {
File[] files = fileNeedOpen.listFiles(); File[] files = fileNeedOpen.getParentFile().listFiles();
fileNeedOpen = getFirstCptOrFrm(files); fileNeedOpen = getFirstCptOrFrm(files);
} else if (fileName.endsWith(FineMarketConstants.RAR)) { } else if (fileName.endsWith(FineMarketConstants.RAR)) {
// rar直接打开系统文件夹 // rar直接打开系统文件夹
@ -71,6 +72,9 @@ public class StartUseAction implements ActionListener {
} }
void openInDesigner(File file) { void openInDesigner(File file) {
// 刷新目录
DesignerFrameFileDealerPane.getInstance().refresh();
// 打开模板
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(file)); DesignerContext.getDesignerFrame().openTemplate(new FileFILE(file));
} }

16
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java

@ -35,6 +35,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -154,18 +155,20 @@ public class FineMarketClientHelper {
* */ * */
private File createDestFile(File destDir, TemplateResource resource) { private File createDestFile(File destDir, TemplateResource resource) {
String fileName = resource.getName(); String fileName = resource.getName();
try {
File finalDir = new File(StableUtils.pathJoin(FileCommonUtils.getAbsolutePath(destDir), fileName)); File finalDir = new File(StableUtils.pathJoin(FileCommonUtils.getAbsolutePath(destDir), fileName));
try {
if (!finalDir.exists()) { if (!finalDir.exists()) {
finalDir.mkdir(); finalDir.mkdir();
} }
// 获取文件名(含后缀) // 获取文件名(含后缀)
fileName = resource.getFileName(); fileName = resource.getFileName();
String prefix = fileName.substring(0, fileName.length() - 4);
String suffix = fileName.substring(fileName.length() - 4);
// 处理重复文件名 // 处理重复文件名
String fileNameFormat = "(%d)" + fileName; String fileNameFormat = prefix + "(%d)" + suffix;
Pattern pattern = Pattern.compile("\\((\\d)\\)" + fileName); Pattern pattern = Pattern.compile(prefix + "\\((\\d)\\)" + suffix);
int cnt = 0; int cnt = 0;
File[] files = finalDir.listFiles(); File[] files = finalDir.listFiles();
@ -178,15 +181,14 @@ public class FineMarketClientHelper {
cnt++; cnt++;
fileName = String.format(fileNameFormat, cnt); fileName = String.format(fileNameFormat, cnt);
File destFile = new File(StableUtils.pathJoin(FileCommonUtils.getAbsolutePath(finalDir), fileName)); File destFile = new File(StableUtils.pathJoin(FileCommonUtils.getAbsolutePath(finalDir), fileName));
destFile.createNewFile();
return destFile; return destFile;
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage()); FineLoggerFactory.getLogger().error(e, e.getMessage());
} }
return null; fileName = UUID.randomUUID() + fileName;
File dest = new File(StableUtils.pathJoin(FileCommonUtils.getAbsolutePath(finalDir), fileName));
return dest;
} }
private static CloseableHttpResponse getDownloadHttpResponse(String url) throws Exception { private static CloseableHttpResponse getDownloadHttpResponse(String url) throws Exception {

3
designer-realize/src/main/java/com/fr/design/webattr/WriteWebSettingPane.java

@ -4,7 +4,6 @@ import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UINoThemeColorButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -45,7 +44,7 @@ public class WriteWebSettingPane extends WebSettingPane<WebWrite> {
protected JPanel createOtherSetPane() { protected JPanel createOtherSetPane() {
colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background_Of_Current_Row") + ":"); colorBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background_Of_Current_Row") + ":");
colorBox.setSelected(true); colorBox.setSelected(true);
colorButton = new UINoThemeColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); colorButton = new UIColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png"));
colorBox.addActionListener(new ActionListener() { colorBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
colorButton.setEnabled(colorBox.isSelected()); colorButton.setEnabled(colorBox.isSelected());

Loading…
Cancel
Save