|
|
|
@ -45,7 +45,7 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr
|
|
|
|
|
//用于存放工作簿
|
|
|
|
|
private java.util.List<JTemplate<?, ?>> openedTemplate = new ArrayList<>(); |
|
|
|
|
//选中的Tab项
|
|
|
|
|
private int selectedIndex = -1; |
|
|
|
|
private int selectedIndex = 0; |
|
|
|
|
|
|
|
|
|
public AbstractTemplateTabOperate() { |
|
|
|
|
|
|
|
|
@ -257,9 +257,10 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void closeTpl(@Nonnull JTemplate<?, ?> specifiedTemplate) { |
|
|
|
|
JTemplate currentSelectedFile = getSelectedFile(); |
|
|
|
|
HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); |
|
|
|
|
closeAndFreeLock(specifiedTemplate); |
|
|
|
|
activePrevTemplateAfterClose(specifiedTemplate == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); |
|
|
|
|
activePrevTemplateAfterClose(specifiedTemplate == currentSelectedFile, currentSelectedFile); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -270,12 +271,24 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr
|
|
|
|
|
activePrevTemplateAfterClose(TemplateTabManager.getInstance().isCloseCurrent()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 关闭掉一个模板之后激活新的待显示模板 |
|
|
|
|
*/ |
|
|
|
|
public void activePrevTemplateAfterClose(boolean isCurrentSelectedTpl) { |
|
|
|
|
activePrevTemplateAfterClose(isCurrentSelectedTpl, HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 关闭掉一个模板之后激活新的待显示模板 |
|
|
|
|
*/ |
|
|
|
|
public void activePrevTemplateAfterClose(boolean isCurrentSelectedTpl, JTemplate currentSelectedJTemplate) { |
|
|
|
|
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
|
|
|
|
boolean couldSwitch = template != null && this.accept(template.getTemplateTabOperatorType()); |
|
|
|
|
if (openedTemplate.isEmpty()) { |
|
|
|
|
TemplateTabManager.getInstance().activeNewTemplate(); |
|
|
|
|
if (couldSwitch){ |
|
|
|
|
TemplateTabManager.getInstance().activeNewTemplate(); |
|
|
|
|
} |
|
|
|
|
selectedIndex = 0; |
|
|
|
|
} else { |
|
|
|
|
// 如果关闭的模板是当前选中的模板,则重新激活当前 selectIndex 的模板;
|
|
|
|
@ -290,10 +303,9 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr
|
|
|
|
|
} |
|
|
|
|
// 如果关闭的模板不是当前选中的模板,那么重新获取一下当前模板的 index,激活该 index
|
|
|
|
|
else { |
|
|
|
|
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
|
|
|
|
selectedIndex = this.openedTemplate.indexOf(template); |
|
|
|
|
selectedIndex = this.openedTemplate.indexOf(currentSelectedJTemplate); |
|
|
|
|
} |
|
|
|
|
if (selectedIndex < openedTemplate.size()) { |
|
|
|
|
if ( selectedIndex < openedTemplate.size() && couldSwitch) { |
|
|
|
|
//如果是已后台关闭的模板,则重新打开文件
|
|
|
|
|
openedTemplate.get(selectedIndex).activeOldJTemplate(); |
|
|
|
|
} |
|
|
|
|