From 92f454fb39d70489181093a71bf1756ea1555abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 12 May 2020 14:15:03 +0800 Subject: [PATCH 1/3] =?UTF-8?q?CHART-13535=20=E6=9B=B4=E6=94=B9=E9=A2=84?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F=E4=B9=8B=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E9=85=8D=E8=89=B2=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../combobox/ColorSchemeComboBox.java | 5 +++ .../fr/design/module/ChartPreStyleAction.java | 8 ++++- .../component/VanChartFillStylePane.java | 34 +++++++++++++++++-- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java index 4358a728d..db59179a3 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java @@ -82,6 +82,11 @@ public class ColorSchemeComboBox extends UIComboBox { return colorSchemes; } + public void refresh() { + this.colorSchemes = getColorSchemesFromConfig(); + this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray())); + } + public ColorInfo getSelectColorInfo() { String selectedItem = (String) getSelectedItem(); return colorSchemes.get(selectedItem); 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 e0dbd8ba0..2efe12ca1 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 @@ -54,6 +54,12 @@ public class ChartPreStyleAction extends UpdateAction { if (frame != null) { frame.repaint(); } + new Thread() { + @Override + public void run() { + DesignerContext.getDesignerBean("vanChartFillStyle").refreshBeanElement(); + } + }.start(); } })); } @@ -61,7 +67,7 @@ public class ChartPreStyleAction extends UpdateAction { pane.populateBean(); dialog.setVisible(true); - + } public static final MenuKeySet CHART_DEFAULT_STYLE = new MenuKeySet() { 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 63c24a221..be40fd59a 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 @@ -13,13 +13,17 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; +import com.fr.design.mainframe.DesignerBean; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane; import com.fr.design.style.background.gradient.FixedGradientBar; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import javax.swing.BorderFactory; import javax.swing.JPanel; +import java.util.List; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; @@ -31,7 +35,7 @@ import java.awt.event.ActionListener; /** * Created by mengao on 2017/8/17. */ -public class VanChartFillStylePane extends BasicBeanPane { +public class VanChartFillStylePane extends BasicBeanPane implements DesignerBean { protected ColorSchemeComboBox styleSelectBox; @@ -124,6 +128,8 @@ public class VanChartFillStylePane extends BasicBeanPane { VanChartFillStylePane.this.revalidate(); } }); + + DesignerContext.setDesignerBean("vanChartFillStyle", this); } protected void initLayout() { @@ -231,7 +237,31 @@ public class VanChartFillStylePane extends BasicBeanPane { def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem())); return def; } else { - return updateDefaultColor(); + return updateModifyColor(); } } + + private AttrFillStyle updateModifyColor() { + AttrFillStyle condition = new AttrFillStyle(); + condition.clearColors(); + ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo(); + boolean isGradient = selectColorInfo.isGradient(); + List colors = selectColorInfo.getColors(); + condition.setColorList(colors); + condition.setCustomFillStyle(true); + condition.setColorStyle(isGradient ? ChartConstants.COLOR_GRADIENT : ChartConstants.COLOR_ACC); + return condition; + } + + /** + * 刷新组件对象 + */ + public void refreshBeanElement() { + AttrFillStyle attrFillStyle = updateBean(); + + styleSelectBox.refresh(); + + populateBean(attrFillStyle); + GUICoreUtils.repaint(this); + } } From 7d04bddf9459a58c28ce93ba91fa87977ab9e75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 12 May 2020 16:44:40 +0800 Subject: [PATCH 2/3] =?UTF-8?q?CHART-13857=20=E8=AD=A6=E6=88=92=E7=BA=BF?= =?UTF-8?q?=E3=80=81=E8=B6=8B=E5=8A=BF=E7=BA=BF=E9=BB=98=E8=AE=A4=E7=BA=BF?= =?UTF-8?q?=E5=AE=BD=E5=BA=94=E4=B8=BA1px?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/van/chart/designer/component/VanChartTrendLinePane.java | 2 +- .../chart/designer/style/background/VanChartAlertValuePane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java index 8f6d3456f..eb8bd0f16 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java @@ -35,7 +35,7 @@ public class VanChartTrendLinePane extends BasicPane{ private static final int PREFERRED_WIDTH = 100; private static final double LINE_WIDTH_MIN_VALUE = 0.5; private static final double LINE_WIDTH_DIERTA_VALUE = 0.5; - private static final double LINE_WIDTH_DEFAULT_VALUE = 2; + private static final double LINE_WIDTH_DEFAULT_VALUE = 1; private UITextField trendLineName; private ColorSelectBox trendLineColor; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java index 6f88e586c..85aff8362 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java @@ -47,7 +47,7 @@ public class VanChartAlertValuePane extends BasicBeanPane { private static final int PREFERRED_WIDTH = 100; private static final double LINE_WIDTH_MIN_VALUE = 0.5; private static final double LINE_WIDTH_DIERTA_VALUE = 0.5; - private static final double LINE_WIDTH_DEFAULT_VALUE = 2; + private static final double LINE_WIDTH_DEFAULT_VALUE = 1; private UIButtonGroup alertAxis; protected TinyFormulaPane alertValue; From a84c814f206e29110c1af20a34f1fed2d17a82d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Tue, 12 May 2020 17:32:20 +0800 Subject: [PATCH 3/3] =?UTF-8?q?CHART-13535=20=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/module/ChartPreStyleAction.java | 25 +++++++++++++++---- .../component/VanChartFillStylePane.java | 5 ++-- 2 files changed, 23 insertions(+), 7 deletions(-) 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 2efe12ca1..5d7a9e67d 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 be40fd59a..7173f9678 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() {