Browse Source

REPORT-59737:修复另存为流程中出现文件默认名未xxx.cptx.cpt的bug

research/11.0
fly.li 3 years ago
parent
commit
9bdf356546
  1. 11
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java

11
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -3,6 +3,7 @@ package com.fr.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.decision.web.constant.DecCst;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -644,7 +645,7 @@ public class FILEChooserPane extends BasicPane {
this.suffix = suffix; this.suffix = suffix;
if (!text.endsWith(suffix)) { if (!text.endsWith(suffix)) {
text = text + suffix; text = removeSuffix(text) + suffix;
} }
fileNameTextField.removeDocumentListener(); fileNameTextField.removeDocumentListener();
fileNameTextField.setText(text); fileNameTextField.setText(text);
@ -660,6 +661,14 @@ public class FILEChooserPane extends BasicPane {
fileNameTextField.setFilter(new DefaultCompletionFilter(names)); fileNameTextField.setFilter(new DefaultCompletionFilter(names));
} }
/**
* 移除文件后缀的方法
* 解决cptx文件的另存为操作默认会出现双后缀的bug(xxx.cptx.cpt)
**/
private String removeSuffix(String text){
return FileExtension.CPTX.matchExtension(text) ? text.substring(0, text.length() - FileExtension.CPTX.getSuffix().length()) : text;
}
/** /**
* 打开对话框 * 打开对话框

Loading…
Cancel
Save