diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java index 2efe12ca16..5d7a9e67d7 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java @@ -1,6 +1,7 @@ package com.fr.design.module; import com.fr.base.ChartPreStyleConfig; +import com.fr.concurrent.NamedThreadFactory; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; 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.menu.MenuKeySet; import com.fr.general.IOUtils; +import com.fr.module.ModuleContext; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; +import com.fr.van.chart.designer.component.VanChartFillStylePane; import javax.swing.KeyStroke; +import java.util.concurrent.ExecutorService; import java.awt.event.ActionEvent; /** @@ -22,6 +26,9 @@ import java.awt.event.ActionEvent; */ public class ChartPreStyleAction extends UpdateAction { + private static ExecutorService refreshDesignPool = ModuleContext.getExecutor().newFixedThreadPool( + 10, new NamedThreadFactory("refreshChartStylePane")); + public ChartPreStyleAction() { this.setMenuKeySet(CHART_DEFAULT_STYLE); this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); @@ -54,12 +61,20 @@ public class ChartPreStyleAction extends UpdateAction { if (frame != null) { frame.repaint(); } - new Thread() { - @Override + if (refreshDesignPool.isTerminated()) { + synchronized (refreshDesignPool) { + if (refreshDesignPool.isTerminated()) { + refreshDesignPool = ModuleContext.getExecutor().newFixedThreadPool( + 10, new NamedThreadFactory("refreshChartStylePane")); + } + } + } + refreshDesignPool.execute(new Runnable() { + @Override public void run() { - DesignerContext.getDesignerBean("vanChartFillStyle").refreshBeanElement(); - } - }.start(); + DesignerContext.getDesignerBean(VanChartFillStylePane.name).refreshBeanElement(); + } + }); } })); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java index be40fd59a9..7173f9678f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java +++ b/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 implements DesignerBean { + public static final String name = "vanChartFillStyle"; protected ColorSchemeComboBox styleSelectBox; protected JPanel customPane; @@ -75,6 +76,8 @@ public class VanChartFillStylePane extends BasicBeanPane implemen customPane.add(changeColorSetPane, BorderLayout.CENTER); initListener(); initLayout(); + DesignerContext.setDesignerBean(name, this); + } private void initListener() { @@ -128,8 +131,6 @@ public class VanChartFillStylePane extends BasicBeanPane implemen VanChartFillStylePane.this.revalidate(); } }); - - DesignerContext.setDesignerBean("vanChartFillStyle", this); } protected void initLayout() {