Browse Source

CHART-13535 代码质量

feature/big-screen
白岳 5 years ago
parent
commit
a84c814f20
  1. 21
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java
  2. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

21
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java

@ -1,6 +1,7 @@
package com.fr.design.module; package com.fr.design.module;
import com.fr.base.ChartPreStyleConfig; import com.fr.base.ChartPreStyleConfig;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -8,11 +9,14 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.module.ModuleContext;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade; import com.fr.transaction.WorkerFacade;
import com.fr.van.chart.designer.component.VanChartFillStylePane;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import java.util.concurrent.ExecutorService;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
/** /**
@ -22,6 +26,9 @@ import java.awt.event.ActionEvent;
*/ */
public class ChartPreStyleAction extends UpdateAction { public class ChartPreStyleAction extends UpdateAction {
private static ExecutorService refreshDesignPool = ModuleContext.getExecutor().newFixedThreadPool(
10, new NamedThreadFactory("refreshChartStylePane"));
public ChartPreStyleAction() { public ChartPreStyleAction() {
this.setMenuKeySet(CHART_DEFAULT_STYLE); this.setMenuKeySet(CHART_DEFAULT_STYLE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
@ -54,12 +61,20 @@ public class ChartPreStyleAction extends UpdateAction {
if (frame != null) { if (frame != null) {
frame.repaint(); frame.repaint();
} }
new Thread() { if (refreshDesignPool.isTerminated()) {
synchronized (refreshDesignPool) {
if (refreshDesignPool.isTerminated()) {
refreshDesignPool = ModuleContext.getExecutor().newFixedThreadPool(
10, new NamedThreadFactory("refreshChartStylePane"));
}
}
}
refreshDesignPool.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
DesignerContext.getDesignerBean("vanChartFillStyle").refreshBeanElement(); DesignerContext.getDesignerBean(VanChartFillStylePane.name).refreshBeanElement();
} }
}.start(); });
} }
})); }));
} }

5
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

@ -37,6 +37,7 @@ import java.awt.event.ActionListener;
*/ */
public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> implements DesignerBean { public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> implements DesignerBean {
public static final String name = "vanChartFillStyle";
protected ColorSchemeComboBox styleSelectBox; protected ColorSchemeComboBox styleSelectBox;
protected JPanel customPane; protected JPanel customPane;
@ -75,6 +76,8 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> implemen
customPane.add(changeColorSetPane, BorderLayout.CENTER); customPane.add(changeColorSetPane, BorderLayout.CENTER);
initListener(); initListener();
initLayout(); initLayout();
DesignerContext.setDesignerBean(name, this);
} }
private void initListener() { private void initListener() {
@ -128,8 +131,6 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> implemen
VanChartFillStylePane.this.revalidate(); VanChartFillStylePane.this.revalidate();
} }
}); });
DesignerContext.setDesignerBean("vanChartFillStyle", this);
} }
protected void initLayout() { protected void initLayout() {

Loading…
Cancel
Save