Browse Source

Pull request #2475: CHART-15566 图表预定义样式

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

* commit '303c0483786c7cb68148400a849c1e0b65a2b369':
  CHART-15566 代码质量
  CHART-15566 图表预定义样式面板
persist/11.0
Bjorn 4 years ago
parent
commit
b3edfd17b6
  1. 47
      designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java
  2. 4
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/VanChartGradientPane.java
  3. 17
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java
  4. 94
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ChartStyleSettingPane.java
  5. 292
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java
  6. 49
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/AbstractChartStylePane.java
  7. 69
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartAxisStylePane.java
  8. 113
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartBackgroundStylePane.java
  9. 58
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartDataSheetStylePane.java
  10. 160
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartFontPane.java
  11. 78
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartLabelStylePane.java
  12. 49
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartLegendStylePane.java
  13. 49
      designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java
  14. 12
      designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java
  15. 3
      designer-base/src/main/java/com/fr/design/style/color/ColorButton.java
  16. 97
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java
  17. 88
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java
  18. 10
      designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java
  19. 2
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java
  20. 2
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java
  21. 12
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java
  22. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  23. 244
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java
  24. 25
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  25. 41
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java
  26. 49
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java
  27. 51
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java
  28. 1
      designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java
  29. 134
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java
  30. 57
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPaneWithPreStyle.java
  31. 18
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java
  32. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java
  33. 1
      designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartLabelConditionPane.java
  34. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java
  35. 25
      designer-chart/src/main/java/com/fr/van/chart/designer/style/MapRangeLegendPane.java
  36. 18
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  37. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  38. 27
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  39. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java
  40. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarXAxisPane.java
  41. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java
  42. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java
  43. 25
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java
  44. 58
      designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java
  45. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanchartDataSheetNoCheckPane.java
  46. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java
  47. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  48. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  49. 18
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  50. 1
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java
  51. 99
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  52. 65
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java
  53. 6
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java
  54. 2
      designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelPane.java

47
designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java → designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java

@ -1,11 +1,9 @@
package com.fr.design.chartx.component.combobox; package com.fr.design.gui.icombobox;
import com.fr.base.ChartColorMatching; import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig; import com.fr.base.ChartPreStyleConfig;
import com.fr.cert.token.lang.Collections; import com.fr.cert.token.lang.Collections;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
@ -36,11 +34,18 @@ public class ColorSchemeComboBox extends UIComboBox {
private Map<String, ColorInfo> colorSchemes; private Map<String, ColorInfo> colorSchemes;
private boolean preDefined;
public ColorSchemeComboBox() { public ColorSchemeComboBox() {
this(null); this(null, false);
} }
public ColorSchemeComboBox(Map<String, ColorInfo> colorSchemes) { public ColorSchemeComboBox(Map<String, ColorInfo> colorSchemes) {
this(colorSchemes, false);
}
public ColorSchemeComboBox(Map<String, ColorInfo> colorSchemes, boolean preDefined) {
this.preDefined = preDefined;
//通过配色方案的集合初始化下拉控件,如果参数为null,从配置中读取配色方案。 //通过配色方案的集合初始化下拉控件,如果参数为null,从配置中读取配色方案。
if (colorSchemes == null) { if (colorSchemes == null) {
colorSchemes = getColorSchemesFromConfig(); colorSchemes = getColorSchemesFromConfig();
@ -59,22 +64,26 @@ public class ColorSchemeComboBox extends UIComboBox {
//所有的样式名称 //所有的样式名称
Iterator names = config.names(); Iterator names = config.names();
//添加默认的方案和第一个方案 if (preDefined) {
String defaultName = config.getCurrentStyle(); colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Predefined"), null);
ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName);
if (names.hasNext()) {
Object firstName = names.next();
ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName);
if (defaultStyle == null) {
defaultStyle = firstStyle;
}
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle));
colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle));
} else { } else {
ColorInfo colorInfo = new ColorInfo(); //添加默认的方案和第一个方案
colorInfo.setGradient(false); String defaultName = config.getCurrentStyle();
colorInfo.setColors(Collections.arrayToList(ChartConstants.CHART_COLOR_ARRAY)); ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName);
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorInfo); if (names.hasNext()) {
Object firstName = names.next();
ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName);
if (defaultStyle == null) {
defaultStyle = firstStyle;
}
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle));
colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle));
} else {
ColorInfo colorInfo = new ColorInfo();
colorInfo.setGradient(false);
colorInfo.setColors(Collections.arrayToList(ChartConstants.CHART_COLOR_ARRAY));
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorInfo);
}
} }
//添加其他的配色方案 //添加其他的配色方案

4
designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartGradientPane.java → designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/VanChartGradientPane.java

@ -1,4 +1,4 @@
package com.fr.van.chart.designer.component.background; package com.fr.design.mainframe.backgroundpane;
import com.fr.base.background.GradientBackground; import com.fr.base.background.GradientBackground;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
@ -6,11 +6,9 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.design.style.background.gradient.FixedGradientBar; import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.general.Background; import com.fr.general.Background;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;

17
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java

@ -1,8 +1,8 @@
package com.fr.design.mainframe.predefined.ui; package com.fr.design.mainframe.predefined.ui;
import com.fr.config.ServerPreferenceConfig;
import com.fr.config.predefined.PredefinedStyle; import com.fr.config.predefined.PredefinedStyle;
import com.fr.config.predefined.PredefinedStyleConfig; import com.fr.config.predefined.PredefinedStyleConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
@ -11,9 +11,11 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.predefined.ui.detail.PredefinedBackgroundSettingPane;
import com.fr.design.mainframe.predefined.ui.detail.CellStyleSettingPane; import com.fr.design.mainframe.predefined.ui.detail.CellStyleSettingPane;
import com.fr.design.mainframe.predefined.ui.detail.ChartStyleSettingPane;
import com.fr.design.mainframe.predefined.ui.detail.ColorFillStylePane;
import com.fr.design.mainframe.predefined.ui.detail.ComponentStyleSettingPane; import com.fr.design.mainframe.predefined.ui.detail.ComponentStyleSettingPane;
import com.fr.design.mainframe.predefined.ui.detail.PredefinedBackgroundSettingPane;
import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane; import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -36,7 +38,9 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
private PredefinedBackgroundSettingPane backgroundSettingPane; private PredefinedBackgroundSettingPane backgroundSettingPane;
private CellStyleSettingPane cellStyleSettingPane; private CellStyleSettingPane cellStyleSettingPane;
private ComponentStyleSettingPane componentStyleSettingPane; private ComponentStyleSettingPane componentStyleSettingPane;
private ChartStyleSettingPane chartStyleSettingPane;
private PredefinedStyleSelectPane selectPane; private PredefinedStyleSelectPane selectPane;
private ColorFillStylePane colorFillStylePane;
private boolean isPopulating = false; private boolean isPopulating = false;
private UITabbedPane uiTabbedPane; private UITabbedPane uiTabbedPane;
@ -118,6 +122,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel titlePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Basic_Setting")); JPanel titlePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Basic_Setting"));
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
colorFillStylePane = new ColorFillStylePane();
contentPane.add(colorFillStylePane);
titlePane.add(contentPane); titlePane.add(contentPane);
jPanel.add(titlePane, BorderLayout.CENTER); jPanel.add(titlePane, BorderLayout.CENTER);
titlePane.setSize(new Dimension(348, 157)); titlePane.setSize(new Dimension(348, 157));
@ -170,7 +176,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
private JPanel createChartStyleSettingPane() { private JPanel createChartStyleSettingPane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); jPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));
jPanel.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Chart_Style"))); this.chartStyleSettingPane = new ChartStyleSettingPane();
jPanel.add(this.chartStyleSettingPane);
return jPanel; return jPanel;
} }
@ -190,6 +197,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
this.backgroundSettingPane.populateBean(previewObject.getPredefinedBackground()); this.backgroundSettingPane.populateBean(previewObject.getPredefinedBackground());
this.cellStyleSettingPane.populateBean(previewObject.getCellStyleConfig()); this.cellStyleSettingPane.populateBean(previewObject.getCellStyleConfig());
this.componentStyleSettingPane.populateBean(previewObject.getComponentStyle()); this.componentStyleSettingPane.populateBean(previewObject.getComponentStyle());
this.colorFillStylePane.populateBean(previewObject.getPredefinedColorStyle());
this.chartStyleSettingPane.populateBean(previewObject.getPredefinedChartStyle());
previewPane.refresh(previewObject); previewPane.refresh(previewObject);
isPopulating = false; isPopulating = false;
} }
@ -200,6 +209,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
predefinedStyle.setCellStyleConfig(this.cellStyleSettingPane.updateBean()); predefinedStyle.setCellStyleConfig(this.cellStyleSettingPane.updateBean());
predefinedStyle.setPredefinedBackground(this.backgroundSettingPane.updateBean()); predefinedStyle.setPredefinedBackground(this.backgroundSettingPane.updateBean());
predefinedStyle.setComponentStyle(this.componentStyleSettingPane.updateBean()); predefinedStyle.setComponentStyle(this.componentStyleSettingPane.updateBean());
predefinedStyle.setPredefinedColorStyle(this.colorFillStylePane.update());
predefinedStyle.setPredefinedChartStyle(this.chartStyleSettingPane.updateBean());
return predefinedStyle; return predefinedStyle;
} }

94
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ChartStyleSettingPane.java

@ -0,0 +1,94 @@
package com.fr.design.mainframe.predefined.ui.detail;
import com.fr.config.predefined.PredefinedChartStyle;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.MultiTabPane;
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartAxisStylePane;
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartBackgroundStylePane;
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartDataSheetStylePane;
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartLabelStylePane;
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartLegendStylePane;
import com.fr.design.mainframe.predefined.ui.detail.chart.ChartTitleStylePane;
import java.util.ArrayList;
import java.util.List;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-16
*/
public class ChartStyleSettingPane extends MultiTabPane<PredefinedChartStyle> {
private ChartTitleStylePane chartTitleStylePane;
private ChartLegendStylePane chartLegendStylePane;
private ChartLabelStylePane chartLabelPane;
private ChartAxisStylePane chartAxisStylePane;
private ChartDataSheetStylePane chartDataSheetStylePane;
private ChartBackgroundStylePane chartBackgroundStylePane;
public ChartStyleSettingPane() {
}
@Override
protected void initLayout() {
super.initLayout();
}
@Override
protected List<BasicPane> initPaneList() {
this.chartTitleStylePane = new ChartTitleStylePane();
this.chartLegendStylePane = new ChartLegendStylePane();
this.chartLabelPane = new ChartLabelStylePane();
this.chartAxisStylePane = new ChartAxisStylePane();
this.chartDataSheetStylePane = new ChartDataSheetStylePane();
this.chartBackgroundStylePane = new ChartBackgroundStylePane();
paneList = new ArrayList<>();
paneList.add(this.chartTitleStylePane);
paneList.add(this.chartLegendStylePane);
paneList.add(this.chartLabelPane);
paneList.add(this.chartAxisStylePane);
paneList.add(this.chartDataSheetStylePane);
paneList.add(this.chartBackgroundStylePane);
return paneList;
}
@Override
public void populateBean(PredefinedChartStyle ob) {
chartTitleStylePane.populate(ob);
chartLegendStylePane.populate(ob);
chartLabelPane.populate(ob);
chartAxisStylePane.populate(ob);
chartDataSheetStylePane.populate(ob);
chartBackgroundStylePane.populate(ob);
}
@Override
public void updateBean(PredefinedChartStyle ob) {
}
@Override
public PredefinedChartStyle updateBean() {
PredefinedChartStyle chartStyle = new PredefinedChartStyle();
chartTitleStylePane.update(chartStyle);
chartLegendStylePane.update(chartStyle);
chartLabelPane.update(chartStyle);
chartAxisStylePane.update(chartStyle);
chartDataSheetStylePane.update(chartStyle);
chartBackgroundStylePane.update(chartStyle);
return chartStyle;
}
@Override
public boolean accept(Object ob) {
return false;
}
@Override
public void reset() {
}
}

292
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java

