Browse Source

Merge pull request #7 in PF/design from ~RINOUX/design:dev to dev

* commit '757e6e4d2b67941a3f9496975be470be9f2d74df':
  加入设计器启动打开文件的接口
master
superman 8 years ago
parent
commit
1b072d22dc
  1. 20
      designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java
  2. 20
      designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java
  3. 12
      designer_base/src/com/fr/start/BaseDesigner.java

20
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();
}

20
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;
}
}

12
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.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.fun.GlobalListenerProvider; import com.fr.design.fun.GlobalListenerProvider;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.TemplatePane; import com.fr.design.mainframe.TemplatePane;
@ -224,6 +225,17 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX file = FILEFactory.createFILE(FILEFactory.ENV_PREFIX
+ DesignerEnvManager.getEnvManager().getLastOpenFile()); + 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) { if (file.exists() && !isException) {
df.openTemplate(file); df.openTemplate(file);
} else { } else {

Loading…
Cancel
Save