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 c68c8813d..2ccfd9363 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 f307a91e2..3e8046e6f 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 82cae94c1..617051dc6 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/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index c8f8280a4..8f7964906 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -1,6 +1,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.cluster.ClusterBridge; import com.fr.design.DesignModelAdapter; @@ -374,10 +375,11 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt if (WorkContext.getCurrent() != null) { + boolean pathSupportVcsAction = selectedOperation.getFilePath() != null && pathSupportVcsAction(selectedOperation.getFilePath()); if (!WorkContext.getCurrent().isLocal()) { //当前环境为远程环境时 FileNode node = TemplateTreePane.getInstance().getTemplateFileTree().getSelectedFileNode(); - if (selectedOperation.getFilePath() != null) { + if (pathSupportVcsAction) { if (node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock())) { setEnabled(false); } else { @@ -388,11 +390,18 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } } else { //当前环境为本地环境时 - setEnabled(selectedOperation.getFilePath() != null); + setEnabled(pathSupportVcsAction); } } } + private boolean pathSupportVcsAction(String path) { + if (FileExtension.CPT.matchExtension(path) || FileExtension.FRM.matchExtension(path)) { + return true; + } + return false; + } + private void closeOpenedTemplate(String path, boolean isCurrentEditing) { for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) { if (ComparatorUtils.equals(jTemplate.getEditingFILE().getPath(), path)) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 4118578de..22ffc5403 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -628,13 +628,19 @@ public abstract class JTemplate> } } - protected void addChooseFILEFilter(FILEChooserPane fileChooser){ + private void addChooseFILEFilter(FILEChooserPane fileChooser){ String appName = ProductConstants.APP_NAME; - fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); + if (FileExtension.CPT.matchExtension(this.suffix())){ + fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); + } if (FileExtension.FRM.matchExtension(this.suffix())) { // richer:form文件 daniel 改成三个字 fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); } + addExtraChooseFILEFilter(fileChooser); + } + + protected void addExtraChooseFILEFilter(FILEChooserPane fileChooser){ } 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 7c6e56bb7..7f03b6672 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -725,11 +725,9 @@ public class FILEChooserPane extends BasicPane { // ben:filefilter设置初值为cpt过滤 this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); - this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPTX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); // richer:form文件 daniel 改成三个字 this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); - this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRMX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); } else { if (type == JFileChooser.OPEN_DIALOG) { this.addChooseFILEFilter(new ChooseFileFilter(EnumSet.of(FileExtension.XLS, FileExtension.XLSX), Toolkit.i18nText("Fine-Design_Basic_Import_Excel_Source"))); 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 5ddc3b8b2..e62091048 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 + }; } - } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java index f93d473f6..b68e49e16 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java @@ -3,6 +3,7 @@ */ package com.fr.design.mainframe; +import com.fr.file.FILEChooserPane; import com.fr.main.impl.WorkBook; import com.fr.report.poly.PolyWorkSheet; @@ -44,4 +45,8 @@ public class JPolyWorkBook extends JWorkBook { public void refreshEastPropertiesPane() { EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY); } -} \ No newline at end of file + + protected void addExtraChooseFILEFilter(FILEChooserPane fileChooser) { + + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java index 713b34c54..f06a5ef2c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java @@ -671,11 +671,13 @@ public class JWorkBook extends JTemplate { // Export - MenuDef MenuDef exportMenuDef = new MenuDef(KeySetUtils.EXPORT.getMenuName()); exportMenuDef.setIconPath("/com/fr/design/images/m_file/export.png"); + addShortCut(exportMenuDef, excelExportMenuDef); + return exportMenuDef; + } + protected void addShortCut(MenuDef exportMenuDef, MenuDef excelExportMenuDef) { exportMenuDef.addShortCut(excelExportMenuDef, new PDFExportAction(this), new WordExportAction(this), new SVGExportAction(this), new CSVExportAction(this), new TextExportAction(this), new EmbeddedExportExportAction(this)); - - return exportMenuDef; } /** @@ -1169,8 +1171,7 @@ public class JWorkBook extends JTemplate { return ViewRequestConstants.REPORT_VIEW_PATH; } - protected void addChooseFILEFilter(FILEChooserPane fileChooser){ - super.addChooseFILEFilter(fileChooser); + protected void addExtraChooseFILEFilter(FILEChooserPane fileChooser){ Set providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG); for (ReportSupportedFileUIProvider provider : providers) { provider.addChooseFileFilter(fileChooser, this.suffix());