@ -0,0 +1,292 @@
package com.fr.design.mainframe.predefined.ui.detail;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils;
import com.fr.chart.base.ChartConstants;
import com.fr.config.predefined.ColorFillStyle;
import com.fr.config.predefined.PredefinedColorStyle;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.icombobox.ColorSchemeComboBox;
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.layout.TableLayoutHelper;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.design.style.color.ColorAdjustPane;
import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import java.util.Arrays;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-15
*/
public class ColorFillStylePane extends BasicBeanPane<ColorFillStyle> {
private ColorSchemeComboBox styleSelectBox;
private JPanel customPane;
private JPanel changeColorSetPane;
private FixedGradientBar colorGradient;
private CardLayout cardLayout;
private ColorAdjustPane colorAdjustPane;
private Color[] gradientColors;
private Color[] accColors;
private boolean gradientSelect = false;
public ColorFillStylePane() {
this.setLayout(new BorderLayout());
styleSelectBox = createColorSchemeComboBox();
customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()) {
@Override
public Dimension getPreferredSize() {
if (!customPane.isVisible()) {
return new Dimension(0, 0);
}
if (!gradientSelect) {
return colorAdjustPane.getPreferredSize();
}
return colorGradient.getPreferredSize();
}
};
changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
gradientColors = new Color[]{Color.WHITE, FixedGradientBar.NEW_CHARACTER};
changeColorSetPane.add(colorAdjustPane = new ColorAdjustPane(), "acc");
accColors = ColorAdjustPane.DEFAULT_COLORS;
cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER);
initListener();
initLayout();
}
public ColorSchemeComboBox getStyleSelectBox() {
return styleSelectBox;
}
public JPanel getCustomPane() {
return customPane;
}
protected ColorSchemeComboBox createColorSchemeComboBox() {
return new ColorSchemeComboBox();
}
private void initListener() {
colorAdjustPane.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
accColors = colorAdjustPane.getColors();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.COMBINATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
ColorFillStylePane.this.revalidate();
}
});
colorGradient.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
gradientColors[0] = colorGradient.getSelectColorPointBtnP1().getColorInner();
gradientColors[1] = colorGradient.getSelectColorPointBtnP2().getColorInner();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.GRADATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
}
}
});
styleSelectBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
styleSelectBoxChange();
}
});
}
protected void styleSelectBoxChange() {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
colorAdjustPane.updateColor(accColors);
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
break;
case GRADATION_COLOR:
colorGradient.updateColor(gradientColors[0], gradientColors[1]);
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
break;
default:
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo();
if (selectColorInfo == null) {
return;
}
if (selectColorInfo.isGradient()) {
colorGradient.updateColor(selectColorInfo.getColors().get(0), selectColorInfo.getColors().get(1));
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
} else {
colorAdjustPane.updateColor(selectColorInfo.getColors().toArray(new Color[]{}));
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
}
break;
}
ColorFillStylePane.this.revalidate();
}
protected void initLayout() {
this.setLayout(new BorderLayout());
this.add(getContentPane(), BorderLayout.CENTER);
}
protected JPanel getContentPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = 155;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(contentPaneComponents(), rowSize, columnSize, 12, LayoutConstants.VGAP_LARGE);
return panel;
}
protected Component[][] contentPaneComponents() {
return new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Template_Color")), styleSelectBox},
new Component[]{null, customPane},
};
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Color");
}
public void populateBean(PredefinedColorStyle predefinedColorStyle) {
populateBean(predefinedColorStyle.getColorFillStyle());
}
@Override
public void populateBean(ColorFillStyle colorFillStyle) {
String fillStyleName = colorFillStyle == null ? "" : colorFillStyle.getFillStyleName();
if (StringUtils.isBlank(fillStyleName) || !styleSelectBox.getItems().contains(fillStyleName)) {
if (colorFillStyle == null || colorFillStyle.getColorStyle() == ChartConstants.COLOR_DEFAULT) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认
} else {
int colorStyle = colorFillStyle.getColorStyle();
if (colorStyle == ChartConstants.COLOR_GRADIENT) {
gradientColors[0] = colorFillStyle.getColorList().get(0);
gradientColors[1] = colorFillStyle.getColorList().get(1);
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
} else {
int colorSize = colorFillStyle.getColorList().size();
accColors = new Color[colorSize];
for (int i = 0; i < colorSize; i++) {
accColors[i] = colorFillStyle.getColorList().get(i);
}
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
}
} else {
styleSelectBox.setSelectedItem(fillStyleName);
}
}
public PredefinedColorStyle update() {
PredefinedColorStyle predefinedColorStyle = new PredefinedColorStyle();
predefinedColorStyle.setColorFillStyle(updateBean());
return predefinedColorStyle;
}
@Override
public ColorFillStyle updateBean() {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
return updateCombinationColor();
case GRADATION_COLOR:
return updateGradationColor();
case DEFAULT:
return updateDefaultColor();
default:
return updateNormalColor();
}
}
private ColorFillStyle updateCombinationColor() {
ColorFillStyle colorFillStyle = new ColorFillStyle();
List<Color> colorList = colorFillStyle.getColorList();
colorFillStyle.setColorStyle(ChartConstants.COLOR_ACC);
for (int i = 0, length = accColors.length; i < length; i++) {
colorList.add(accColors[i]);
}
colorFillStyle.setCustomFillStyle(true);
return colorFillStyle;
}
private ColorFillStyle updateGradationColor() {
ColorFillStyle colorFillStyle = new ColorFillStyle();
List<Color> colorList = colorFillStyle.getColorList();
colorFillStyle.setColorStyle(ChartConstants.COLOR_GRADIENT);
Color start = gradientColors[0];
Color end = gradientColors[1];
colorList.add(start);
colorList.add(end);
colorFillStyle.setCustomFillStyle(true);
return colorFillStyle;
}
private ColorFillStyle updateDefaultColor() {
ColorFillStyle colorFillStyle = new ColorFillStyle();
colorFillStyle.setColorStyle(ChartConstants.COLOR_DEFAULT);
return colorFillStyle;
}
private ColorFillStyle updateNormalColor() {
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem());
if (preStyle instanceof ChartColorMatching) {
ColorFillStyle colorFillStyle = new ColorFillStyle();
ChartColorMatching chartColorMatching = (ChartColorMatching) preStyle;
colorFillStyle.setColorStyle(chartColorMatching.getGradient() ? ChartConstants.COLOR_GRADIENT : ChartConstants.COLOR_ACC);
List<Color> colorList = chartColorMatching.getColorList();
if (colorList == null || colorList.size() == 0) {
colorList = Arrays.asList(ChartConstants.CHART_COLOR_ARRAY);
}
colorFillStyle.setColorList(colorList);
colorFillStyle.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem()));
return colorFillStyle;
} else {
return updateModifyColor();
}
}
private ColorFillStyle updateModifyColor() {
ColorFillStyle colorFillStyle = new ColorFillStyle();
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo();
boolean isGradient = selectColorInfo.isGradient();
List<Color> colors = selectColorInfo.getColors();
colorFillStyle.setColorList(colors);
colorFillStyle.setCustomFillStyle(true);
colorFillStyle.setColorStyle(isGradient ? ChartConstants.COLOR_GRADIENT : ChartConstants.COLOR_ACC);
return colorFillStyle;
}
}

49
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/AbstractChartStylePane.java

@ -0,0 +1,49 @@
package com.fr.design.mainframe.predefined.ui.detail.chart;
import com.fr.config.predefined.PredefinedChartStyle;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-17
*/
public abstract class AbstractChartStylePane extends BasicPane {
public AbstractChartStylePane() {
initComponents();
initPane();
}
protected abstract void initComponents();
protected void initPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
double e = 155;
double p = TableLayout.PREFERRED;
double[] columnSize = {p, e};
JPanel gapTableLayoutPane = TableLayoutHelper.createGapTableLayoutPane(getComponent(), getRows(p), columnSize, 20, LayoutConstants.VGAP_LARGE);
gapTableLayoutPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
UIScrollPane rightTopPane = new UIScrollPane(gapTableLayoutPane);
rightTopPane.setBorder(BorderFactory.createEmptyBorder());
this.add(rightTopPane, BorderLayout.CENTER);
}
protected abstract Component[][] getComponent();
protected abstract double[] getRows(double p);
public abstract void populate(PredefinedChartStyle chartStyle);
public abstract void update(PredefinedChartStyle chartStyle);
}

69
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartAxisStylePane.java

@ -0,0 +1,69 @@
package com.fr.design.mainframe.predefined.ui.detail.chart;
import com.fr.config.predefined.PredefinedChartStyle;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.style.color.ColorSelectBox;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-16
*/
public class ChartAxisStylePane extends AbstractChartStylePane {
//轴标题字体样式
private ChartFontPane titleFontPane;
//轴标签字体样式
private ChartFontPane labelFontPane;
//轴线颜色
private ColorSelectBox axisLineColor;
protected void initComponents() {
titleFontPane = new ChartFontPane() {
public String getUILabelText() {
return Toolkit.i18nText("Fine-Design_Chart_Axis_Title_Character");
}
};
labelFontPane = new ChartFontPane() {
public String getUILabelText() {
return Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Character");
}
};
axisLineColor = new ColorSelectBox(100);
}
protected Component[][] getComponent() {
return new Component[][]{
new Component[]{titleFontPane, null},
new Component[]{labelFontPane, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Axis_Line_Color")), axisLineColor}
};
}
protected double[] getRows(double p) {
return new double[]{p, p, p};
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis");
}
public void populate(PredefinedChartStyle chartStyle) {
titleFontPane.populate(chartStyle.getAxisTitleFont());
labelFontPane.populate(chartStyle.getAxisLabelFont());
axisLineColor.setSelectObject(chartStyle.getAxisLineColor());
}
public void update(PredefinedChartStyle chartStyle) {
chartStyle.setAxisTitleFont(titleFontPane.update());
chartStyle.setAxisLabelFont(labelFontPane.update());
chartStyle.setAxisLineColor(axisLineColor.getSelectObject());
}
}

113
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartBackgroundStylePane.java

@ -0,0 +1,113 @@
package com.fr.design.mainframe.predefined.ui.detail.chart;
import com.fr.base.background.ImageBackground;
import com.fr.config.predefined.PredefinedChartStyle;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.Background;
import com.fr.stable.Constants;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-17
*/
public class ChartBackgroundStylePane extends AbstractChartStylePane {
private UIComboBox typeComboBox;
private List<BackgroundQuickPane> paneList;
private JPanel centerPane;
//网格线颜色
private ColorSelectBox mainGridColor;
protected void initComponents() {
mainGridColor = new ColorSelectBox(100);
typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout();
initList();
centerPane = new JPanel(cardlayout) {
@Override
public Dimension getPreferredSize() {// AUGUST:使用当前面板的的高度
int index = typeComboBox.getSelectedIndex();
return new Dimension(super.getPreferredSize().width, paneList.get(index).getPreferredSize().height);
}
};
for (int i = 0; i < paneList.size(); i++) {
BackgroundQuickPane pane = paneList.get(i);
typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow());
}
typeComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem());
}
});
}
protected Component[][] getComponent() {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Area_Background_Color")), typeComboBox},
new Component[]{null, centerPane},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Grid_Line_Color")), mainGridColor}
};
}
protected double[] getRows(double p) {
return new double[]{p, p, p, p};
}
private void initList() {
paneList = new ArrayList<>();
paneList.add(new NullBackgroundQuickPane());
paneList.add(new ColorBackgroundQuickPane());
paneList.add(new ImageBackgroundQuickPane(false));
paneList.add(new VanChartGradientPane());
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background");
}
public void populate(PredefinedChartStyle chartStyle) {
Background background = chartStyle.getChartBackground();
for (int i = 0; i < paneList.size(); i++) {
BackgroundQuickPane pane = paneList.get(i);
if (pane.accept(background)) {
pane.populateBean(background);
typeComboBox.setSelectedIndex(i);
break;
}
}
mainGridColor.setSelectObject(chartStyle.getGridMainLineColor());
}
public void update(PredefinedChartStyle chartStyle) {
chartStyle.setChartBackground(paneList.get(typeComboBox.getSelectedIndex()).updateBean());
if (chartStyle.getChartBackground() instanceof ImageBackground) {
((ImageBackground) chartStyle.getChartBackground()).setLayout(Constants.IMAGE_EXTEND);
}
chartStyle.setGridMainLineColor(mainGridColor.getSelectObject());
}
}

58
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartDataSheetStylePane.java

