From 7cfeaef10c206401dabf8e9cf892b61af7fa904a Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 9 Sep 2024 15:45:51 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-133888=20-=20=E3=80=90fr-fbp=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E6=96=87=E4=BB=B6=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?excel=E5=8F=AA=E8=83=BD=E8=A2=AB=E9=80=89=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/file/FILEChooserPane.java | 19 ++++++++++++++++++- .../main/java/com/fr/file/FILEFactory.java | 16 +++++++++++++++- .../main/java/com/fr/file/FileDataFILE.java | 11 +++++++++-- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 355cbffa15..2cf1016c48 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -1384,6 +1384,7 @@ public class FILEChooserPane extends BasicPane { private class FileDataPlaceListModel extends AbstractPlaceListModel { private FileDataFILE envFILE; + private String type; FileDataPlaceListModel(String type) { envFILE = new FileDataFILE(new FileNode(StableUtils.pathJoin(ProjectConstants.ASSETS_NAME, FileDataFILE.FILE_DATASET_NAME), true), false, StableUtils.pathJoin(ProjectConstants.ASSETS_NAME, FileDataFILE.FILE_DATASET_NAME)) { @@ -1393,6 +1394,7 @@ public class FILEChooserPane extends BasicPane { } }; envFILE.setType(type); + FileDataPlaceListModel.this.setType(type); } @Override @@ -1405,6 +1407,21 @@ public class FILEChooserPane extends BasicPane { return 1 + filesOfSystem.size(); } + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + protected void setCD(FILE lastDirectory) { + super.setCD(lastDirectory); + if (lastDirectory instanceof FileDataFILE) { + ((FileDataFILE)lastDirectory).setType(type); + } + } } private class FileCAPlaceListModel extends AbstractPlaceListModel { @@ -1642,7 +1659,7 @@ public class FILEChooserPane extends BasicPane { this.buttonList.add(createBlankButton((new SetDirectoryAction(btn_text + '/', // alex:dir.prefix不和btn_path一起参与pathJoin,因为btn_path是否以/打头在unix,linux // OS中意义很不一样 - FILEFactory.createFolder(dir.prefix() + StableUtils.pathJoin(btn_path, "/")), !needTopPath)))); + FILEFactory.createFolder(dir, dir.prefix() + StableUtils.pathJoin(btn_path, "/")), !needTopPath)))); } maxPathIndex = calculateMaxPathIndex(); diff --git a/designer-base/src/main/java/com/fr/file/FILEFactory.java b/designer-base/src/main/java/com/fr/file/FILEFactory.java index 7f20b844a4..3e7113f35a 100644 --- a/designer-base/src/main/java/com/fr/file/FILEFactory.java +++ b/designer-base/src/main/java/com/fr/file/FILEFactory.java @@ -39,12 +39,22 @@ public class FILEFactory { return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length()))); } else if (path.startsWith(FILE_DATA_PREFIX)) { return new FileDataFILE(new FileNode(path.substring(FILE_DATA_PREFIX.length()), false), false, path.substring(FILE_DATA_PREFIX.length())); + } else if (path.startsWith(FILE_CA_PREFIX)) { + return new FileCAFILE(new FileNode(path.substring(FILE_CA_PREFIX.length()), false), false, path.substring(FILE_CA_PREFIX.length())); } else { return new FileNodeFILE(new FileNode(path, WorkContext.getWorkResource().isDirectory(path))); } } public static FILE createFolder(String path) { + return createFolder(null, path); + } + + + /** + * 传递依据的基础文件并创建文件夹 + */ + public static FILE createFolder(FILE origin, String path) { if (path == null) { return null; } else if (path.startsWith(MEM_PREFIX)) { @@ -58,7 +68,11 @@ public class FILEFactory { } else if (path.startsWith(FILE_PREFIX)) { return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length()))); } else if (path.startsWith(FILE_DATA_PREFIX)) { - return new FileDataFILE(new FileNode(path.substring(FILE_DATA_PREFIX.length()), true), false, path.substring(FILE_DATA_PREFIX.length())); + FileDataFILE file = new FileDataFILE(new FileNode(path.substring(FILE_DATA_PREFIX.length()), true), false, path.substring(FILE_DATA_PREFIX.length())); + if (origin instanceof FileDataFILE) { + file.setType(((FileDataFILE) origin).getType()); + } + return file; } else if (path.startsWith(FILE_CA_PREFIX)) { return new FileCAFILE(new FileNode(path.substring(FILE_CA_PREFIX.length()), true), false, path.substring(FILE_CA_PREFIX.length())); } diff --git a/designer-base/src/main/java/com/fr/file/FileDataFILE.java b/designer-base/src/main/java/com/fr/file/FileDataFILE.java index 434faeee03..11fba58b6a 100644 --- a/designer-base/src/main/java/com/fr/file/FileDataFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileDataFILE.java @@ -42,6 +42,13 @@ public class FileDataFILE extends FileNodeFILE{ this.id = id; } + public FileDataFILE(FileNode node, boolean builded, String id, String type) { + super(node); + this.builded = builded; + this.id = id; + this.type = type; + } + private void addChild(FileDataFILE file) { children.add(file); } @@ -127,7 +134,7 @@ public class FileDataFILE extends FileNodeFILE{ FileNode fileNode = new FileNode(); fileNode.setEnvPath(bean.getPath()); fileNode.setDirectory(bean.getIsParent()); - tree.putIfAbsent(bean.getId(), new FileDataFILE(fileNode, true, bean.getId())); + tree.putIfAbsent(bean.getId(), new FileDataFILE(fileNode, true, bean.getId(), type)); if (StringUtils.isEmpty(bean.getpId())) { root = tree.get(bean.getId()); } else { @@ -147,7 +154,7 @@ public class FileDataFILE extends FileNodeFILE{ FileNode fileNode = new FileNode(); fileNode.setEnvPath(bean.getPath()); fileNode.setDirectory(bean.getIsParent()); - return new FileDataFILE(fileNode, true, bean.getId()); + return new FileDataFILE(fileNode, true, bean.getId(), type); } } return null;