Browse Source

fix:修改代码规范

feature/x
kerry 2 years ago
parent
commit
b682394b3e
  1. 16
      designer-base/src/main/java/com/fr/design/file/CloseOption.java
  2. 4
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  3. 4
      designer-base/src/main/java/com/fr/design/file/TemplateTabManager.java
  4. 5
      designer-base/src/main/java/com/fr/design/file/impl/AbstractTemplateTabOperate.java
  5. 4
      designer-base/src/main/java/com/fr/design/file/impl/DefaultTemplateTabOperate.java
  6. 4
      designer-base/src/main/java/com/fr/design/file/impl/EmptyTemplateTabOperator.java

16
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) {

4
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;
}

4
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() {

5
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<JTemplate<?, ?>> 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;
}

4
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

4
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

Loading…
Cancel
Save