@ -0,0 +1,58 @@
package com.fr.design.mainframe.predefined.ui.detail.chart;
import com.fr.config.predefined.PredefinedChartStyle;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.style.color.ColorSelectBox;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-17
*/
public class ChartDataSheetStylePane extends AbstractChartStylePane {
//字体样式
private ChartFontPane fontPane;
//边框颜色
private ColorSelectBox borderColor;
protected void initComponents() {
fontPane = new ChartFontPane() {
public String getUILabelText() {
return Toolkit.i18nText("Fine-Design_Chart_DataSheet_Character");
}
};
borderColor = new ColorSelectBox(100);
}
protected Component[][] getComponent() {
return new Component[][]{
new Component[]{fontPane, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Border_Color")), borderColor}
};
}
protected double[] getRows(double p) {
return new double[]{p, p, p};
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Sheet");
}
public void populate(PredefinedChartStyle chartStyle) {
fontPane.populate(chartStyle.getDataSheetFont());
borderColor.setSelectObject(chartStyle.getDataSheetBorderColor());
}
public void update(PredefinedChartStyle chartStyle) {
chartStyle.setDataSheetFont(fontPane.update());
chartStyle.setDataSheetBorderColor(borderColor.getSelectObject());
}
}

160
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartFontPane.java

@ -0,0 +1,160 @@
package com.fr.design.mainframe.predefined.ui.detail.chart;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Utils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Font;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-16
*/
public class ChartFontPane extends BasicPane {
public static final int FONT_START = 6;
public static final int FONT_END = 72;
private UIComboBox fontNameComboBox;
private UIComboBox fontSizeComboBox;
private UIToggleButton bold;
private UIToggleButton italic;
private UIColorButton fontColor;
private static Integer[] FONT_SIZES = new Integer[FONT_END - FONT_START + 1];
static {
for (int i = FONT_START; i <= FONT_END; i++) {
FONT_SIZES[i - FONT_START] = i;
}
}
public ChartFontPane() {
initState();
initComponents();
}
private void initState() {
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontSizeComboBox = new UIComboBox(FONT_SIZES);
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
fontColor = new UIColorButton();
}
protected void initComponents() {
Component[] components = new Component[]{
fontColor, italic, bold
};
JPanel buttonPane = new JPanel(new BorderLayout());
buttonPane.add(fontSizeComboBox, BorderLayout.CENTER);
buttonPane.add(GUICoreUtils.createFlowPane(components, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE), BorderLayout.EAST);
this.setLayout(new BorderLayout());
this.add(getContentPane(buttonPane), BorderLayout.CENTER);
populate(FRContext.getDefaultValues().getFRFont());
}
protected JPanel getContentPane(JPanel buttonPane) {
double e = 155;
double p = TableLayout.PREFERRED;
double[] rows = {p, p, p};
double[] columnSize = {p, e};
UILabel text = new UILabel(getUILabelText(), SwingConstants.LEFT);
Component[][] components = {
new Component[]{null, null},
new Component[]{text, fontNameComboBox},
new Component[]{null, buttonPane}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rows, columnSize, 20, LayoutConstants.VGAP_LARGE);
}
public String getUILabelText() {
return Toolkit.i18nText("Fine-Design_Chart_Character");
}
public String title4PopupWindow() {
return null;
}
public void populate(FRFont frFont) {
UIObserverListener listener = fontNameComboBox == null ? null : fontNameComboBox.getUiObserverListener();
removeAllComboBoxListener();
if (frFont != null) {
fontNameComboBox.setSelectedItem(frFont.getFamily());
bold.setSelected(frFont.isBold());
italic.setSelected(frFont.isItalic());
populateFontSize(frFont);
if (fontColor != null) {
fontColor.setColor(frFont.getForeground());
}
}
//更新结束后,注册监听器
registerAllComboBoxListener(listener);
}
private void populateFontSize(FRFont frFont) {
if (fontSizeComboBox != null) {
fontSizeComboBox.setSelectedItem(frFont.getSize());
}
}
private void removeAllComboBoxListener() {
fontNameComboBox.removeChangeListener();
fontSizeComboBox.removeChangeListener();
}
private void registerAllComboBoxListener(UIObserverListener listener) {
fontNameComboBox.registerChangeListener(listener);
fontSizeComboBox.registerChangeListener(listener);
}
/**
* 更新字
*
* @return 更新字
*/
public FRFont update() {
String name = GeneralUtils.objectToString(fontNameComboBox.getSelectedItem());
return FRFont.getInstance(name, updateFontStyle(), updateFontSize(), fontColor.getColor());
}
private int updateFontStyle() {
int style = Font.PLAIN;
if (bold.isSelected() && !italic.isSelected()) {
style = Font.BOLD;
} else if (!bold.isSelected() && italic.isSelected()) {
style = Font.ITALIC;
} else if (bold.isSelected() && italic.isSelected()) {
style = 3;
}
return style;
}
private float updateFontSize() {
return Float.parseFloat(GeneralUtils.objectToString(fontSizeComboBox.getSelectedItem()));
}
}

78
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartLabelStylePane.java

@ -0,0 +1,78 @@
package com.fr.design.mainframe.predefined.ui.detail.chart;
import com.fr.config.predefined.PredefinedChartStyle;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-16
*/
public class ChartLabelStylePane extends AbstractChartStylePane {
private UIButtonGroup<Integer> autoButton;
//字体样式
private ChartFontPane chartFontPane;
protected void initComponents() {
autoButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
chartFontPane = new ChartFontPane() {
public String getUILabelText() {
return Toolkit.i18nText("Fine-Design_Chart_Label_Character");
}
};
initListener();
}
protected Component[][] getComponent() {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Style_Setting")), autoButton},
new Component[]{chartFontPane, null}
};
}
protected double[] getRows(double p) {
return new double[]{p, p, p};
}
private void initListener() {
autoButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkPreButton();
}
});
}
private void checkPreButton() {
chartFontPane.setVisible(autoButton.getSelectedIndex() == 1);
chartFontPane.setPreferredSize(autoButton.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0));
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label");
}
public void populate(PredefinedChartStyle chartStyle) {
autoButton.setSelectedIndex(chartStyle.isAutoLabelFont() ? 0 : 1);
chartFontPane.populate(chartStyle.getLabelFont());
checkPreButton();
}
public void update(PredefinedChartStyle chartStyle) {
chartStyle.setAutoLabelFont(autoButton.getSelectedIndex() == 0);
chartStyle.setLabelFont(chartFontPane.update());
}
}

49
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartLegendStylePane.java

@ -0,0 +1,49 @@
package com.fr.design.mainframe.predefined.ui.detail.chart;
import com.fr.config.predefined.PredefinedChartStyle;
import com.fr.design.i18n.Toolkit;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-16
*/
public class ChartLegendStylePane extends AbstractChartStylePane {
//字体样式
private ChartFontPane chartFontPane;
protected void initComponents() {
chartFontPane = new ChartFontPane() {
public String getUILabelText() {
return Toolkit.i18nText("Fine-Design_Chart_Legend_Character");
}
};
}
protected Component[][] getComponent() {
return new Component[][]{
new Component[]{chartFontPane, null}
};
}
protected double[] getRows(double p) {
return new double[]{p};
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Legend");
}
public void populate(PredefinedChartStyle chartStyle) {
chartFontPane.populate(chartStyle.getLegendFont());
}
public void update(PredefinedChartStyle chartStyle) {
chartStyle.setLegendFont(chartFontPane.update());
}
}

49
designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java

@ -0,0 +1,49 @@
package com.fr.design.mainframe.predefined.ui.detail.chart;
import com.fr.config.predefined.PredefinedChartStyle;
import com.fr.design.i18n.Toolkit;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-16
*/
public class ChartTitleStylePane extends AbstractChartStylePane {
//字体样式
private ChartFontPane chartFontPane;
protected void initComponents() {
chartFontPane = new ChartFontPane() {
public String getUILabelText() {
return Toolkit.i18nText("Fine-Design_Chart_Title_Character");
}
};
}
protected Component[][] getComponent() {
return new Component[][]{
new Component[]{chartFontPane, null}
};
}
protected double[] getRows(double p) {
return new double[]{p};
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Report_Title");
}
public void populate(PredefinedChartStyle chartStyle) {
chartFontPane.populate(chartStyle.getTitleFont());
}
public void update(PredefinedChartStyle chartStyle) {
chartStyle.setTitleFont(chartFontPane.update());
}
}

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java → designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java

@ -1,14 +1,12 @@
package com.fr.design.mainframe.chart.gui.style; package com.fr.design.style.color;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.design.chartx.component.button.ColorButton;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.AbstractSelectBox; import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -32,7 +30,7 @@ import java.awt.image.BufferedImage;
* @version 10.0 * @version 10.0
* Created by Bjorn on 2020-03-25 * Created by Bjorn on 2020-03-25
*/ */
public class ChartColorAdjustPane extends JPanel implements UIObserver { public class ColorAdjustPane extends JPanel implements UIObserver {
public static final Color[] DEFAULT_COLORS = { public static final Color[] DEFAULT_COLORS = {
new Color(99, 178, 238), new Color(99, 178, 238),
@ -58,11 +56,11 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
private ChangeListener changeListener; private ChangeListener changeListener;
public ChartColorAdjustPane() { public ColorAdjustPane() {
this(DEFAULT_COLORS); this(DEFAULT_COLORS);
} }
public ChartColorAdjustPane(Color[] colors) { public ColorAdjustPane(Color[] colors) {
iniListener(); iniListener();
createColorButton(colors); createColorButton(colors);
createContentPane(); createContentPane();
@ -217,7 +215,7 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
if(colorButtons.size() < MAX_BUTTON) { if(colorButtons.size() < MAX_BUTTON) {
colorButtons.add(createColorButton(color)); colorButtons.add(createColorButton(color));
} }
ChartColorAdjustPane.this.stateChanged(); ColorAdjustPane.this.stateChanged();
relayout(); relayout();
} }
}); });

3
designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java → designer-base/src/main/java/com/fr/design/style/color/ColorButton.java

@ -1,9 +1,8 @@
package com.fr.design.chartx.component.button; package com.fr.design.style.color;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.background.ColorBackground; import com.fr.base.background.ColorBackground;
import com.fr.design.style.AbstractSelectBox; import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;

97
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java

@ -0,0 +1,97 @@
package com.fr.design.mainframe.chart.gui.style;
import com.fr.chart.base.TextAttr;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-03
*/
public class ChartTextAttrPaneWithPreStyle extends ChartTextAttrPane {
private static final int PREDEFINED_STYLE = 0;
private static final int CUSTOM = 1;
private UIButtonGroup<Integer> preButton;
private JPanel textFontPane;
public ChartTextAttrPaneWithPreStyle() {
initListener();
}
protected JPanel getContentPane(JPanel buttonPane) {
preButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Predefined"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
double f = TableLayout.FILL;
double e = getEdithAreaWidth();
double[] columnSize = {f, e};
double p = TableLayout.PREFERRED;
textFontPane = TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), getRowSize(), columnSize);
double[] rowSize = {p, p, p};
UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT);
Component[][] components = {
new Component[]{null, null},
new Component[]{text, preButton},
new Component[]{textFontPane, null},
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
protected double getEdithAreaWidth() {
return TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
}
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{null, getFontNameComboBox()},
new Component[]{null, buttonPane}
};
}
private void initListener() {
preButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkPreButton();
}
});
}
private void checkPreButton() {
textFontPane.setVisible(preButton.getSelectedIndex() == CUSTOM);
textFontPane.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 60) : new Dimension(0, 0));
}
public void populate(TextAttr textAttr) {
if (textAttr.isPredefinedStyle()) {
preButton.setSelectedIndex(PREDEFINED_STYLE);
} else {
preButton.setSelectedIndex(CUSTOM);
}
super.populate(textAttr);
checkPreButton();
}
public void update(TextAttr textAttr) {
int selectedIndex = preButton.getSelectedIndex();
if (selectedIndex == PREDEFINED_STYLE) {
textAttr.setPredefinedStyle(true);
} else {
textAttr.setPredefinedStyle(false);
}
super.update(textAttr);
}
}

88
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java

@ -0,0 +1,88 @@
package com.fr.design.mainframe.chart.gui.style;
import com.fr.chart.base.ColorWithPreStyle;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-07
*/
public class ColorSelectBoxWithPreStyle extends BasicPane {
private static final int PREDEFINED_STYLE = 0;
private static final int CUSTOM = 1;
private UIButtonGroup<Integer> preButton;
private ColorSelectBox colorSelectBox;
public ColorSelectBoxWithPreStyle(int preferredWidth) {
preButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Predefined"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
colorSelectBox = new ColorSelectBox(preferredWidth);
initContent();
initListener();
}
private void initContent() {
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color"), SwingConstants.LEFT);
Component[][] components = {
new Component[]{text, preButton},
new Component[]{null, colorSelectBox},
};
JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.add(gapTableLayoutPane, BorderLayout.CENTER);
}
private void initListener() {
preButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkPreButton();
}
});
}
private void checkPreButton() {
colorSelectBox.setVisible(preButton.getSelectedIndex() == CUSTOM);
this.setPreferredSize(preButton.getSelectedIndex() == CUSTOM ? new Dimension(0, 55) : new Dimension(0, 23));
}
public String title4PopupWindow() {
return null;
}
public void populate(ColorWithPreStyle colorWithPreStyle) {
preButton.setSelectedIndex(colorWithPreStyle.isPredefinedStyle() ? PREDEFINED_STYLE : CUSTOM);
colorSelectBox.setSelectObject(colorWithPreStyle.getColor());
checkPreButton();
}
public ColorWithPreStyle update() {
ColorWithPreStyle colorWithPreStyle = new ColorWithPreStyle();
colorWithPreStyle.setPredefinedStyle(preButton.getSelectedIndex() == PREDEFINED_STYLE);
colorWithPreStyle.setColor(colorSelectBox.getSelectObject());
return colorWithPreStyle;
}
}

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

@ -8,7 +8,7 @@ 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.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane; import com.fr.design.style.color.ColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar; import com.fr.design.style.background.gradient.FixedGradientBar;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -38,7 +38,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
private UIButtonGroup groupButton; private UIButtonGroup groupButton;
private ChartColorAdjustPane colorAdjustPane; private ColorAdjustPane colorAdjustPane;
private FixedGradientBar colorGradient; private FixedGradientBar colorGradient;
public ChartPreFillStylePane() { public ChartPreFillStylePane() {
@ -59,7 +59,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
changeColorSetPane = new JPanel(cardLayout = new CardLayout()); changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); changeColorSetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 150), "gradient"); changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 150), "gradient");
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc"); changeColorSetPane.add(colorAdjustPane = new ColorAdjustPane(), "acc");
cardLayout.show(changeColorSetPane, "acc"); cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER); customPane.add(changeColorSetPane, BorderLayout.CENTER);
@ -124,9 +124,9 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
if (colorList.isEmpty()) { if (colorList.isEmpty()) {
List<Color> resultList = new ArrayList<>(); List<Color> resultList = new ArrayList<>();
Collections.addAll(resultList, ChartColorAdjustPane.DEFAULT_COLORS); Collections.addAll(resultList, ColorAdjustPane.DEFAULT_COLORS);
condition.setColorList(resultList); condition.setColorList(resultList);
colorAdjustPane.updateColor(ChartColorAdjustPane.DEFAULT_COLORS); colorAdjustPane.updateColor(ColorAdjustPane.DEFAULT_COLORS);
} else { } else {
colorAdjustPane.updateColor(colorList.toArray(new Color[colorList.size()])); colorAdjustPane.updateColor(colorList.toArray(new Color[colorList.size()]));
} }

2
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java

@ -2,7 +2,7 @@ package com.fr.design.module;
import com.fr.base.ChartColorMatching; import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig; import com.fr.base.ChartPreStyleConfig;
import com.fr.design.chartx.component.combobox.ColorSchemeComboBox; import com.fr.design.gui.icombobox.ColorSchemeComboBox;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;

