diff --git a/designer-base/src/main/java/com/fr/design/file/CloseOption.java b/designer-base/src/main/java/com/fr/design/file/CloseOption.java index 79667dec0f..ecb70d6a5f 100644 --- a/designer-base/src/main/java/com/fr/design/file/CloseOption.java +++ b/designer-base/src/main/java/com/fr/design/file/CloseOption.java @@ -8,6 +8,10 @@ import com.fr.design.i18n.Toolkit; * created on 2023-04-14 **/ public enum CloseOption { + + /** + * 关闭左侧所有模板 + */ Left(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Left")) { @Override public boolean shouldClose(int tplIndex, int i) { @@ -15,14 +19,24 @@ public enum CloseOption { } }, + /** + * 关闭右侧所有模板 + */ Right(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Right")) { @Override public boolean shouldClose(int tplIndex, int i) { return i > tplIndex; } + }, - }, All(Toolkit.i18nText("Fine-Design_Close_All_templates")), + /** + * 关闭所有模板 + */ + All(Toolkit.i18nText("Fine-Design_Close_All_templates")), + /** + * 关闭其他模板 + */ Others(Toolkit.i18nText("Fine-Design_Close_Other_templates")) { @Override public boolean shouldClose(int tplIndex, int i) { diff --git a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java index efc4565e00..0fd4bdecf9 100644 --- a/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java @@ -402,8 +402,8 @@ public class MultiTemplateTabPane extends JComponent { if (template.isSaving()) { selectedIcon = GREY_SAVING_CLOSE_ICON; } - boolean isLeft = i < TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex(); - startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, isLeft, mouseOveredIndex, i); + boolean left = i < TemplateTabManager.getInstance().getCurrentOperator().getSelectIndex(); + startX[i - minPaintIndex] = paintUnSelectedTab(g2d, icon, templateStartX, name, selectedIcon, left, mouseOveredIndex, i); } templateStartX += realWidth; } diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java index da151d9b0f..f7fb354b3f 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java @@ -18,7 +18,7 @@ import java.util.Map; * created on 2023-04-14 **/ public class TemplateTabManager { - private static class HOLDER { + private static class Holder { private static final TemplateTabManager SINGLETON = new TemplateTabManager(); } @@ -27,7 +27,7 @@ public class TemplateTabManager { * @return */ public static TemplateTabManager getInstance() { - return HOLDER.SINGLETON; + return Holder.SINGLETON; } private TemplateTabManager() { diff --git a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java index e42b336f57..1f089c5773 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java @@ -40,6 +40,7 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE; * created on 2023-04-14 **/ public abstract class AbstractTemplateTabOperate implements TemplateTabOperateProvider { + private static final String UNSAVED_SUFFIX = " *"; //用于存放工作簿 private java.util.List> openedTemplate = new ArrayList<>(); //选中的Tab项 @@ -345,8 +346,8 @@ public abstract class AbstractTemplateTabOperate implements TemplateTabOperatePr @Override public String getTemplateShowName(JTemplate template) { String name = TemplateUtils.createLockeTemplatedName(template, template.getTemplateName()); - if (!template.isSaved() && !name.endsWith(" *")) { - name += " *"; + if (!template.isSaved() && !name.endsWith(UNSAVED_SUFFIX)) { + name += UNSAVED_SUFFIX; } return name; } diff --git a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java index ae8ea292a9..1dec669cc4 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java @@ -11,7 +11,7 @@ public class DefaultTemplateTabOperate extends AbstractTemplateTabOperate { public static final String OPERATOR_TYPE = "DEFAULT_TEMPLATE_TAB_OPERATOR"; - private static class HOLDER { + private static class Holder { private static final DefaultTemplateTabOperate SINGLETON = new DefaultTemplateTabOperate(); } @@ -24,7 +24,7 @@ public class DefaultTemplateTabOperate extends AbstractTemplateTabOperate { * @return */ public static DefaultTemplateTabOperate getInstance() { - return HOLDER.SINGLETON; + return Holder.SINGLETON; } @Override diff --git a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java index 4afe59f16b..f5e2b93d5b 100644 --- a/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java +++ b/designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java @@ -15,7 +15,7 @@ import java.util.List; * created on 2023-04-14 **/ public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { - private static class HOLDER { + private static class Holder { private static final EmptyTemplateTabOperator SINGLETON = new EmptyTemplateTabOperator(); } @@ -29,7 +29,7 @@ public class EmptyTemplateTabOperator implements TemplateTabOperateProvider { * @return */ public static EmptyTemplateTabOperator getInstance() { - return HOLDER.SINGLETON; + return Holder.SINGLETON; } @Override