From 7482b3f9e6f06bbadfce85a6721dc820fa9d3a7b Mon Sep 17 00:00:00 2001 From: rinoux Date: Fri, 16 Dec 2016 16:22:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=89=93=E5=BC=80=E6=96=87=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/DesignerStartOpenFileProcessor.java | 20 +++++++++++++++++++ ...bstractDesignerStartOpenFileProcessor.java | 20 +++++++++++++++++++ .../src/com/fr/start/BaseDesigner.java | 12 +++++++++++ 3 files changed, 52 insertions(+) create mode 100644 designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java create mode 100644 designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java 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 {