2
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java

@ -69,7 +69,7 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane {
//边框(有圆角) //边框(有圆角)
protected VanChartBorderPane createDiffBorderPane() { protected VanChartBorderPane createDiffBorderPane() {
return new VanChartBorderWithRadiusPane(); return new VanChartBorderWithRadiusPane(true);
} }
private JPanel createSeriesStylePane(double[] row, double[] col) { private JPanel createSeriesStylePane(double[] row, double[] col) {

12
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java

@ -1,5 +1,6 @@
package com.fr.van.chart.custom.style; package com.fr.van.chart.custom.style;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chartx.config.info.constant.ConfigType; import com.fr.chartx.config.info.constant.ConfigType;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -90,10 +91,15 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot();
if (fillStylePane != null){ if (fillStylePane != null) {
plot.setPlotFillStyle(fillStylePane.updateBean()); AttrFillStyle plotFillStyle = plot.getPlotFillStyle();
if(plotFillStyle == null) {
plotFillStyle = new AttrFillStyle();
plot.setPlotFillStyle(plotFillStyle);
}
fillStylePane.updateBean(plotFillStyle);
} }
if (seriesPane != null){ if (seriesPane != null) {
plotSeriesPane.updateBean(plot); plotSeriesPane.updateBean(plot);
} }
//系列埋点 //系列埋点

7
designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java

@ -29,6 +29,7 @@ import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.VanChartRefreshTooltipContentPane; import com.fr.van.chart.designer.component.VanChartRefreshTooltipContentPane;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.style.HeatMapRangeLegendPane; import com.fr.van.chart.designer.style.HeatMapRangeLegendPane;
import com.fr.van.chart.designer.style.MapRangeLegendPane;
import com.fr.van.chart.designer.style.VanChartPlotLegendPane; import com.fr.van.chart.designer.style.VanChartPlotLegendPane;
import com.fr.van.chart.designer.style.VanChartRangeLegendPane; import com.fr.van.chart.designer.style.VanChartRangeLegendPane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
@ -65,12 +66,12 @@ import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JList; import javax.swing.JList;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Component;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.awt.Component;
/** /**
* Created by Mitisky on 16/3/1. * Created by Mitisky on 16/3/1.
@ -128,8 +129,8 @@ public class PlotFactory {
legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class); legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class);
legendMap.put(VanChartScatterPlot.class, VanChartRangeLegendPane.class); legendMap.put(VanChartScatterPlot.class, VanChartRangeLegendPane.class);
legendMap.put(VanChartBubblePlot.class, VanChartRangeLegendPane.class); legendMap.put(VanChartBubblePlot.class, VanChartRangeLegendPane.class);
legendMap.put(VanChartMapPlot.class, VanChartRangeLegendPane.class); legendMap.put(VanChartMapPlot.class, MapRangeLegendPane.class);
legendMap.put(VanChartDrillMapPlot.class, VanChartRangeLegendPane.class); legendMap.put(VanChartDrillMapPlot.class, MapRangeLegendPane.class);
legendMap.put(VanChartHeatMapPlot.class, HeatMapRangeLegendPane.class); legendMap.put(VanChartHeatMapPlot.class, HeatMapRangeLegendPane.class);
legendMap.put(VanChartWordCloudPlot.class, VanChartRangeLegendPane.class); legendMap.put(VanChartWordCloudPlot.class, VanChartRangeLegendPane.class);
} }

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

@ -1,159 +1,57 @@
package com.fr.van.chart.designer.component; package com.fr.van.chart.designer.component;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils;
import com.fr.chart.base.AttrFillStyle; import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.ChartConstants; import com.fr.design.gui.icombobox.ColorSchemeComboBox;
import com.fr.chart.base.ChartUtils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.component.combobox.ColorSchemeComboBox;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel; 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.TableLayout;
import com.fr.design.mainframe.DesignerBean; import com.fr.design.mainframe.DesignerBean;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane; import com.fr.design.mainframe.predefined.ui.detail.ColorFillStylePane;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.design.utils.gui.GUICoreUtils; 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.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.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
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> implements DesignerBean { public class VanChartFillStylePane extends ColorFillStylePane implements DesignerBean {
public static final String name = "vanChartFillStyle"; public static final String name = "vanChartFillStyle";
protected ColorSchemeComboBox styleSelectBox;
protected JPanel customPane;
protected JPanel changeColorSetPane;
protected FixedGradientBar colorGradient;
protected CardLayout cardLayout;
protected ChartColorAdjustPane colorAdjustPane;
private Color[] gradientColors;
private Color[] accColors;
private boolean gradientSelect = false;
public VanChartFillStylePane() { public VanChartFillStylePane() {
this.setLayout(new BorderLayout()); super();
styleSelectBox = new ColorSchemeComboBox();
customPane = new JPanel(FRGUIPaneFactory.createBorderLayout()) {
@Override
public Dimension getPreferredSize() {
if (!gradientSelect) {
return colorAdjustPane.getPreferredSize();
}
return colorGradient.getPreferredSize();
}
};
changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
gradientColors = new Color[]{Color.WHITE, FixedGradientBar.NEW_CHARACTER};
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
accColors = ChartColorAdjustPane.DEFAULT_COLORS;
cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER);
initListener();
initLayout();
DesignerContext.setDesignerBean(name, this); DesignerContext.setDesignerBean(name, this);
}
protected void styleSelectBoxChange() {
getCustomPane().setVisible(getStyleSelectBox().getSelectedIndex() != 0);
super.styleSelectBoxChange();
} }
private void initListener() { protected ColorSchemeComboBox createColorSchemeComboBox() {
colorAdjustPane.registerChangeListener(new UIObserverListener() { return new ColorSchemeComboBox(null, true);
@Override
public void doChange() {
accColors = colorAdjustPane.getColors();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.COMBINATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
VanChartFillStylePane.this.revalidate();
}
});
colorGradient.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
gradientColors[0] = colorGradient.getSelectColorPointBtnP1().getColorInner();
gradientColors[1] = colorGradient.getSelectColorPointBtnP2().getColorInner();
if (styleSelectBox.getSelectType() != ColorSchemeComboBox.SelectType.GRADATION_COLOR) {
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
}
}
});
styleSelectBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
colorAdjustPane.updateColor(accColors);
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
break;
case GRADATION_COLOR:
colorGradient.updateColor(gradientColors[0], gradientColors[1]);
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
break;
default:
ColorSchemeComboBox.ColorInfo selectColorInfo = styleSelectBox.getSelectColorInfo();
if (selectColorInfo.isGradient()) {
colorGradient.updateColor(selectColorInfo.getColors().get(0), selectColorInfo.getColors().get(1));
cardLayout.show(changeColorSetPane, "gradient");
gradientSelect = true;
} else {
colorAdjustPane.updateColor(selectColorInfo.getColors().toArray(new Color[]{}));
cardLayout.show(changeColorSetPane, "acc");
gradientSelect = false;
}
break;
}
VanChartFillStylePane.this.revalidate();
}
});
} }
protected void initLayout() { protected void initLayout() {
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); super.initLayout();
this.setLayout(new BorderLayout());
this.add(getContentPane(), BorderLayout.CENTER); this.add(getContentPane(), BorderLayout.CENTER);
} }
protected JPanel getContentPane() { protected JPanel getContentPane() {
double p = TableLayout.PREFERRED; JPanel contentPane = super.getContentPane();
double f = TableLayout.FILL; contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; return contentPane;
double[] columnSize = {f, e}; }
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), styleSelectBox},
new Component[]{null, customPane},
protected Component[][] contentPaneComponents() {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), getStyleSelectBox()},
new Component[]{null, getCustomPane()},
}; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
return panel;
} }
@Override @Override
@ -161,107 +59,31 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> implemen
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color");
} }
@Override
public void populateBean(AttrFillStyle condition) { public void populateBean(AttrFillStyle condition) {
String fillStyleName = condition == null ? "" : condition.getFillStyleName(); if (condition.isPredefinedStyle()) {
if (StringUtils.isBlank(fillStyleName) || !styleSelectBox.getItems().contains(fillStyleName)) {//兼容处理 getStyleSelectBox().setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);
if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) { return;
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);//默认
} else {
int colorStyle = condition.getColorStyle();
if (colorStyle == ChartConstants.COLOR_GRADIENT) {
gradientColors[0] = condition.getColorIndex(0);
gradientColors[1] = condition.getColorIndex(1);
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.GRADATION_COLOR);
} else {
int colorSize = condition.getColorSize();
accColors = new Color[colorSize];
for (int i = 0; i < colorSize; i++) {
accColors[i] = condition.getColorIndex(i);
}
styleSelectBox.setSelectType(ColorSchemeComboBox.SelectType.COMBINATION_COLOR);
}
}
} else {
styleSelectBox.setSelectedItem(fillStyleName);
} }
populateBean(condition.getColorFillStyle());
} }
@Override public void updateBean(AttrFillStyle attrFillStyle) {
public AttrFillStyle updateBean() { if (getStyleSelectBox().getSelectedIndex() == 0) {
switch (styleSelectBox.getSelectType()) { attrFillStyle.setPredefinedStyle(true);
case COMBINATION_COLOR: return;
return updateCombinationColor();
case GRADATION_COLOR:
return updateGradationColor();
case DEFAULT:
return updateDefaultColor();
default:
return updateNormalColor();
}
}
private AttrFillStyle updateCombinationColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_ACC);
for (int i = 0, length = accColors.length; i < length; i++) {
condition.addFillColor(accColors[i]);
} }
condition.setCustomFillStyle(true); attrFillStyle.setPredefinedStyle(false);
return condition; attrFillStyle.setColorFillStyle(updateBean());
}
private AttrFillStyle updateGradationColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_GRADIENT);
Color start = gradientColors[0];
Color end = gradientColors[1];
condition.addFillColor(start);
condition.addFillColor(end);
condition.setCustomFillStyle(true);
return condition;
}
private AttrFillStyle updateDefaultColor() {
AttrFillStyle condition = new AttrFillStyle();
condition.clearColors();
condition.setColorStyle(ChartConstants.COLOR_DEFAULT);
return condition;
}
private AttrFillStyle updateNormalColor() {
ChartPreStyleConfig manager = ChartPreStyleConfig.getInstance();
Object preStyle = manager.getPreStyle(styleSelectBox.getSelectedItem());
if (preStyle instanceof ChartColorMatching) {
AttrFillStyle def = ChartUtils.chartColorMatching2AttrFillStyle((ChartColorMatching) preStyle);
def.setFillStyleName(Utils.objectToString(styleSelectBox.getSelectedItem()));
return def;
} else {
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() { public void refreshBeanElement() {
AttrFillStyle attrFillStyle = updateBean(); AttrFillStyle attrFillStyle = new AttrFillStyle();
updateBean(attrFillStyle);
styleSelectBox.refresh(); getStyleSelectBox().refresh();
populateBean(attrFillStyle); populateBean(attrFillStyle);
GUICoreUtils.repaint(this); GUICoreUtils.repaint(this);

25
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -83,7 +83,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private AttrTooltipRichText richText; private AttrTooltipRichText richText;
public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane){ public VanChartTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
this.parent = parent; this.parent = parent;
this.showOnPane = showOnPane; this.showOnPane = showOnPane;
this.richText = new AttrTooltipRichText(); this.richText = new AttrTooltipRichText();
@ -92,7 +92,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
initRichTextFormatPane(parent, showOnPane); initRichTextFormatPane(parent, showOnPane);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(createLabelContentPane(),BorderLayout.CENTER); this.add(createLabelContentPane(), BorderLayout.CENTER);
} }
public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() { public CategoryNameFormatPaneWithCheckBox getCategoryNameFormatPane() {
@ -283,7 +283,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
} }
private JPanel createCommonStylePane() { protected JPanel createCommonStylePane() {
styleButton = new UIButtonGroup<>(new String[]{ styleButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom") Toolkit.i18nText("Fine-Design_Chart_Custom")
@ -318,7 +318,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}); });
} }
private void checkStylePane() { protected void checkStylePane() {
textAttrPane.setVisible(styleButton.getSelectedIndex() == 1); textAttrPane.setVisible(styleButton.getSelectedIndex() == 1);
} }
@ -422,8 +422,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
} }
protected double[] getRowSize(double p){ protected double[] getRowSize(double p) {
return new double[]{p,p,p,p}; return new double[]{p, p, p, p};
} }
protected Component[][] getPaneComponents() { protected Component[][] getPaneComponents() {
@ -448,7 +448,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
content.addActionListener(new ActionListener() { content.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
checkCardPane(); checkCardPane();
} }
}); });
} }
@ -458,7 +458,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
CardLayout cardLayout = (CardLayout) centerPanel.getLayout(); CardLayout cardLayout = (CardLayout) centerPanel.getLayout();
if (content.getSelectedIndex() == 2) { if (content.getSelectedIndex() == 2) {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Custom")); cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Custom"));
if(isDirty()){ if (isDirty()) {
setCustomFormatterText(); setCustomFormatterText();
setDirty(false); setDirty(false);
} }
@ -506,8 +506,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
@Override @Override
public void populateBean(AttrTooltipContent attrTooltipContent){ public void populateBean(AttrTooltipContent attrTooltipContent) {
if(attrTooltipContent == null){ if (attrTooltipContent == null) {
return; return;
} }
@ -531,7 +531,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
populateRichEditor(attrTooltipContent); populateRichEditor(attrTooltipContent);
htmlLabelPane.populate(attrTooltipContent.getHtmlLabel()); htmlLabelPane.populate(attrTooltipContent.getHtmlLabel());
if(!attrTooltipContent.isCommon()){ if (!attrTooltipContent.isCommon()) {
setDirty(false); setDirty(false);
} }
@ -693,9 +693,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
* CHART-1295 * CHART-1295
* 通过格式的面板宽度来判断在自定义js代码中是否显示this.seriesName字符串 * 通过格式的面板宽度来判断在自定义js代码中是否显示this.seriesName字符串
* 图表对于其他的格式有要求也可以在这里继续添加 * 图表对于其他的格式有要求也可以在这里继续添加
*
* @param attrTooltipContent * @param attrTooltipContent
*/ */
private void updateFormatsWithPaneWidth (AttrTooltipContent attrTooltipContent) { private void updateFormatsWithPaneWidth(AttrTooltipContent attrTooltipContent) {
int paneWidth = seriesNameFormatPane.getWidth(); int paneWidth = seriesNameFormatPane.getWidth();
if (paneWidth == 0) { if (paneWidth == 0) {
attrTooltipContent.getSeriesFormat().setEnable(false); attrTooltipContent.getSeriesFormat().setEnable(false);

41
designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java

@ -12,22 +12,22 @@ import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/** /**
* 图表 属性表.背景设置 界面.(包括 , 颜色, 图片, 渐变)+开启阴影 * 图表 属性表.背景设置 界面.(包括 , 颜色, 图片, 渐变)+开启阴影
@ -64,7 +64,7 @@ public class VanChartBackgroundPane extends BasicPane {
protected void initComponents() { protected void initComponents() {
typeComboBox = new UIComboBox(); typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout(); final CardLayout cardlayout = new CardLayout();
paneList = new ArrayList<BackgroundQuickPane>(); paneList = new ArrayList<>();
initList(); initList();
@ -86,7 +86,7 @@ public class VanChartBackgroundPane extends BasicPane {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
cardlayout.show(centerPane, (String)typeComboBox.getSelectedItem()); cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem());
fireStateChanged(); fireStateChanged();
} }
}); });
@ -97,7 +97,7 @@ public class VanChartBackgroundPane extends BasicPane {
protected Component[][] getPaneComponents() { protected Component[][] getPaneComponents() {
shadow = new UIButtonGroup<Boolean>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); shadow = new UIButtonGroup<Boolean>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false});
return new Component[][]{ return new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill")), typeComboBox}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill")), typeComboBox},
new Component[]{null, centerPane}, new Component[]{null, centerPane},
@ -123,13 +123,14 @@ public class VanChartBackgroundPane extends BasicPane {
if (e == null) { if (e == null) {
e = new ChangeEvent(this); e = new ChangeEvent(this);
} }
((ChangeListener)listeners[i + 1]).stateChanged(e); ((ChangeListener) listeners[i + 1]).stateChanged(e);
} }
} }
} }
/** /**
* 返回标题 * 返回标题
*
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -137,16 +138,20 @@ public class VanChartBackgroundPane extends BasicPane {
} }
public void populate(GeneralInfo attr) { public void populate(GeneralInfo attr) {
if(attr == null) { if (attr == null) {
return; return;
} }
Background background = attr.getBackground();
double alpha = attr.getAlpha() * ALPHA_V; double alpha = attr.getAlpha() * ALPHA_V;
transparent.populateBean(alpha); transparent.populateBean(alpha);
if(shadow != null){ if (shadow != null) {
shadow.setSelectedIndex(attr.isShadow() == true ? 0 : 1); shadow.setSelectedIndex(attr.isShadow() == true ? 0 : 1);
} }
for (int i = 0; i < paneList.size(); i++) { populateBackground(attr, 0);
}
public void populateBackground(GeneralInfo attr, int begin) {
Background background = attr.getBackground();
for (int i = begin; i < paneList.size(); i++) {
BackgroundQuickPane pane = paneList.get(i); BackgroundQuickPane pane = paneList.get(i);
if (pane.accept(background)) { if (pane.accept(background)) {
pane.populateBean(background); pane.populateBean(background);
@ -160,13 +165,17 @@ public class VanChartBackgroundPane extends BasicPane {
if (attr == null) { if (attr == null) {
attr = new GeneralInfo(); attr = new GeneralInfo();
} }
attr.setBackground(paneList.get(typeComboBox.getSelectedIndex()).updateBean()); updateBackground(attr);
if(attr.getBackground() instanceof ImageBackground){
((ImageBackground) attr.getBackground()).setLayout(Constants.IMAGE_EXTEND);
}
attr.setAlpha((float) (transparent.updateBean() / ALPHA_V)); attr.setAlpha((float) (transparent.updateBean() / ALPHA_V));
if(shadow != null){ if (shadow != null) {
attr.setShadow(shadow.getSelectedIndex() == 0); attr.setShadow(shadow.getSelectedIndex() == 0);
} }
} }
public void updateBackground(GeneralInfo attr) {
attr.setBackground(paneList.get(typeComboBox.getSelectedIndex()).updateBean());
if (attr.getBackground() instanceof ImageBackground) {
((ImageBackground) attr.getBackground()).setLayout(Constants.IMAGE_EXTEND);
}
}
} }

49
designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java

@ -0,0 +1,49 @@
package com.fr.van.chart.designer.component.background;
import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-11
*/
public class VanChartBackgroundPaneWithAutoColor extends VanChartBackgroundPane {
private static final int AUTO = 0;
public VanChartBackgroundPaneWithAutoColor() {
super();
}
protected void initList() {
paneList.add(new NullBackgroundQuickPane() {
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Automatic");
}
});
paneList.add(new NullBackgroundQuickPane());
paneList.add(new ColorBackgroundQuickPane());
paneList.add(new VanChartGradientPane());
}
public void populateBackground(GeneralInfo attr, int begin) {
if (attr.isAutoBackground()) {
typeComboBox.setSelectedIndex(AUTO);
return;
}
super.populateBackground(attr, begin + 1);
}
public void updateBackground(GeneralInfo attr) {
if (typeComboBox.getSelectedIndex() == AUTO) {
attr.setAutoBackground(true);
return;
}
attr.setAutoBackground(false);
super.updateBackground(attr);
}
}

51
designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java

@ -0,0 +1,51 @@
package com.fr.van.chart.designer.component.background;
import com.fr.chart.base.BackgroundWithPreStyle;
import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-08
*/
public class VanChartBackgroundPaneWithPreStyle extends VanChartBackgroundPane {
private static final int PREDEFINED_STYLE = 0;
@Override
protected void initList() {
paneList.add(new NullBackgroundQuickPane() {
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Predefined");
}
});
paneList.add(new NullBackgroundQuickPane());
paneList.add(new ColorBackgroundQuickPane());
paneList.add(new ImageBackgroundQuickPane(false));
paneList.add(new VanChartGradientPane());
}
public void populateBackground(GeneralInfo attr, int begin) {
BackgroundWithPreStyle backgroundWithPreStyle = attr.getBackgroundWithPreStyle();
if (backgroundWithPreStyle.isPredefinedStyle()) {
typeComboBox.setSelectedIndex(PREDEFINED_STYLE);
return;
}
super.populateBackground(attr, begin + 1);
}
public void updateBackground(GeneralInfo attr) {
if (typeComboBox.getSelectedIndex() == PREDEFINED_STYLE) {
attr.getBackgroundWithPreStyle().setPredefinedStyle(true);
return;
}
attr.getBackgroundWithPreStyle().setPredefinedStyle(false);
super.updateBackground(attr);
}
}

1
designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.designer.component.background;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane;
/** /**
* 图表 属性表.背景设置 界面.(包括 , 颜色, 渐变)+开启阴影 * 图表 属性表.背景设置 界面.(包括 , 颜色, 渐变)+开启阴影

134
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java

@ -4,6 +4,7 @@ package com.fr.van.chart.designer.component.border;
import com.fr.chart.base.AttrBorder; import com.fr.chart.base.AttrBorder;
import com.fr.chart.chartglyph.GeneralInfo; import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -17,47 +18,105 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
//线型 + 颜色 //线型 + 颜色
public class VanChartBorderPane extends BasicPane { public class VanChartBorderPane extends BasicPane {
private static final long serialVersionUID = -7770029552989609464L; private static final long serialVersionUID = -7770029552989609464L;
private UIButtonGroup<Integer> autoButton;
protected LineComboBox currentLineCombo; protected LineComboBox currentLineCombo;
protected ColorSelectBox currentLineColorPane; protected ColorSelectBox currentLineColorPane;
protected JPanel colorPanel;
public VanChartBorderPane() { public VanChartBorderPane() {
this(false);
}
public VanChartBorderPane(boolean hasAuto) {
if (hasAuto) {
autoButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
initListener();
}
initComponents(); initComponents();
initColorPanel();
initContent();
} }
protected void initComponents() { protected void initComponents() {
currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
currentLineColorPane = new ColorSelectBox(100); currentLineColorPane = new ColorSelectBox(100);
}
protected void initContent() {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
Component[][] components = getUseComponent(); Component[][] components = getUseComponent();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSize(), columnSize); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSize(), columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
}
protected void initColorPanel() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize;
UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color"));
Component[][] components;
if (autoButton != null) {
rowSize = new double[]{p, p};
components = new Component[][]{
new Component[]{colorLabel, autoButton},
new Component[]{null, currentLineColorPane}
};
} else {
rowSize = new double[]{p};
components = new Component[][]{
new Component[]{colorLabel, currentLineColorPane}
};
}
colorPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p, p};
} }
protected Component[][] getUseComponent() { protected Component[][] getUseComponent() {
UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")); UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style"));
UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color"));
return new Component[][]{ return new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{lineStyleLabel, UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)}, new Component[]{lineStyleLabel, UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)},
new Component[]{colorLabel, currentLineColorPane}, new Component[]{colorPanel, null},
}; };
} }
protected double[] getRowSize() { private void initListener() {
double p = TableLayout.PREFERRED; autoButton.addActionListener(new ActionListener() {
return new double[]{p, p, p, p}; @Override
public void actionPerformed(ActionEvent e) {
checkPreButton();
}
});
}
private void checkPreButton() {
currentLineColorPane.setVisible(autoButton.getSelectedIndex() == 1);
currentLineColorPane.setPreferredSize(autoButton.getSelectedIndex() == 1 ? new Dimension(0, 20) : new Dimension(0, 0));
} }
/** /**
* 标题 * 标题
*
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -65,44 +124,73 @@ public class VanChartBorderPane extends BasicPane {
} }
public void populate(GeneralInfo attr) { public void populate(GeneralInfo attr) {
if(attr == null) { if (attr == null) {
return; return;
} }
currentLineCombo.setSelectedLineStyle(attr.getBorderStyle()); if (currentLineCombo != null) {
currentLineColorPane.setSelectObject(attr.getBorderColor()); currentLineCombo.setSelectedLineStyle(attr.getBorderStyle());
}
if (currentLineColorPane != null) {
currentLineColorPane.setSelectObject(attr.getBorderColor());
}
} }
public void update(GeneralInfo attr) { public void update(GeneralInfo attr) {
if(attr == null) { if (attr == null) {
attr = new GeneralInfo(); attr = new GeneralInfo();
} }
attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); if (currentLineCombo != null) {
attr.setBorderColor(currentLineColorPane.getSelectObject()); attr.setBorderStyle(currentLineCombo.getSelectedLineStyle());
}
if (currentLineColorPane != null) {
attr.setBorderColor(currentLineColorPane.getSelectObject());
}
} }
public void update(AttrBorder attrBorder){ public void update(AttrBorder attrBorder) {
if(attrBorder == null){ if (attrBorder == null) {
return; return;
} }
attrBorder.setBorderStyle(currentLineCombo.getSelectedLineStyle()); if (autoButton != null) {
attrBorder.setBorderColor(currentLineColorPane.getSelectObject()); attrBorder.setAutoColor(autoButton.getSelectedIndex() == 0);
}
if (currentLineCombo != null) {
attrBorder.setBorderStyle(currentLineCombo.getSelectedLineStyle());
}
if (currentLineColorPane != null) {
attrBorder.setBorderColor(currentLineColorPane.getSelectObject());
}
} }
public void populate(AttrBorder attr) { public void populate(AttrBorder attr) {
if(attr == null) { if (attr == null) {
return; return;
} }
currentLineCombo.setSelectedLineStyle(attr.getBorderStyle()); if (autoButton != null) {
currentLineColorPane.setSelectObject(attr.getBorderColor()); autoButton.setSelectedIndex(attr.isAutoColor() ? 0 : 1);
checkPreButton();
}
if (currentLineCombo != null) {
currentLineCombo.setSelectedLineStyle(attr.getBorderStyle());
}
if (currentLineColorPane != null) {
currentLineColorPane.setSelectObject(attr.getBorderColor());
}
} }
public AttrBorder update() { public AttrBorder update() {
AttrBorder attr = new AttrBorder(); AttrBorder attr = new AttrBorder();
if (autoButton != null) {
attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); attr.setAutoColor(autoButton.getSelectedIndex() == 0);
attr.setBorderColor(currentLineColorPane.getSelectObject()); }
if (currentLineCombo != null) {
attr.setBorderStyle(currentLineCombo.getSelectedLineStyle());
}
if (currentLineColorPane != null) {
attr.setBorderColor(currentLineColorPane.getSelectObject());
}
return attr; return attr;
} }

57
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPaneWithPreStyle.java

@ -0,0 +1,57 @@
package com.fr.van.chart.designer.component.border;
import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithPreStyle;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.stable.CoreConstants;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-07
*/
public class VanChartBorderPaneWithPreStyle extends VanChartBorderPane {
private ColorSelectBoxWithPreStyle colorSelectBoxWithPreStyle;
public VanChartBorderPaneWithPreStyle() {
super();
}
protected void initComponents() {
currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
colorSelectBoxWithPreStyle = new ColorSelectBoxWithPreStyle(100);
}
protected Component[][] getUseComponent() {
UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style"));
return new Component[][]{
new Component[]{null, null},
new Component[]{lineStyleLabel, UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)},
new Component[]{colorSelectBoxWithPreStyle, null},
};
}
public void populate(GeneralInfo attr) {
super.populate(attr);
if (attr == null) {
return;
}
colorSelectBoxWithPreStyle.populate(attr.getColorWithPreStyle());
}
public void update(GeneralInfo attr) {
super.update(attr);
if (attr == null) {
attr = new GeneralInfo();
}
attr.setColorWithPreStyle(colorSelectBoxWithPreStyle.update());
}
}

18
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java

@ -2,7 +2,6 @@ package com.fr.van.chart.designer.component.border;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
@ -19,12 +18,23 @@ import java.awt.Component;
public class VanChartBorderWithAlphaPane extends VanChartBorderPane{ public class VanChartBorderWithAlphaPane extends VanChartBorderPane{
private UINumberDragPane transparent; private UINumberDragPane transparent;
public VanChartBorderWithAlphaPane() {
super();
}
public VanChartBorderWithAlphaPane(boolean hasAuto) {
super(hasAuto);
}
@Override @Override
protected void initComponents() { protected void initComponents() {
super.initComponents();
transparent = new UINumberDragPane(0,100); transparent = new UINumberDragPane(0,100);
this.add(new JSeparator(), BorderLayout.SOUTH); }
super.initComponents(); protected void initContent() {
this.add(new JSeparator(), BorderLayout.SOUTH);
super.initContent();
} }
@Override @Override
@ -35,7 +45,7 @@ public class VanChartBorderWithAlphaPane extends VanChartBorderPane{
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo) UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)
}, },
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),currentLineColorPane}, new Component[]{colorPanel, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent}
}; };
} }

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java

