Browse Source

CHART-22060 fix:fvs.cpt.chart 渲染使用的默认配色和配置界面默认不同 同fvs.chart指定配色

final/11.0
shine 3 years ago
parent
commit
922fa090ad
  1. 10
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  2. 12
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  3. 9
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  4. 43
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java
  5. 66
      designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java
  6. 15
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

10
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -11,10 +11,9 @@ import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
@ -155,12 +154,7 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
} }
} }
if (!ChartEditContext.supportTheme() && chart4Update instanceof VanChart) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart4Update);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chart4Update).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
update(chart4Update); update(chart4Update);
} }

12
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -12,14 +12,13 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.hyperlink.AbstractHyperLinkPane; import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.ChartHyperEditPane; import com.fr.design.mainframe.chart.ChartHyperEditPane;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.config.DefaultStyleHelper4Van;
import java.util.HashMap;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.HashMap;
/** /**
* 类说明: 图表超链 -- 弹出 悬浮窗. * 类说明: 图表超链 -- 弹出 悬浮窗.
@ -73,12 +72,7 @@ public class ChartHyperPoplinkPane extends AbstractHyperLinkPane<ChartHyperPopli
if (chart != null) { if (chart != null) {
try { try {
ChartProvider clone = (ChartProvider) chart.clone(); ChartProvider clone = (ChartProvider) chart.clone();
if (!ChartEditContext.supportTheme() && clone instanceof VanChart) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(clone);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) clone).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
cc.addChart(clone); cc.addChart(clone);
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);

9
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -18,11 +18,11 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane; import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
@ -155,12 +155,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
addButton.addActionListener((e) -> { addButton.addActionListener((e) -> {
String name = getNewChartName(); String name = getNewChartName();
ChartProvider chart = getChangeStateNewChart(); ChartProvider chart = getChangeStateNewChart();
if (!ChartEditContext.supportTheme() && chart instanceof VanChart) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chart).setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
checkInForm(chart); checkInForm(chart);
addNewChart(chart, name, editingCollection.getChartCount()); addNewChart(chart, name, editingCollection.getChartCount());
}); });

43
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleConstants.java

@ -64,28 +64,39 @@ public class DefaultStyleConstants {
static final Background BACK = null; static final Background BACK = null;
//新特新
public static String COLOR_NAME_1;
//经典高亮
private static String COLOR_NAME_2;
static {
try {
COLOR_NAME_1 = CodeUtils.cjkDecode("\u65b0\u7279\u6027");
COLOR_NAME_2 = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae");
} catch (Exception e) {
e.printStackTrace();
}
}
static String COLORS = null; static String COLORS = null;
static { static {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance(); ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
try {
DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u7ecf\u5178\u9ad8\u4eae"); COLORS = COLOR_NAME_2;
// 没有经典高亮, 用新特性 // 没有经典高亮, 用新特性
if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { if (config.getPreStyle(COLORS) == null) {
DefaultStyleConstants.COLORS = CodeUtils.cjkDecode("\u65b0\u7279\u6027"); COLORS = COLOR_NAME_1;
} }
// 没有新特性, 用第一个配色 // 没有新特性, 用第一个配色
if (config.getPreStyle(DefaultStyleConstants.COLORS) == null) { if (config.getPreStyle(COLORS) == null) {
if (config.names().hasNext()) { if (config.names().hasNext()) {
String name = GeneralUtils.objectToString(config.names().next()); String name = GeneralUtils.objectToString(config.names().next());
if (config.getPreStyle(name) != null) { if (config.getPreStyle(name) != null) {
DefaultStyleConstants.COLORS = name; COLORS = name;
}
} }
} }
} catch (Exception e) {
e.printStackTrace();
} }
} }
} }

66
designer-chart/src/main/java/com/fr/van/chart/config/DefaultStyleHelper4Van.java

@ -1,11 +1,14 @@
package com.fr.van.chart.config; package com.fr.van.chart.config;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.chart.base.AttrBorder; import com.fr.chart.base.AttrBorder;
import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.DataSheet; import com.fr.chart.chartglyph.DataSheet;
import com.fr.chartx.attr.ChartProvider;
import com.fr.config.predefined.ColorFillStyle; import com.fr.config.predefined.ColorFillStyle;
import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.PiePlot4VanChart;
@ -19,6 +22,7 @@ import com.fr.plugin.chart.custom.type.CustomPlotType;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.plugin.chart.vanchart.VanChart;
/** /**
* @author shine * @author shine
@ -28,8 +32,27 @@ import com.fr.plugin.chart.type.GaugeStyle;
*/ */
public class DefaultStyleHelper4Van { public class DefaultStyleHelper4Van {
private static boolean duchampMode() {
try {
return ChartEditContext.duchampMode();
} catch (Throwable e) {
//tomcat预览 默认数据的图表
return true;
}
}
public static void checkChartDefaultStyle4Duchamp(ChartProvider chartProvider) {
if (!ChartEditContext.supportTheme() && chartProvider instanceof VanChart) {
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
((VanChart) chartProvider).setThemeCustom();
dealChartColor((VanChart) chartProvider);
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
}
public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) { public static void dealVanPlot4Custom(VanChartPlot plot, CustomPlotType customPlotType) {
if (!ChartEditContext.duchampMode()) { if (!duchampMode()) {
return; return;
} }
dealVanPlotCommonAttr(plot); dealVanPlotCommonAttr(plot);
@ -60,7 +83,7 @@ public class DefaultStyleHelper4Van {
} }
public static VanChartAxis dealAxisDefault(VanChartAxis axis) { public static VanChartAxis dealAxisDefault(VanChartAxis axis) {
if (!ChartEditContext.duchampMode()) { if (!duchampMode()) {
return axis; return axis;
} }
axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE); axis.getTitle().getTextAttr().setFRFont(DefaultStyleConstants.AXIS_TITLE);
@ -71,28 +94,20 @@ public class DefaultStyleHelper4Van {
} }
public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) { public static void dealAxisAlert(VanChartAlertValue vanChartAlertValue) {
if (!ChartEditContext.duchampMode()) { if (!duchampMode()) {
return; return;
} }
vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT); vanChartAlertValue.setAlertFont(DefaultStyleConstants.ALERT_FONT);
} }
static void dealVanPlotCommonAttr(Plot plot) { static void dealVanPlotCommonAttr(Plot plot) {
if (!ChartEditContext.duchampMode()) { if (!duchampMode()) {
return; return;
} }
if (plot instanceof VanChartPlot) { if (plot instanceof VanChartPlot) {
VanChartPlot vanChartPlot = (VanChartPlot) plot; VanChartPlot vanChartPlot = (VanChartPlot) plot;
ColorFillStyle colorFillStyle = new ColorFillStyle(); dealChartColor(vanChartPlot);
colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC);
colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS);
AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle();
if (plotFillStyle == null) {
plotFillStyle = new AttrFillStyle();
vanChartPlot.setPlotFillStyle(plotFillStyle);
}
plotFillStyle.setColorFillStyle(colorFillStyle);
if (vanChartPlot.getLegend() != null) { if (vanChartPlot.getLegend() != null) {
vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND); vanChartPlot.getLegend().setFRFont(DefaultStyleConstants.LEGEND);
@ -118,6 +133,31 @@ public class DefaultStyleHelper4Van {
} }
private static void dealChartColor(VanChart vanChart) {
dealChartColor(vanChart.getPlot());
}
private static void dealChartColor(VanChartPlot vanChartPlot) {
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Object preStyle = manager.getPreStyle(DefaultStyleConstants.COLORS);
if (preStyle instanceof ChartColorMatching) {
ColorFillStyle colorFillStyle = new ColorFillStyle();
//default是默认的意思,为服务器默认配色方案
//acc为多个颜色组合
//gradient为渐变颜色
colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC);
colorFillStyle.setFillStyleName(DefaultStyleConstants.COLORS);
colorFillStyle.setColorList(((ChartColorMatching) preStyle).getColorList());
AttrFillStyle plotFillStyle = vanChartPlot.getPlotFillStyle();
if (plotFillStyle == null) {
plotFillStyle = new AttrFillStyle();
vanChartPlot.setPlotFillStyle(plotFillStyle);
}
plotFillStyle.setColorFillStyle(colorFillStyle);
}
}
private static void dealBorder(VanChartPlot vanChartPlot) { private static void dealBorder(VanChartPlot vanChartPlot) {
ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr(); ConditionAttr defaultAttr = vanChartPlot.getConditionCollection().getDefaultAttr();
AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class); AttrBorder attrBorder = defaultAttr.getExisted(AttrBorder.class);

15
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -32,6 +32,7 @@ import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom; import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.van.chart.config.DefaultStyleHelper4Van;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -145,12 +146,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Van
chart.setPlot(cloneOldPlot2New(oldPlot, newPlot)); chart.setPlot(cloneOldPlot2New(oldPlot, newPlot));
resetChartAttr4SamePlot(chart); resetChartAttr4SamePlot(chart);
ChartInfoCollector.getInstance().updateChartMiniType(chart); ChartInfoCollector.getInstance().updateChartMiniType(chart);
if (!ChartEditContext.supportTheme()) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
chart.setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
} else if (!samePlot) { } else if (!samePlot) {
//不同的图表类型切換 //不同的图表类型切換
resetChartAttr(chart, newPlot); resetChartAttr(chart, newPlot);
@ -158,12 +154,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Van
newPlot.setCategoryNum(oldPlot.getCategoryNum()); newPlot.setCategoryNum(oldPlot.getCategoryNum());
//切换类型埋点 //切换类型埋点
ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID()); ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID());
if (!ChartEditContext.supportTheme()) { DefaultStyleHelper4Van.checkChartDefaultStyle4Duchamp(chart);
//主题中有的属性 界面上屏蔽不跟随主题 属性全部设置成自定义
chart.setThemeCustom();
// //主题中没有的 根据主题深浅色自动 的属性 默认自动
// ((VanChart) chart4Update).setAutoThemeCustom();
}
} }
if (!ChartEditContext.supportTheme()) { if (!ChartEditContext.supportTheme()) {
chart.setAutoThemeCustom(); chart.setAutoThemeCustom();

Loading…
Cancel
Save