Browse Source

Merge pull request #674 in BA/design from PF/design:dev to dev

* commit 'efbe2e4b7953e787c1f7324c2e6a59514f3794ae':
  修复错误
  加入设计器启动打开文件的接口
master
superman 8 years ago
parent
commit
385facb800
  1. 20
      designer_base/src/com/fr/design/fun/DesignerStartOpenFileProcessor.java
  2. 18
      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();
}

18
designer_base/src/com/fr/design/fun/impl/AbstractDesignerStartOpenFileProcessor.java

@ -0,0 +1,18 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.stable.fun.mark.API;
/**
* Created by rinoux on 2016/12/16.
*/
@API(level = DesignerStartOpenFileProcessor.CURRENT_LEVEL)
public abstract class AbstractDesignerStartOpenFileProcessor implements DesignerStartOpenFileProcessor {
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.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 {

Loading…
Cancel
Save