@ -19,15 +19,28 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
private static final long serialVersionUID = -3937853702118283803L; private static final long serialVersionUID = -3937853702118283803L;
private UISpinner radius; private UISpinner radius;
public VanChartBorderWithRadiusPane() {
super();
}
public VanChartBorderWithRadiusPane(boolean hasAuto) {
super(hasAuto);
}
public UISpinner getRadius() { public UISpinner getRadius() {
return radius; return radius;
} }
@Override @Override
protected void initComponents() { protected void initComponents() {
super.initComponents();
radius = new UISpinner(0,1000,1,0); radius = new UISpinner(0,1000,1,0);
}
@Override
protected void initContent() {
this.add(new JSeparator(), BorderLayout.SOUTH); this.add(new JSeparator(), BorderLayout.SOUTH);
super.initComponents(); super.initContent();
} }
@Override @Override
@ -38,7 +51,7 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo) UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)
}, },
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")),currentLineColorPane}, new Component[]{colorPanel, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")),radius} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")),radius}
} ; } ;
} }

1
designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartLabelConditionPane.java

@ -3,7 +3,6 @@ package com.fr.van.chart.designer.other.condition.item;
import com.fr.chart.base.DataSeriesCondition; import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.condition.ConditionAttributesPane;
import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.AttrLabel;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelNoCheckPane; import com.fr.van.chart.designer.style.label.VanChartPlotLabelNoCheckPane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelPane; import com.fr.van.chart.designer.style.label.VanChartPlotLabelPane;

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

