From be4d346eb2eabc66a41f10fe4bc2885217858e90 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 17 Oct 2019 15:14:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/fun/ReportSupportedFileUIProvider.java | 9 +++++---- .../impl/AbstractReportSupportedFileUIProvider.java | 7 ++++--- .../design/gui/itree/filetree/FileNodeConstants.java | 2 +- .../gui/itree/filetree/FileNodeConstantsTest.java | 12 ++++-------- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java index c68c8813dd..2ccfd9363e 100644 --- a/designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java @@ -1,6 +1,6 @@ package com.fr.design.fun; -import com.fr.decision.extension.report.ReportSupportedFileProvider; +import com.fr.base.extension.FileExtension; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILEChooserPane; import com.fr.stable.fun.mark.Mutable; @@ -25,10 +25,11 @@ public interface ReportSupportedFileUIProvider extends Mutable { /** - * 获取对应的新增的支持文件类型 - * @return ReportTemplateFileProvider + * 获取可支持的文件类型 + * @return 文件扩展 */ - ReportSupportedFileProvider getSupportedFile(); + FileExtension[] getFileExtensions(); + /** * 获取文件关联的icon diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java index f307a91e28..3e8046e6f7 100644 --- a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java @@ -1,6 +1,6 @@ package com.fr.design.fun.impl; -import com.fr.decision.extension.report.ReportSupportedFileProvider; +import com.fr.base.extension.FileExtension; import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.mainframe.JTemplate; import com.fr.file.FILEChooserPane; @@ -20,10 +20,11 @@ public abstract class AbstractReportSupportedFileUIProvider extends AbstractProv } @Override - public ReportSupportedFileProvider getSupportedFile() { - return null; + public FileExtension[] getFileExtensions() { + return new FileExtension[0]; } + @Override public Icon getFileIcon(String path, boolean isShowLock) { return null; diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java index 82cae94c1c..617051dc63 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java @@ -60,7 +60,7 @@ public class FileNodeConstants { //通过插件扩展的 Set providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG); for (ReportSupportedFileUIProvider provider : providers) { - addAppExtensions(provider.getSupportedFile().getFileExtensions()); + addAppExtensions(provider.getFileExtensions()); } supportFileType.addAll(Arrays.asList(FRContext.getFileNodes().getSupportedTypes())); diff --git a/designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java b/designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java index 5ddc3b8b29..e62091048f 100644 --- a/designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java +++ b/designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java @@ -1,7 +1,6 @@ package com.fr.design.gui.itree.filetree; import com.fr.base.extension.FileExtension; -import com.fr.decision.extension.report.ReportSupportedFileProvider; import com.fr.design.ExtraDesignClassManager; import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.fun.impl.AbstractReportSupportedFileUIProvider; @@ -27,7 +26,7 @@ public class FileNodeConstantsTest { ExtraDesignClassManager extra = mockExtraDesignClassManager(); Assert.assertEquals(1, extra.getArray(ReportSupportedFileUIProvider.XML_TAG).size()); ReportSupportedFileUIProvider option = (ReportSupportedFileUIProvider) extra.getArray(ReportSupportedFileUIProvider.XML_TAG).iterator().next(); - Assert.assertEquals(FileExtension.CPTX, option.getSupportedFile().getFileExtensions()[0]); + Assert.assertEquals(FileExtension.CPTX, option.getFileExtensions()[0]); } @Test @@ -54,14 +53,11 @@ public class FileNodeConstantsTest { private class MockNewTemplateFileOption extends AbstractReportSupportedFileUIProvider { @Override - public ReportSupportedFileProvider getSupportedFile() { - ReportSupportedFileProvider supportedFileProvider = EasyMock.mock(ReportSupportedFileProvider.class); - EasyMock.expect(supportedFileProvider.getFileExtensions()).andReturn(new FileExtension[]{FileExtension.CPTX}).anyTimes(); - EasyMock.replay(supportedFileProvider); - return supportedFileProvider; + public FileExtension[] getFileExtensions() { + return new FileExtension[]{FileExtension.CPTX + }; } - } }