Browse Source

REPORT-49986 【10.0.16】性能优化之阻塞EDT线程时优化 fix

feature/10.0
hades 4 years ago
parent
commit
7026cd4568
  1. 12
      designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButton.java
  2. 9
      designer-base/src/main/java/com/fr/design/gui/ibutton/UISaveForbiddenButtonUI.java

12
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();

9
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());
}
}

Loading…
Cancel
Save