@ -7,7 +7,7 @@ import javax.swing.JPanel;
* 只有渐变色图例和区域段图例. * 只有渐变色图例和区域段图例.
* 没有主题配色 * 没有主题配色
*/ */
public class HeatMapRangeLegendPane extends VanChartRangeLegendPane { public class HeatMapRangeLegendPane extends MapRangeLegendPane {
public HeatMapRangeLegendPane() { public HeatMapRangeLegendPane() {
} }

25
designer-chart/src/main/java/com/fr/van/chart/designer/style/MapRangeLegendPane.java

@ -0,0 +1,25 @@
package com.fr.van.chart.designer.style;
import com.fr.van.chart.designer.component.background.VanChartBackgroundPane;
import com.fr.van.chart.designer.component.background.VanChartBackgroundPaneWithAutoColor;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-09-11
*/
public class MapRangeLegendPane extends VanChartRangeLegendPane {
public MapRangeLegendPane() {
super();
}
public MapRangeLegendPane(VanChartStylePane parent) {
super(parent);
}
@Override
protected VanChartBackgroundPane creatBackgroundPane(){
return new VanChartBackgroundPaneWithAutoColor();
}
}

18
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -14,6 +14,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithPreStyle;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.plugin.chart.type.LayoutType; import com.fr.plugin.chart.type.LayoutType;
@ -21,6 +22,7 @@ import com.fr.stable.Constants;
import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.PlotFactory;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFloatPositionPane; import com.fr.van.chart.designer.component.VanChartFloatPositionPane;
import com.fr.van.chart.designer.component.background.VanChartBackgroundPane;
import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane; import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane;
import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane;
@ -54,7 +56,7 @@ public class VanChartPlotLegendPane extends BasicPane {
private ChartTextAttrPane textAttrPane; private ChartTextAttrPane textAttrPane;
private VanChartBorderWithRadiusPane borderPane; private VanChartBorderWithRadiusPane borderPane;
private VanChartBackgroundWithOutImagePane backgroundPane; private VanChartBackgroundPane backgroundPane;
private UIButtonGroup<Integer> location; private UIButtonGroup<Integer> location;
private UIToggleButton customFloatPositionButton; private UIToggleButton customFloatPositionButton;
private UIButtonGroup<LayoutType> layoutButton; private UIButtonGroup<LayoutType> layoutButton;
@ -135,7 +137,7 @@ public class VanChartPlotLegendPane extends BasicPane {
protected JPanel createLegendPaneWithoutHighlight() { protected JPanel createLegendPaneWithoutHighlight() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane(); backgroundPane = creatBackgroundPane();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -153,9 +155,13 @@ public class VanChartPlotLegendPane extends BasicPane {
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
protected VanChartBackgroundPane creatBackgroundPane(){
return new VanChartBackgroundWithOutImagePane();
}
protected JPanel createLegendPane() { protected JPanel createLegendPane() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane(); backgroundPane = creatBackgroundPane();
highlightPane = createHighlightPane(); highlightPane = createHighlightPane();
JPanel panel = new JPanel(); JPanel panel = new JPanel();
panel.setLayout(new BorderLayout()); panel.setLayout(new BorderLayout());
@ -281,7 +287,7 @@ public class VanChartPlotLegendPane extends BasicPane {
} }
private JPanel createTitleStylePane() { private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPane(); textAttrPane = new ChartTextAttrPaneWithPreStyle();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
} }
@ -382,7 +388,7 @@ public class VanChartPlotLegendPane extends BasicPane {
legend = new VanChartLegend(); legend = new VanChartLegend();
} }
legend.setLegendVisible(isLegendVisible.isSelected()); legend.setLegendVisible(isLegendVisible.isSelected());
legend.setFRFont(textAttrPane.updateFRFont()); textAttrPane.update(legend.getTextAttr());
borderPane.update(legend); borderPane.update(legend);
backgroundPane.update(legend); backgroundPane.update(legend);
@ -408,7 +414,7 @@ public class VanChartPlotLegendPane extends BasicPane {
public void populateBean(VanChartLegend legend) { public void populateBean(VanChartLegend legend) {
if (legend != null) { if (legend != null) {
isLegendVisible.setSelected(legend.isLegendVisible()); isLegendVisible.setSelected(legend.isLegendVisible());
textAttrPane.populate(legend.getFRFont()); textAttrPane.populate(legend.getTextAttr());
borderPane.populate(legend); borderPane.populate(legend);
backgroundPane.populate(legend); backgroundPane.populate(legend);
if (!legend.isFloating()) { if (!legend.isFloating()) {

6
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -15,7 +15,7 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithPreStyle;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartTitle; import com.fr.plugin.chart.attr.VanChartTitle;
@ -54,7 +54,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private JPanel titlePane; private JPanel titlePane;
private TinyFormulaPane titleContent; private TinyFormulaPane titleContent;
private ChartTextAttrPane textAttrPane; private ChartTextAttrPaneWithPreStyle textAttrPane;
private UIButtonGroup<Integer> alignmentPane; private UIButtonGroup<Integer> alignmentPane;
private VanChartBackgroundWithOutShadowWithRadiusPane backgroundPane; private VanChartBackgroundWithOutShadowWithRadiusPane backgroundPane;
private UIToggleButton useHtml; private UIToggleButton useHtml;
@ -171,7 +171,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} }
private JPanel createTitleStylePane() { private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPane(); textAttrPane = new ChartTextAttrPaneWithPreStyle();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
} }

27
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -20,7 +20,8 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithPreStyle;
import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithPreStyle;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -79,7 +80,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
private JPanel labelGapValuePane; private JPanel labelGapValuePane;
protected LineComboBox axisLineStyle; protected LineComboBox axisLineStyle;
protected ColorSelectBox axisLineColor; protected ColorSelectBoxWithPreStyle axisLineColor;
protected UIButtonGroup<AxisTickLineType> mainTick; protected UIButtonGroup<AxisTickLineType> mainTick;
protected UIButtonGroup<AxisTickLineType> secondTick; protected UIButtonGroup<AxisTickLineType> secondTick;
@ -327,24 +328,16 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
protected ChartTextAttrPane getChartTextAttrPane() { protected ChartTextAttrPane getChartTextAttrPane() {
return new ChartTextAttrPane() { return new ChartTextAttrPaneWithPreStyle() {
protected double getEdithAreaWidth() {
@Override return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
protected JPanel getContentPane(JPanel buttonPane) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p};
return TableLayout4VanChartHelper.createGapTableLayoutPane(getComponents(buttonPane), rowSize, columnSize);
} }
}; };
} }
protected JPanel createLineStylePane(double[] row, double[] col) { protected JPanel createLineStylePane(double[] row, double[] col) {
axisLineStyle = createLineComboBox(); axisLineStyle = createLineComboBox();
axisLineColor = new ColorSelectBox(100); axisLineColor = new ColorSelectBoxWithPreStyle(100);
String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}; String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")};
AxisTickLineType[] values = new AxisTickLineType[]{AxisTickLineType.TICK_LINE_OUTSIDE, AxisTickLineType.TICK_LINE_NONE}; AxisTickLineType[] values = new AxisTickLineType[]{AxisTickLineType.TICK_LINE_OUTSIDE, AxisTickLineType.TICK_LINE_NONE};
mainTick = new UIButtonGroup<AxisTickLineType>(strings, values); mainTick = new UIButtonGroup<AxisTickLineType>(strings, values);
@ -362,7 +355,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
return new Component[][]{ return new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), axisLineStyle}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), axisLineStyle},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), axisLineColor}, new Component[]{axisLineColor, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTick}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTick},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secondTick}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secondTick},
}; };
@ -656,7 +649,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
axisLineStyle.setSelectedLineStyle(axis.getAxisStyle()); axisLineStyle.setSelectedLineStyle(axis.getAxisStyle());
} }
if (axisLineColor != null) { if (axisLineColor != null) {
axisLineColor.setSelectObject(axis.getAxisColor()); axisLineColor.populate(axis.getLineColorWithPreStyle());
} }
if (mainTick != null) { if (mainTick != null) {
mainTick.setSelectedItem(axis.getMainTickLine()); mainTick.setSelectedItem(axis.getMainTickLine());
@ -796,7 +789,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
axis.setAxisStyle(axisLineStyle.getSelectedLineStyle()); axis.setAxisStyle(axisLineStyle.getSelectedLineStyle());
} }
if (axisLineColor != null) { if (axisLineColor != null) {
axis.setAxisColor(axisLineColor.getSelectObject()); axis.setLineColorWithPreStyle(axisLineColor.update());
} }
if (mainTick != null) { if (mainTick != null) {
axis.setMainTickLine(mainTick.getSelectedItem()); axis.setMainTickLine(mainTick.getSelectedItem());

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java

@ -8,6 +8,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithPreStyle;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis; import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis;
@ -102,7 +103,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
if (isMulti(gaugeStyle)) { if (isMulti(gaugeStyle)) {
return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR); return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR);
} else { } else {
return new ChartTextAttrPane(); return new ChartTextAttrPaneWithPreStyle();
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarXAxisPane.java

@ -41,7 +41,7 @@ public class VanChartRadarXAxisPane extends VanChartBaseAxisPane {
return new Component[][]{ return new Component[][]{
new Component[]{null,null} , new Component[]{null,null} ,
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")),axisLineStyle} , new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")),axisLineStyle} ,
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),axisLineColor}, new Component[]{axisLineColor, null},
}; };
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java

@ -90,7 +90,7 @@ public class VanChartRadarYAxisPane extends VanChartValueAxisPane {
return new Component[][]{ return new Component[][]{
new Component[]{null,null} , new Component[]{null,null} ,
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), axisLineStyle}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), axisLineStyle},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), axisLineColor}, new Component[]{axisLineColor, null},
}; };
} }

7
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java

