Browse Source

REPORT-76098

【迭代】【起始页】起始页和空报表两个配置项均开启,点击最近使用的模板启动,没有打开对应模板
优先判断起始页,再判断老的打开方式
feature/x
Harrison 2 years ago
parent
commit
b02e8fd991
  1. 64
      designer-base/src/main/java/com/fr/start/BaseDesigner.java

64
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -38,6 +38,7 @@ import com.fr.workspace.base.WorkspaceStatus;
import java.awt.Window;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* The main class of Report Designer.
@ -143,6 +144,32 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
private boolean openFile(final DesignerFrame df, boolean isException, FILE file) {
AtomicBoolean isExWrapper = new AtomicBoolean(isException);
openTemplate(df, isExWrapper, file);
if (OperatingSystem.isMacOS()) {
enableFullScreenMode(df);
}
JTemplate<?, ?> selectedJTemplate = df.getSelectedJTemplate();
if (selectedJTemplate != null) {
selectedJTemplate.requestGridFocus();
}
return isExWrapper.get();
}
private void openTemplate(DesignerFrame df, AtomicBoolean isException, FILE file) {
// 如果是起始页启动中
if (openTemplateOnStartup(df, isException, file)) {
return;
}
openTemplate0(df, isException, file);
}
private void openTemplate0(DesignerFrame df, AtomicBoolean isException, FILE file) {
//启动时打开指定文件的接口
DesignerStartOpenFileProcessor processor = ExtraDesignClassManager.getInstance().getSingle(DesignerStartOpenFileProcessor.XML_TAG);
// 如果插件没有,且又开启了启动时打开空文件,则使用启动时打开空文件
@ -154,24 +181,20 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
if (f != null) {
file = f;//避免null
} else {
isException = true;//此时有文件nullpointer异常,执行打开空文件
isException.set(true);//此时有文件nullpointer异常,执行打开空文件
}
}
openTemplate(df, isException, file);
if (OperatingSystem.isMacOS()) {
enableFullScreenMode(df);
}
JTemplate<?, ?> selectedJTemplate = df.getSelectedJTemplate();
if (selectedJTemplate != null) {
selectedJTemplate.requestGridFocus();
if (file != null && file.exists() && !isException.get()) {
df.openTemplate(file);
} else {
df.addAndActivateJTemplate();
// 如果没有模板,则需要确认一下
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
return isException;
}
private void openTemplate(DesignerFrame df, boolean isException, FILE file) {
private boolean openTemplateOnStartup(DesignerFrame df, AtomicBoolean isException, FILE file) {
boolean onStartup = DesignerStartupContext.getInstance().isSupport();
if (onStartup) {
@ -180,27 +203,20 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
df.addAndActivateJTemplate();
// 如果没有模板,则需要确认一下
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
return;
return true;
}
if (context.isOpenLastFile()) {
if (file != null && file.exists() && !isException) {
if (file != null && file.exists() && !isException.get()) {
df.openTemplate(file);
return;
return true;
}
}
if (context.isOpenEmpty()) {
df.showEmptyJTemplate();
return;
return true;
}
}
if (file != null && file.exists() && !isException) {
df.openTemplate(file);
} else {
df.addAndActivateJTemplate();
// 如果没有模板,则需要确认一下
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
return false;
}
private void enableFullScreenMode(Window window) {

Loading…
Cancel
Save