Browse Source

修改命名

feature/big-screen
kerry 5 years ago
parent
commit
be9619fc99
  1. 47
      designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java
  2. 46
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java
  3. 6
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java
  4. 6
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  5. 6
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  6. 12
      designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java
  7. 6
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

47
designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java

@ -0,0 +1,47 @@
package com.fr.design.fun;
import com.fr.decision.extension.report.ReportSupportedFileProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILEChooserPane;
import com.fr.stable.fun.mark.Mutable;
import javax.swing.Icon;
/**
* Created by kerry on 2019-10-11
*/
public interface ReportSupportedFileUIProvider extends Mutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "ReportSupportedFileUIProvider";
/**
* 向文件选择器中添加指定文件类型过滤器
* @param fileChooser 文件选择器
* @param suffix 文件后缀
*/
void addChooseFileFilter(FILEChooserPane fileChooser, String suffix);
/**
* 获取对应的新增的支持文件类型
* @return ReportTemplateFileProvider
*/
ReportSupportedFileProvider getSupportedFile();
/**
* 获取文件关联的icon
* @param path 文件路径
* @param isShowLock 是否显示被锁住
* @return 对应的图标
*/
Icon getFileIcon(String path,boolean isShowLock);
/**
* 保存为新类型文件
* @param targetPath 目标路径
* @param jTemplate 模板对象
*/
boolean saveToNewFile(String targetPath, JTemplate jTemplate);
}

46
designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java