@ -10,6 +10,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.AbstractVanChartScrollPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.background.VanChartBackgroundPane; import com.fr.van.chart.designer.component.background.VanChartBackgroundPane;
import com.fr.van.chart.designer.component.background.VanChartBackgroundPaneWithPreStyle;
import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane; import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane;
import com.fr.van.chart.designer.style.background.radar.VanChartRadarAxisAreaPane; import com.fr.van.chart.designer.style.background.radar.VanChartRadarAxisAreaPane;
@ -41,7 +42,11 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
protected JPanel createContentPane() { protected JPanel createContentPane() {
contentPane = new JPanel(new BorderLayout()); contentPane = new JPanel(new BorderLayout());
chartBorderPane = new VanChartBorderWithRadiusPane(); chartBorderPane = new VanChartBorderWithRadiusPane();
chartBackgroundPane = new VanChartBackgroundPane(); if(isPlot) {
chartBackgroundPane = new VanChartBackgroundPane();
} else {
chartBackgroundPane = new VanChartBackgroundPaneWithPreStyle();
}
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;

25
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java

@ -7,6 +7,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ColorSelectBoxWithPreStyle;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
@ -43,8 +44,8 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private LineTypeComboBox horizonLineType; private LineTypeComboBox horizonLineType;
private LineTypeComboBox verticalLineType; private LineTypeComboBox verticalLineType;
private ColorSelectBox horizontalColorBox; private ColorSelectBoxWithPreStyle horizontalColorBox;
private ColorSelectBox verticalColorBox; private ColorSelectBoxWithPreStyle verticalColorBox;
private JPanel horizontalColorPane; private JPanel horizontalColorPane;
private JPanel verticalColorPane; private JPanel verticalColorPane;
@ -53,8 +54,8 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
} }
private void initComponents() { private void initComponents() {
horizontalColorBox = new ColorSelectBox(PREFERRED_WIDTH); horizontalColorBox = new ColorSelectBoxWithPreStyle(PREFERRED_WIDTH);
verticalColorBox = new ColorSelectBox(PREFERRED_WIDTH); verticalColorBox = new ColorSelectBoxWithPreStyle(PREFERRED_WIDTH);
horizonLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED}); horizonLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED});
verticalLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED}); verticalLineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED});
@ -89,13 +90,13 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
protected void initGridLineComponents() { protected void initGridLineComponents() {
Component[][] upComponent = new Component[][]{ Component[][] upComponent = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{null, horizontalColorBox} new Component[]{horizontalColorBox, null}
}; };
horizontalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(upComponent); horizontalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(upComponent);
Component[][] downComponent = new Component[][]{ Component[][] downComponent = new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{null, verticalColorBox} new Component[]{verticalColorBox, null}
}; };
verticalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(downComponent); verticalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(downComponent);
@ -143,7 +144,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
return panel; return panel;
} }
protected AlertLineListControlPane getAlertLinePane () { protected AlertLineListControlPane getAlertLinePane() {
return new AlertLineListControlPane(); return new AlertLineListControlPane();
} }
@ -153,7 +154,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
verticalColorBackground = new ColorSelectBox(100); verticalColorBackground = new ColorSelectBox(100);
Component[][] components = getIntervalPaneComponents(); Component[][] components = getIntervalPaneComponents();
JPanel defaultPane = TableLayoutHelper.createTableLayoutPane(components, row, col); JPanel defaultPane = TableLayoutHelper.createTableLayoutPane(components, row, col);
defaultPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); defaultPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
customIntervalBackground = getBackgroundListControlPane(); customIntervalBackground = getBackgroundListControlPane();
cardLayout = new CardLayout(); cardLayout = new CardLayout();
@ -220,12 +221,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis(); VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
if (defaultXAxis != null) { if (defaultXAxis != null) {
verticalColorBox.setSelectObject(defaultXAxis.getMainGridColor()); verticalColorBox.populate(defaultXAxis.getMainGridColorWithPreStyle());
verticalLineType.setSelectedItem(defaultXAxis.getGridLineType()); verticalLineType.setSelectedItem(defaultXAxis.getGridLineType());
} }
if (defaultYAxis != null) { if (defaultYAxis != null) {
horizontalColorBox.setSelectObject(defaultYAxis.getMainGridColor()); horizontalColorBox.populate(defaultYAxis.getMainGridColorWithPreStyle());
horizonLineType.setSelectedItem(defaultYAxis.getGridLineType()); horizonLineType.setSelectedItem(defaultYAxis.getGridLineType());
} }
} }
@ -253,12 +254,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis(); VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
if (defaultXAxis != null) { if (defaultXAxis != null) {
defaultXAxis.setMainGridColor(verticalColorBox.getSelectObject()); defaultXAxis.setMainGridColorWithPreStyle(verticalColorBox.update());
defaultXAxis.setGridLineType((LineType) verticalLineType.getSelectedItem()); defaultXAxis.setGridLineType((LineType) verticalLineType.getSelectedItem());
} }
if (defaultYAxis != null) { if (defaultYAxis != null) {
defaultYAxis.setMainGridColor(horizontalColorBox.getSelectObject()); defaultYAxis.setMainGridColorWithPreStyle(horizontalColorBox.update());
defaultYAxis.setGridLineType((LineType) horizonLineType.getSelectedItem()); defaultYAxis.setGridLineType((LineType) horizonLineType.getSelectedItem());
} }
} }

58
designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java

@ -1,6 +1,5 @@
package com.fr.van.chart.designer.style.datasheet; package com.fr.van.chart.designer.style.datasheet;
import com.fr.base.FRContext;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.DataSheet; import com.fr.chart.chartglyph.DataSheet;
@ -11,9 +10,9 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithPreStyle;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.base.VanChartConstants; import com.fr.plugin.chart.base.VanChartConstants;
@ -21,6 +20,7 @@ import com.fr.plugin.chart.type.AxisType;
import com.fr.van.chart.designer.AbstractVanChartScrollPane; import com.fr.van.chart.designer.AbstractVanChartScrollPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.border.VanChartBorderPane; import com.fr.van.chart.designer.component.border.VanChartBorderPane;
import com.fr.van.chart.designer.component.border.VanChartBorderPaneWithPreStyle;
import com.fr.van.chart.designer.component.format.FormatPaneWithNormalType; import com.fr.van.chart.designer.component.format.FormatPaneWithNormalType;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -58,11 +58,11 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
Component[][] components =creatComponent(dataSheetPane); Component[][] components = creatComponent(dataSheetPane);
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
isShowDataSheet.addActionListener(new ActionListener() { isShowDataSheet.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -71,7 +71,8 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
}); });
} }
} }
protected Component[][] creatComponent(JPanel dataSheetPane){
protected Component[][] creatComponent(JPanel dataSheetPane) {
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{isShowDataSheet}, new Component[]{isShowDataSheet},
@ -79,28 +80,37 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
}; };
return components; return components;
} }
// 检查数据表界面是否可用. // 检查数据表界面是否可用.
private void checkDataSheetPaneUse() { private void checkDataSheetPaneUse() {
dataSheetPane.setVisible(isShowDataSheet.isSelected()); dataSheetPane.setVisible(isShowDataSheet.isSelected());
} }
private JPanel createDataSheetPane(){ private JPanel createDataSheetPane() {
textAttrPane = new ChartTextAttrPane(); textAttrPane = createChartTextAttrPane();
formatPane = new FormatPaneWithNormalType(); formatPane = new FormatPaneWithNormalType();
borderPane = new VanChartBorderPane(); borderPane = createBorderPanePane();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
double[] columnSize = {d, e}; double[] columnSize = {d, e};
double[] rowSize = {p,p,p}; double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"),formatPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), formatPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"),textAttrPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null},
}; };
return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
protected VanChartBorderPane createBorderPanePane() {
return new VanChartBorderPaneWithPreStyle();
}
protected ChartTextAttrPane createChartTextAttrPane() {
return new ChartTextAttrPaneWithPreStyle();
} }
@Override @Override
@ -119,11 +129,11 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
@Override @Override
public void updateBean(Chart chart) { public void updateBean(Chart chart) {
if(chart == null) { if (chart == null) {
return; return;
} }
Plot plot = chart.getPlot(); Plot plot = chart.getPlot();
if(plot == null) { if (plot == null) {
return; return;
} }
DataSheet dataSheet = plot.getDataSheet(); DataSheet dataSheet = plot.getDataSheet();
@ -133,7 +143,7 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
plot.setDataSheet(dataSheet); plot.setDataSheet(dataSheet);
} }
dataSheet.setVisible(isShowDataSheet.isSelected()); dataSheet.setVisible(isShowDataSheet.isSelected());
if(isShowDataSheet.isSelected()){ if (isShowDataSheet.isSelected()) {
update(dataSheet); update(dataSheet);
} }
@ -144,14 +154,14 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
@Override @Override
public void populateBean(Chart chart) { public void populateBean(Chart chart) {
if(chart == null || chart.getPlot() == null) { if (chart == null || chart.getPlot() == null) {
return; return;
} }
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)chart.getPlot(); VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) chart.getPlot();
if(rectanglePlot.getXAxisList().size() == 1){ if (rectanglePlot.getXAxisList().size() == 1) {
if(ComparatorUtils.equals(rectanglePlot.getDefaultXAxis().getAxisType(), AxisType.AXIS_CATEGORY) if (ComparatorUtils.equals(rectanglePlot.getDefaultXAxis().getAxisType(), AxisType.AXIS_CATEGORY)
&& rectanglePlot.getDefaultXAxis().getPosition() == VanChartConstants.AXIS_BOTTOM && rectanglePlot.getDefaultXAxis().getPosition() == VanChartConstants.AXIS_BOTTOM
&& rectanglePlot.getCategoryNum() == 1 ){ && rectanglePlot.getCategoryNum() == 1) {
//只有单个分类坐标轴且坐标轴位置在下面,数据表才可以用 //只有单个分类坐标轴且坐标轴位置在下面,数据表才可以用
isShowDataSheet.setEnabled(!rectanglePlot.isAxisRotation()); isShowDataSheet.setEnabled(!rectanglePlot.isAxisRotation());
@ -173,16 +183,14 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
} }
public void populate(DataSheet dataSheet) { public void populate(DataSheet dataSheet) {
FRFont font = FRContext.getDefaultValues().getFRFont() == null ? FRFont.getInstance() : FRContext.getDefaultValues().getFRFont(); textAttrPane.populate(dataSheet.getTextAttr());
textAttrPane.populate(dataSheet.getFont() == null ? font : dataSheet.getFont());
formatPane.populateBean(dataSheet.getFormat()); formatPane.populateBean(dataSheet.getFormat());
borderPane.populate(dataSheet); borderPane.populate(dataSheet);
} }
public DataSheet update(DataSheet dataSheet) { public DataSheet update(DataSheet dataSheet) {
textAttrPane.update(dataSheet.getTextAttr());
dataSheet.setFont(textAttrPane.updateFRFont());
dataSheet.setFormat(formatPane.update()); dataSheet.setFormat(formatPane.update());
borderPane.update(dataSheet); borderPane.update(dataSheet);
return dataSheet; return dataSheet;

11
designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanchartDataSheetNoCheckPane.java

@ -2,7 +2,9 @@ package com.fr.van.chart.designer.style.datasheet;
import com.fr.chart.chartglyph.DataSheet; import com.fr.chart.chartglyph.DataSheet;
import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.plugin.chart.base.AttrDataSheet; import com.fr.plugin.chart.base.AttrDataSheet;
import com.fr.van.chart.designer.component.border.VanChartBorderPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Component; import java.awt.Component;
@ -46,4 +48,13 @@ public class VanchartDataSheetNoCheckPane extends VanChartDataSheetPane {
update(dataSheet); update(dataSheet);
return attrDataSheet; return attrDataSheet;
} }
@Override
protected ChartTextAttrPane createChartTextAttrPane(){
return new ChartTextAttrPane();
}
protected VanChartBorderPane createBorderPanePane() {
return new VanChartBorderPane();
}
} }

4
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java

@ -49,10 +49,6 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT; return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT;
} }
protected boolean isFontColorAuto() {
return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT;
}
protected boolean hasLabelPosition(Plot plot) { protected boolean hasLabelPosition(Plot plot) {
switch (getGaugeStyle()) { switch (getGaugeStyle()) {
case RING: case RING:

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -81,7 +81,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
protected boolean isFontColorAuto() { protected boolean isFontColorAuto() {
return false; return true;
} }
private FontAutoType getFontAutoType() { private FontAutoType getFontAutoType() {

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java

@ -376,4 +376,4 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
} }
} }
} }

18
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java

