diff --git a/designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java b/designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java new file mode 100644 index 0000000000..bbc9f0ac8c --- /dev/null +++ b/designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java @@ -0,0 +1,20 @@ +package com.fr.design.fun; + +import com.fr.file.FILE; +import com.fr.stable.fun.mark.Immutable; + +/** + * 指定设计器启动时默认打开的文件 + * Created by rinoux on 2016/12/16. + */ +public interface DesignerStartOpenFileProcessor extends Immutable { + + int CURRENT_LEVEL = 1; + + String XML_TAG = "DesignerStartOpenFileProcessor"; + + /** + * 显示需要打开的报表文件 + */ + FILE fileToShow(); +} diff --git a/designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java b/designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java new file mode 100644 index 0000000000..5053b0f426 --- /dev/null +++ b/designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java @@ -0,0 +1,20 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.DesignerStartOpenFileProcessor; +import com.fr.stable.fun.mark.API; + +import static com.fr.stable.fun.mark.Layer.DEFAULT_LAYER_INDEX; + +/** + * Created by rinoux on 2016/12/16. + */ +@API(level = DesignerStartOpenFileProcessor.CURRENT_LEVEL) +public class AbstractDesignerStartOpenFileProcessor { + public int currentAPILevel() { + return DesignerStartOpenFileProcessor.CURRENT_LEVEL; + } + + public int layerIndex() { + return DEFAULT_LAYER_INDEX; + } +} diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 5af9856c28..016ad604dd 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -11,6 +11,7 @@ import com.fr.design.extra.WebDialog; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.TemplateTreePane; +import com.fr.design.fun.DesignerStartOpenFileProcessor; import com.fr.design.fun.GlobalListenerProvider; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.TemplatePane; @@ -224,6 +225,17 @@ public abstract class BaseDesigner extends ToolBarMenuDock { file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX + DesignerEnvManager.getEnvManager().getLastOpenFile()); } + + //启动时打开指定文件的接口 + DesignerStartOpenFileProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerStartOpenFileProcessor.XML_TAG); + if (processor != null) { + FILE f = processor.fileToShow(); + if (f != null) { + file = f;//避免null + } else { + isException = true;//此时有文件nullpointer异常,执行打开空文件 + } + } if (file.exists() && !isException) { df.openTemplate(file); } else {