Browse Source

Pull request #9798: REPORT-75090 设计器模板文件管理

Merge in DESIGN/design from ~ROGER.CHEN/design:feature/x to feature/x

* commit 'a2050fd5f94e2b3d11a4a517c52fc0eb24ea443f':
  REPORT-75090 设计器模板文件管理
feature/x
Roger.Chen 2 years ago
parent
commit
6e387f422c
  1. 5
      designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java
  2. 2
      designer-base/src/main/java/com/fr/design/file/DefaultTemplateTreeDefineProcessor.java
  3. 14
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  4. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  5. 5
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/TemplateTreeSearchManager.java
  6. 2
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateDirTreeSearchPane.java

5
designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java

@ -18,7 +18,6 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.utils.TemplateUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
@ -57,8 +56,6 @@ import static javax.swing.JOptionPane.YES_NO_OPTION;
public class RenameAction extends UpdateAction {
private FileOperations selectedOperation;
public static final com.fr.event.Event<TwoTuple<String, String>> TEMPLATE_RENAME = new Event<TwoTuple<String, String>>() {
};
public RenameAction() {
@ -273,7 +270,7 @@ public class RenameAction extends UpdateAction {
boolean success = selectedOperation.rename(fnf, path, newPath);
if (success) {
EventDispatcher.fire(TEMPLATE_RENAME, new TwoTuple<>(path, newPath));
EventDispatcher.fire(DesignerFrameFileDealerPane.TEMPLATE_RENAME, new TwoTuple<>(path, newPath));
HistoryTemplateListCache.getInstance().rename(fnf, path, newPath);
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(fnf.isDirectory(), path, newPath);
selectedOperation.refreshParent();

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

@ -202,7 +202,7 @@ public class DefaultTemplateTreeDefineProcessor extends AbstractTemplateTreeDefi
if (TemplateTreeSearchManager.getInstance().isInSearchMode()) {
TemplateTreeSearchManager.getInstance().outOfSearchMode();
}
DesignerFrameFileDealerPane.getInstance().getSelectedOperation().refresh();
DesignerFrameFileDealerPane.getInstance().getSelectedOperation().refreshParent();
String targetFile = StableUtils.pathJoin(targetDir, ((FileNode) (pasteNodes.get(0).getUserObject())).getName());
LocateAction.gotoEditingTemplateLeaf(targetFile);
}

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

@ -16,6 +16,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.lock.LockInfoDialog;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager;
import com.fr.design.mainframe.manager.search.searcher.control.pane.TemplateSearchRemindPane;
import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
@ -57,6 +58,9 @@ import java.util.Enumeration;
import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.stream.Collectors;
import org.jetbrains.annotations.Nullable;
@ -385,10 +389,15 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
}
}
refreshAfterDelete();
Set<FileNode> deletedFileNode = deletableNodes.stream().map(treeNode -> (FileNode) treeNode.getUserObject()).collect(Collectors.toSet());
refreshAfterDelete(deletedFileNode);
}
private void refreshAfterDelete() {
private void refreshAfterDelete(Set<FileNode> deletedPaths) {
if (TemplateTreeSearchManager.getInstance().isInSearchMode()) {
TemplateTreeSearchManager.getInstance().deleteMatchedNode(deletedPaths);
TemplateTreeSearchManager.getInstance().updateTemplateTree();
} else {
TreePath[] paths = reportletsTree.getSelectionPaths();
if (paths == null) {
reportletsTree.refresh();
@ -398,6 +407,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
}
}
}
private boolean deleteNodes(Collection<ExpandMutableTreeNode> nodes) {

4
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode;
import com.fr.chartx.TwoTuple;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -42,6 +43,7 @@ import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
@ -88,6 +90,8 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange {
public static final com.fr.event.Event<TwoTuple<String, String>> TEMPLATE_RENAME = new Event<TwoTuple<String, String>>() {
};
private static final String FILE = "file";
public static final String FILE_NAME_LIMIT = "^[^/\\\\:<>\\*\\|\"\\?]+$";

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

@ -15,6 +15,7 @@ import javax.swing.SwingUtilities;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@ -200,6 +201,10 @@ public class TemplateTreeSearchManager {
return treeSearcher.getMatchSets().toArray(new FileNode[0]);
}
public void deleteMatchedNode(Set<FileNode> fileNodes) {
treeSearcher.getMatchSets().removeAll(fileNodes);
}
/**
* 当前模板树中的所有模板节点
* @return

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

@ -102,7 +102,7 @@ public class TemplateDirTreeSearchPane extends JPanel implements TreeSearchStatu
}
};
searchTextField.setBorderPainted(false);
searchTextField.setPlaceholder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Template_Search_Press_Enter_For_Search"));
searchTextField.setPlaceholder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Template_Dir_Search_Press_Enter_For_Search"));
searchTextField.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {

Loading…
Cancel
Save