@ -5,6 +5,7 @@ import com.fr.base.chart.chartdata.model.LargeDataModel;
import com.fr.base.chart.chartdata.model.NormalDataModel; import com.fr.base.chart.chartdata.model.NormalDataModel;
import com.fr.chart.base.AttrAlpha; import com.fr.chart.base.AttrAlpha;
import com.fr.chart.base.AttrBorder; import com.fr.chart.base.AttrBorder;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.GradientStyle; import com.fr.chart.base.GradientStyle;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
@ -81,6 +82,14 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
super(parent, plot); super(parent, plot);
} }
public UINumberDragPane getTransparent() {
return transparent;
}
public void setTransparent(UINumberDragPane transparent) {
this.transparent = transparent;
}
protected JPanel getContentPane(boolean custom) { protected JPanel getContentPane(boolean custom) {
if (custom) { if (custom) {
JScrollPane scrollPane = new JScrollPane(); JScrollPane scrollPane = new JScrollPane();
@ -245,7 +254,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
} }
protected VanChartBorderPane createDiffBorderPane() { protected VanChartBorderPane createDiffBorderPane() {
return new VanChartBorderPane(); return new VanChartBorderPane(true);
} }
@ -340,7 +349,12 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
checkoutMapType(plot); checkoutMapType(plot);
if (vanChartFillStylePane != null) {//配色 if (vanChartFillStylePane != null) {//配色
plot.setPlotFillStyle(vanChartFillStylePane.updateBean()); AttrFillStyle plotFillStyle = plot.getPlotFillStyle();
if (plotFillStyle == null) {
plotFillStyle = new AttrFillStyle();
plot.setPlotFillStyle(plotFillStyle);
}
vanChartFillStylePane.updateBean(plotFillStyle);
} }
if (stylePane != null) {//风格 if (stylePane != null) {//风格

1
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java

@ -5,7 +5,6 @@ import com.fr.plugin.chart.base.format.AttrTooltipNameFormat;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.PercentFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox; import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithoutCheckBox;
import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.ValueFormatPaneWithCheckBox;

99
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -29,6 +29,9 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* Created by Mitisky on 15/11/27. * Created by Mitisky on 15/11/27.
@ -38,6 +41,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private static final long serialVersionUID = -4414343926082129759L; private static final long serialVersionUID = -4414343926082129759L;
private UIButtonGroup gaugeLayout;//布局:横向、纵向 private UIButtonGroup gaugeLayout;//布局:横向、纵向
private UIButtonGroup<Integer> hingeColorAuto;
private UIButtonGroup<Integer> paneBackgroundColorAuto;
private UIButtonGroup<Integer> slotBackgroundColorAuto;
private ColorSelectBox hingeColor;//枢纽颜色 private ColorSelectBox hingeColor;//枢纽颜色
private ColorSelectBox hingeBackgroundColor;//枢纽背景颜色 private ColorSelectBox hingeBackgroundColor;//枢纽背景颜色
private ColorSelectBox needleColor;//指针颜色 private ColorSelectBox needleColor;//指针颜色
@ -62,7 +68,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p}; double[] rowSize = {p,p,p,p,p,p,p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createGaugeLayoutPane()}, new Component[]{createGaugeLayoutPane()},
new Component[]{createGaugeStylePane(rowSize, new double[]{f,e})}, new Component[]{createGaugeStylePane(rowSize, new double[]{f,e})},
@ -138,7 +144,8 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
initRotate(); initRotate();
return new Component[][]{ return new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
getPaneBackgroundColor(), getPaneBackgroundColorAuto(),
new Component[]{null, paneBackgroundColor},
getInnerPaneBackgroundColor(), getInnerPaneBackgroundColor(),
new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null},
getChutePercent() getChutePercent()
@ -147,7 +154,8 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
return new Component[][]{ return new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
getNeedleColor(), getNeedleColor(),
getSlotBackgroundColor(), getSlotBackgroundColorAuto(),
new Component[]{null, slotBackgroundColor},
new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}, new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null},
getChutePercent() getChutePercent()
}; };
@ -155,25 +163,37 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
return new Component[][]{ return new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
getNeedleColor(), getNeedleColor(),
getSlotBackgroundColor(), getSlotBackgroundColorAuto(),
new Component[]{null, slotBackgroundColor},
new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Length_Set")), null}, new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Length_Set")), null},
getThermometerWidth() getThermometerWidth()
}; };
default: default:
return new Component[][]{ return new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
getHingeColor(), getHingeColorAuto(),
new Component[]{null, hingeColor},
getHingeBackgroundColor(), getHingeBackgroundColor(),
getNeedleColor(), getNeedleColor(),
getPaneBackgroundColor(), getPaneBackgroundColorAuto(),
new Component[]{null, paneBackgroundColor},
new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null} new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}
}; };
} }
} }
private Component[] getHingeColor() { private Component[] getHingeColorAuto() {
hingeColor = new ColorSelectBox(120); hingeColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge")),hingeColor}; hingeColorAuto = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
hingeColorAuto.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkHingeColorAutoButton();
}
});
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Hinge")), hingeColorAuto};
} }
private Component[] getHingeBackgroundColor() { private Component[] getHingeBackgroundColor() {
@ -186,11 +206,39 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Needle")),needleColor};
} }
private Component[] getPaneBackgroundColorAuto() {
paneBackgroundColor = new ColorSelectBox(120);
paneBackgroundColorAuto = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
paneBackgroundColorAuto.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkPaneBackgroundColorAutoButton();
}
});
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")), paneBackgroundColorAuto};
}
private Component[] getPaneBackgroundColor() { private Component[] getPaneBackgroundColor() {
paneBackgroundColor = new ColorSelectBox(120); paneBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Pane_Background")),paneBackgroundColor};
} }
private Component[] getSlotBackgroundColorAuto() {
slotBackgroundColor = new ColorSelectBox(120);
slotBackgroundColorAuto = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
slotBackgroundColorAuto.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkSlotBackgroundColorAutoButton();
}
});
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")), slotBackgroundColorAuto};
}
private Component[] getSlotBackgroundColor() { private Component[] getSlotBackgroundColor() {
slotBackgroundColor = new ColorSelectBox(120); slotBackgroundColor = new ColorSelectBox(120);
return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor}; return new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Slot_Background")),slotBackgroundColor};
@ -220,6 +268,20 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Range"), colorPickerPane);
} }
private void checkHingeColorAutoButton() {
hingeColor.setVisible(hingeColorAuto.getSelectedIndex() == 1);
hingeColor.setPreferredSize(hingeColorAuto.getSelectedIndex() == 1 ? new Dimension(0, 20) : new Dimension(0, 0));
}
private void checkSlotBackgroundColorAutoButton() {
slotBackgroundColor.setVisible(slotBackgroundColorAuto.getSelectedIndex() == 1);
slotBackgroundColor.setPreferredSize(slotBackgroundColorAuto.getSelectedIndex() == 1 ? new Dimension(0, 20) : new Dimension(0, 0));
}
private void checkPaneBackgroundColorAutoButton() {
paneBackgroundColor.setVisible(paneBackgroundColorAuto.getSelectedIndex() == 1);
paneBackgroundColor.setPreferredSize(paneBackgroundColorAuto.getSelectedIndex() == 1 ? new Dimension(0, 20) : new Dimension(0, 0));
}
public void populateBean(Plot plot) { public void populateBean(Plot plot) {
if(plot == null) { if(plot == null) {
@ -231,6 +293,18 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle(); GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
gaugeLayout.setSelectedIndex(detailStyle.isHorizontalLayout() ? 0 : 1); gaugeLayout.setSelectedIndex(detailStyle.isHorizontalLayout() ? 0 : 1);
if (hingeColorAuto != null) {
hingeColorAuto.setSelectedIndex(detailStyle.isHingeColorAuto() ? 0 : 1);
checkHingeColorAutoButton();
}
if (paneBackgroundColorAuto != null) {
paneBackgroundColorAuto.setSelectedIndex(detailStyle.isPaneBackgroundColorAuto() ? 0 : 1);
checkPaneBackgroundColorAutoButton();
}
if (slotBackgroundColorAuto != null) {
slotBackgroundColorAuto.setSelectedIndex(detailStyle.isSlotBackgroundColorAuto() ? 0 : 1);
checkSlotBackgroundColorAutoButton();
}
if(hingeColor != null){ if(hingeColor != null){
hingeColor.setSelectObject(detailStyle.getHingeColor()); hingeColor.setSelectObject(detailStyle.getHingeColor());
} }
@ -275,6 +349,15 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle(); GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
detailStyle.setHorizontalLayout(gaugeLayout.getSelectedIndex() == 0); detailStyle.setHorizontalLayout(gaugeLayout.getSelectedIndex() == 0);
if (hingeColorAuto != null) {
detailStyle.setHingeColorAuto(hingeColorAuto.getSelectedIndex() == 0);
}
if (paneBackgroundColorAuto != null) {
detailStyle.setPaneBackgroundColorAuto(paneBackgroundColorAuto.getSelectedIndex() == 0);
}
if (slotBackgroundColorAuto != null) {
detailStyle.setSlotBackgroundColorAuto(slotBackgroundColorAuto.getSelectedIndex() == 0);
}
if(hingeColor != null){ if(hingeColor != null){
detailStyle.setHingeColor(hingeColor.getSelectObject()); detailStyle.setHingeColor(hingeColor.getSelectObject());
} }

65
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -3,15 +3,19 @@ package com.fr.van.chart.map;
import com.fr.base.chart.chartdata.model.DataProcessor; import com.fr.base.chart.chartdata.model.DataProcessor;
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.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.base.AttrBorderWithAlpha; import com.fr.plugin.chart.base.AttrBorderWithAlpha;
@ -40,12 +44,15 @@ import com.fr.van.chart.map.line.VanChartLineMapEffectPane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
@ -72,6 +79,8 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
//area //area
private VanChartBorderWithAlphaPane borderWithAlphaPane; private VanChartBorderWithAlphaPane borderWithAlphaPane;
private UIButtonGroup<Integer> nullValueAuto;
private ColorSelectBox nullValueColorBox; private ColorSelectBox nullValueColorBox;
//point //point
@ -235,9 +244,24 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
} }
} }
//不透明度
protected JPanel createAlphaPane() {
setTransparent(new UINumberDragPane(0, 100));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH};
double[] rowSize = {p, p};
UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Alpha"));
label.setVerticalAlignment(SwingConstants.TOP);
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{label, UIComponentUtils.wrapWithBorderLayoutPane(getTransparent())},
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, TableLayout4VanChartHelper.COMPONENT_INTERVAL, LayoutConstants.VGAP_LARGE);
}
protected JPanel createAreaPane() { protected JPanel createAreaPane() {
borderWithAlphaPane = new VanChartBorderWithAlphaPane(); borderWithAlphaPane = new VanChartBorderWithAlphaPane(true);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -253,9 +277,39 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
} }
protected JPanel createNullValueColorPane() { protected JPanel createNullValueColorPane() {
nullValueAuto = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
nullValueColorBox = new ColorSelectBox(80); nullValueColorBox = new ColorSelectBox(80);
initNullValueListener();
return TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_NULL_Value_Color"), nullValueColorBox); double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_NULL_Value_Color"), SwingConstants.LEFT);
Component[][] components = {
new Component[]{null, null},
new Component[]{text, nullValueAuto},
new Component[]{null, nullValueColorBox},
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
private void initNullValueListener() {
nullValueAuto.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkNullValueButton();
}
});
}
private void checkNullValueButton() {
nullValueColorBox.setVisible(nullValueAuto.getSelectedIndex() == 1);
nullValueColorBox.setPreferredSize(nullValueAuto.getSelectedIndex() == 1 ? new Dimension(0, 20) : new Dimension(0, 0));
} }
private JPanel createPointPane() { private JPanel createPointPane() {
@ -445,7 +499,13 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
markerTypeCom.setSelectedItem(((VanChartMapPlot) plot).getMapMarkerType().toLocalString()); markerTypeCom.setSelectedItem(((VanChartMapPlot) plot).getMapMarkerType().toLocalString());
} }
if (nullValueColorBox != null) { if (nullValueColorBox != null) {
if (((VanChartMapPlot) plot).isAutoNullValue()) {
nullValueAuto.setSelectedIndex(0);
} else {
nullValueAuto.setSelectedIndex(1);
}
nullValueColorBox.setSelectObject(((VanChartMapPlot) plot).getNullValueColor()); nullValueColorBox.setSelectObject(((VanChartMapPlot) plot).getNullValueColor());
checkNullValueButton();
} }
//大数据模式 恢复用注释。下面3行删除。 //大数据模式 恢复用注释。下面3行删除。
if (lineMapLargeDataModelGroup != null) { if (lineMapLargeDataModelGroup != null) {
@ -461,6 +521,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parseInt(markerTypeCom.getSelectedIndex())); ((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parseInt(markerTypeCom.getSelectedIndex()));
} }
if (nullValueColorBox != null) { if (nullValueColorBox != null) {
((VanChartMapPlot) plot).setAutoNullValue(nullValueAuto.getSelectedIndex() == 0);
((VanChartMapPlot) plot).setNullValueColor(nullValueColorBox.getSelectObject()); ((VanChartMapPlot) plot).setNullValueColor(nullValueColorBox.getSelectObject());
} }
//大数据模式 恢复用注释。下面3行删除。 //大数据模式 恢复用注释。下面3行删除。

6
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java

@ -646,10 +646,8 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver {
private void resetGisLayer(VanChartMapPlot mapPlot) { private void resetGisLayer(VanChartMapPlot mapPlot) {
String layerName = mapPlot.getDefaultGisLayerName(); mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO);
mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));
mapPlot.getGisLayer().setGisLayerType(GISLayerType.PREDEFINED_LAYER);
mapPlot.getGisLayer().setLayerName(layerName);
gisLayer.setSelectedItem(mapPlot.getGisLayer().getShowItemName()); gisLayer.setSelectedItem(mapPlot.getGisLayer().getShowItemName());
} }

2
designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelPane.java

@ -22,4 +22,4 @@ public class VanChartScatterPlotLabelPane extends VanChartPlotLabelPane {
setLabelDetailPane(labelDetailPane); setLabelDetailPane(labelDetailPane);
getLabelPane().add(labelDetailPane, BorderLayout.CENTER); getLabelPane().add(labelDetailPane, BorderLayout.CENTER);
} }
} }
Loading…
Cancel
Save