Browse Source

Pull request #1654: CHART-13535 更改预定义样式之后,刷新配色面板

Merge in DESIGN/design from ~BJORN/design:release/10.0 to release/10.0

* commit 'a84c814f206e29110c1af20a34f1fed2d17a82d9':
  CHART-13535  代码质量
  CHART-13857 警戒线、趋势线默认线宽应为1px
  CHART-13535 更改预定义样式之后,刷新配色面板
feature/big-screen
Bjorn 5 years ago
parent
commit
f15543ae61
  1. 5
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  2. 21
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java
  3. 35
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java
  4. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTrendLinePane.java
  5. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java

5
designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java

@ -82,6 +82,11 @@ public class ColorSchemeComboBox extends UIComboBox {
return colorSchemes; return colorSchemes;
} }
public void refresh() {
this.colorSchemes = getColorSchemesFromConfig();
this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray()));
}
public ColorInfo getSelectColorInfo() { public ColorInfo getSelectColorInfo() {
String selectedItem = (String) getSelectedItem(); String selectedItem = (String) getSelectedItem();
return colorSchemes.get(selectedItem); return colorSchemes.get(selectedItem);

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,6 +61,20 @@ public class ChartPreStyleAction extends UpdateAction {
if (frame != null) { if (frame != null) {
frame.repaint(); frame.repaint();
} }
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(VanChartFillStylePane.name).refreshBeanElement();
}
});
} }
})); }));
} }

35
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.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; 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.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar; import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Color; import java.awt.Color;
@ -31,8 +35,9 @@ import java.awt.event.ActionListener;
/** /**
* Created by mengao on 2017/8/17. * Created by mengao on 2017/8/17.
*/ */
public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> { 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;
@ -71,6 +76,8 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
customPane.add(changeColorSetPane, BorderLayout.CENTER); customPane.add(changeColorSetPane, BorderLayout.CENTER);
initListener(); initListener();
initLayout(); initLayout();
DesignerContext.setDesignerBean(name, this);
} }
private void initListener() { private void initListener() {
@ -231,7 +238,31 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> {
def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem())); def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem()));
return def; return def;
} else { } else {
return updateDefaultColor(); return updateModifyColor();
} }
} }
private AttrFillStyle updateModifyColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo();
boolean isGradient = selectColorInfo.isGradient();
List<Color> 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);
}
} }

2
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 int PREFERRED_WIDTH = 100;
private static final double LINE_WIDTH_MIN_VALUE = 0.5; 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_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 UITextField trendLineName;
private ColorSelectBox trendLineColor; private ColorSelectBox trendLineColor;

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java

@ -47,7 +47,7 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
private static final int PREFERRED_WIDTH = 100; private static final int PREFERRED_WIDTH = 100;
private static final double LINE_WIDTH_MIN_VALUE = 0.5; 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_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; private UIButtonGroup alertAxis;
protected TinyFormulaPane alertValue; protected TinyFormulaPane alertValue;

Loading…
Cancel
Save