Browse Source

Pull request #12500: REPORT-99959 fix: 关闭当前类型模板时,不判断其它类型模板是否保存

Merge in DESIGN/design from ~CARLSON/design:release/11.0 to release/11.0

* commit '7e37eff8a81ec70012d065fa22746b734b4ed149':
  fix: 只有选择关闭当前分类其它模板时才做类型比较 #REPORT-99959
  fix: 关闭当前类型模板时,不判断其它类型模板是否保存 #REPORT-99959
  fix: 关闭当前类型模板时,不判断其它类型模板是否保存 #REPORT-99959
newui
Carlson-洪金阳 1 year ago
parent
commit
7004199a5b
  1. 2
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  2. 19
      designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java

2
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -419,7 +419,7 @@ public class MultiTemplateTabPane extends JComponent {
public void closeOtherByOperatorType(String operatorType){
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false);
if (saveSomeTempaltePane.showSavePane()) {
if (saveSomeTempaltePane.showSavePane(null, false, true)) {
List<JTemplate<?, ?>> openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList();
JTemplate<?, ?>[] templates = new JTemplate<?, ?>[openedTemplate.size()];

19
designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java

@ -183,7 +183,19 @@ public class SaveSomeTemplatePane extends BasicPane {
* @return
*/
public boolean showSavePane(@Nullable MultiTemplateTabPane.CloseCondition option, boolean judgeJTemplateMustSave) {
initAndPopulate(option, judgeJTemplateMustSave);
return showSavePane(option, judgeJTemplateMustSave, false);
}
/**
* 显示保存模板提醒面板
*
* @param option 具体关闭操作
* @param judgeJTemplateMustSave 模板是否必须保存
* @param judgeSameTabType 是否只包含当前编辑的模板类型
* @return
*/
public boolean showSavePane(@Nullable MultiTemplateTabPane.CloseCondition option, boolean judgeJTemplateMustSave, boolean judgeSameTabType) {
initAndPopulate(option, judgeJTemplateMustSave, judgeSameTabType);
//如果有未保存的文件 ,则跳出保存对话框,选择要存储的项目
if (!unSavedTemplate.isEmpty()) {
dialog.setVisible(true);
@ -197,13 +209,16 @@ public class SaveSomeTemplatePane extends BasicPane {
return HistoryTemplateListPane.getInstance().getHistoryList();
}
private void initAndPopulate(@Nullable MultiTemplateTabPane.CloseCondition option, boolean judgeJTemplateMustSave) {
private void initAndPopulate(@Nullable MultiTemplateTabPane.CloseCondition option, boolean judgeJTemplateMustSave, boolean judgeSameTabType) {
java.util.List<JTemplate<?, ?>> opendedTemplate = getOpenedTemplatesToProcess();
JTemplate<?, ?> currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
int currentIndex = opendedTemplate.indexOf(currentTemplate);
for (int i = 0; i < opendedTemplate.size(); i++) {
//满足关闭条件的才继续判断文件是否发生了改动
boolean needClose = option == null || option.shouldClose(opendedTemplate.get(i), currentIndex, i);
if (judgeSameTabType) {
needClose &= ComparatorUtils.equals(opendedTemplate.get(i).getTemplateTabOperatorType(), currentTemplate.getTemplateTabOperatorType());
}
if (needClose && isneedToAdd(opendedTemplate.get(i), currentTemplate)) {
unSavedTemplate.add(opendedTemplate.get(i));
}

Loading…
Cancel
Save