Browse Source

增加AppTypeFilter过滤插件类型,如果为空则不过滤

release/11.0
renekton 3 months ago
parent
commit
398b9397b5
  1. 13
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  2. 1
      designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

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

@ -7,6 +7,7 @@ import com.fr.design.file.NodeAuthProcessor;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.mainframe.App;
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager;
import com.fr.file.filetree.AppTypeFilter;
import com.fr.file.filetree.FileNode;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
@ -19,6 +20,7 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
@ -38,6 +40,8 @@ public class TemplateFileTree extends EnvFileTree {
private static final int MAX_NODE_EXPAND_NUM = 50;
private static final int MAX_MATCHED_NODE_NUM = 500;
protected AppTypeFilter appTypeFilter;
public TemplateFileTree() {
super(ProjectConstants.REPORTLETS_NAME, null, null);
}
@ -155,12 +159,17 @@ public class TemplateFileTree extends EnvFileTree {
supportTypes.add(FileExtension.parse(temp));
}
}
if (appTypeFilter != null) {
Collections.addAll(supportTypes, appTypeFilter.getSupportedTypes());
} else {
Set<App> apps = ExtraDesignClassManager.getInstance().getArray(App.MARK_STRING);
for (App temp : apps) {
for (String extendsion : temp.defaultExtensions()) {
supportTypes.add(FileExtension.parse(extendsion));
}
}
}
return supportTypes;
}
@ -360,6 +369,10 @@ public class TemplateFileTree extends EnvFileTree {
}
}
public void setAppTypeFilter(AppTypeFilter filter) {
appTypeFilter = filter;
}
private boolean notContained(String parentPath, ExpandMutableTreeNode treeNode) {
List<String> childList = currentTreeMode.getOrDefault(parentPath, new ArrayList<>());
String name = ((FileNode) (treeNode.getUserObject())).getName();

1
designer-base/src/main/java/com/fr/design/javascript/ExportJavaScriptPane.java

@ -968,6 +968,7 @@ public class ExportJavaScriptPane extends AbstractHyperLinkPane<ExportJavaScript
templateReportletTree = new TemplateFileTree();
IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt"});
templateReportletTree.setFileNodeFilter(filter);
templateReportletTree.setAppTypeFilter(() -> new FileExtension[]{});
cardPane.add(t_panel = new JScrollPane(templateReportletTree), "TEMPLATE");
this.refreshEnv();

Loading…
Cancel
Save