diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButton.java index 7e55c1b35e..7d65df421d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButton.java @@ -1,5 +1,7 @@ package com.fr.design.gui.ibutton; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.JTemplate; import javax.swing.Action; import javax.swing.Icon; import javax.swing.plaf.ButtonUI; @@ -37,6 +39,16 @@ public class UISaveForbiddenButton extends UIButton { super(resource, needSetDisabledIcon); } + @Override + public boolean isEnabled() { + JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + boolean enabled = true; + if (template != null) { + enabled = !template.isSaving(); + } + return enabled; + } + @Override public ButtonUI getUI() { return new UISaveForbiddenButtonUI(); diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButtonUI.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButtonUI.java index 7a830c39fd..47be051248 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButtonUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButtonUI.java @@ -1,7 +1,5 @@ package com.fr.design.gui.ibutton; -import com.fr.design.file.HistoryTemplateListCache; -import com.fr.design.mainframe.JTemplate; import java.awt.Graphics; import javax.swing.JComponent; @@ -15,11 +13,6 @@ public class UISaveForbiddenButtonUI extends UIButtonUI { @Override public void paint(Graphics g, JComponent c) { super.paint(g, c); - JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - boolean flag = true; - if (template != null) { - flag = !template.isSaving(); - } - c.setEnabled(flag); + c.setEnabled(c.isEnabled()); } }