@ -0,0 +1,46 @@
package com.fr.design.fun.impl;
import com.fr.decision.extension.report.ReportSupportedFileProvider;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILEChooserPane;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import javax.swing.Icon;
/**
* Created by kerry on 2019-10-14
*/
@API(level = ReportSupportedFileUIProvider.CURRENT_LEVEL)
public abstract class AbstractReportSupportedFileUIProvider extends AbstractProvider implements ReportSupportedFileUIProvider {
@Override
public void addChooseFileFilter(FILEChooserPane fileChooser, String suffix) {
}
@Override
public ReportSupportedFileProvider getSupportedFile() {
return null;
}
@Override
public Icon getFileIcon(String path, boolean isShowLock) {
return null;
}
@Override
public boolean saveToNewFile(String targetPath, JTemplate jTemplate) {
return false;
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

6
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java

@ -3,7 +3,7 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.NewTemplateFileOptionProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
@ -58,8 +58,8 @@ public class FileNodeConstants {
rwl.writeLock().lock(); rwl.writeLock().lock();
supportFileType = new ArrayList<String>(); supportFileType = new ArrayList<String>();
//通过插件扩展的 //通过插件扩展的
Set<NewTemplateFileOptionProvider> providers = ExtraDesignClassManager.getInstance().getArray(NewTemplateFileOptionProvider.XML_TAG); Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG);
for (NewTemplateFileOptionProvider provider : providers) { for (ReportSupportedFileUIProvider provider : providers) {
addAppExtensions(provider.getSupportedFile().getFileExtensions()); addAppExtensions(provider.getSupportedFile().getFileExtensions());
} }
supportFileType.addAll(Arrays.asList(FRContext.getFileNodes().getSupportedTypes())); supportFileType.addAll(Arrays.asList(FRContext.getFileNodes().getSupportedTypes()));

6
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java

@ -3,7 +3,7 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.icon.LockIcon; import com.fr.design.icon.LockIcon;
import com.fr.design.fun.NewTemplateFileOptionProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -176,8 +176,8 @@ public class FileTreeIcon {
} }
private static Icon getExtraIcon(String path, boolean isShowLock) { private static Icon getExtraIcon(String path, boolean isShowLock) {
Set<NewTemplateFileOptionProvider> providers = ExtraDesignClassManager.getInstance().getArray(NewTemplateFileOptionProvider.XML_TAG); Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG);
for (NewTemplateFileOptionProvider provider : providers) { for (ReportSupportedFileUIProvider provider : providers) {
if (provider.getFileIcon(path, isShowLock) != null) { if (provider.getFileIcon(path, isShowLock) != null) {
return provider.getFileIcon(path, isShowLock); return provider.getFileIcon(path, isShowLock);
} }

6
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -27,7 +27,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.NewTemplateFileOptionProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
@ -658,8 +658,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
protected boolean saveToNewFile(String oldName){ protected boolean saveToNewFile(String oldName){
boolean result = false; boolean result = false;
Set<NewTemplateFileOptionProvider> providers = ExtraDesignClassManager.getInstance().getArray(NewTemplateFileOptionProvider.XML_TAG); Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG);
for (NewTemplateFileOptionProvider provider : providers) { for (ReportSupportedFileUIProvider provider : providers) {
result = result || provider.saveToNewFile(this.editingFILE.getPath(), this); result = result || provider.saveToNewFile(this.editingFILE.getPath(), this);
} }
if(!result && FileExtension.CPT.matchExtension(this.editingFILE.getPath())){ if(!result && FileExtension.CPT.matchExtension(this.editingFILE.getPath())){

12
designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java

@ -3,8 +3,8 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.decision.extension.report.ReportSupportedFileProvider; import com.fr.decision.extension.report.ReportSupportedFileProvider;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.NewTemplateFileOptionProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.fun.impl.AbstractNewTemplateFileOptionProvider; import com.fr.design.fun.impl.AbstractReportSupportedFileUIProvider;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
import org.easymock.EasyMock; import org.easymock.EasyMock;
import org.junit.Assert; import org.junit.Assert;
@ -25,8 +25,8 @@ public class FileNodeConstantsTest {
@Test @Test
public void supportFileTypesTest() { public void supportFileTypesTest() {
ExtraDesignClassManager extra = mockExtraDesignClassManager(); ExtraDesignClassManager extra = mockExtraDesignClassManager();
Assert.assertEquals(1, extra.getArray(NewTemplateFileOptionProvider.XML_TAG).size()); Assert.assertEquals(1, extra.getArray(ReportSupportedFileUIProvider.XML_TAG).size());
NewTemplateFileOptionProvider option = (NewTemplateFileOptionProvider) extra.getArray(NewTemplateFileOptionProvider.XML_TAG).iterator().next(); ReportSupportedFileUIProvider option = (ReportSupportedFileUIProvider) extra.getArray(ReportSupportedFileUIProvider.XML_TAG).iterator().next();
Assert.assertEquals(FileExtension.CPTX, option.getSupportedFile().getFileExtensions()[0]); Assert.assertEquals(FileExtension.CPTX, option.getSupportedFile().getFileExtensions()[0]);
} }
@ -46,12 +46,12 @@ public class FileNodeConstantsTest {
Set<Mutable> options = new HashSet<Mutable>() {{ Set<Mutable> options = new HashSet<Mutable>() {{
add(new MockNewTemplateFileOption()); add(new MockNewTemplateFileOption());
}}; }};
EasyMock.expect(extra.getArray(NewTemplateFileOptionProvider.XML_TAG)).andReturn(options).anyTimes(); EasyMock.expect(extra.getArray(ReportSupportedFileUIProvider.XML_TAG)).andReturn(options).anyTimes();
EasyMock.replay(extra); EasyMock.replay(extra);
return extra; return extra;
} }
private class MockNewTemplateFileOption extends AbstractNewTemplateFileOptionProvider { private class MockNewTemplateFileOption extends AbstractReportSupportedFileUIProvider {
@Override @Override
public ReportSupportedFileProvider getSupportedFile() { public ReportSupportedFileProvider getSupportedFile() {

6
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -34,7 +34,7 @@ import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.NewTemplateFileOptionProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
@ -1171,8 +1171,8 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
protected void addChooseFILEFilter(FILEChooserPane fileChooser){ protected void addChooseFILEFilter(FILEChooserPane fileChooser){
super.addChooseFILEFilter(fileChooser); super.addChooseFILEFilter(fileChooser);
Set<NewTemplateFileOptionProvider> providers = ExtraDesignClassManager.getInstance().getArray(NewTemplateFileOptionProvider.XML_TAG); Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG);
for (NewTemplateFileOptionProvider provider : providers) { for (ReportSupportedFileUIProvider provider : providers) {
provider.addChooseFileFilter(fileChooser, this.suffix()); provider.addChooseFileFilter(fileChooser, this.suffix());
} }
} }

Loading…
Cancel
Save