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. 17
      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. 8
      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. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  25. 29
      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. 100
      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. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java
  43. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAxisAreaPane.java
  44. 24
      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. 18
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  49. 1
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelLabelContentPane.java
  50. 99
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  51. 65
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java
  52. 6
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java

17
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.ChartPreStyleConfig;
import com.fr.cert.token.lang.Collections;
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.general.GeneralUtils;
@ -36,11 +34,18 @@ public class ColorSchemeComboBox extends UIComboBox {
private Map<String, ColorInfo> colorSchemes;
private boolean preDefined;
public ColorSchemeComboBox() {
this(null);
this(null, false);
}
public ColorSchemeComboBox(Map<String, ColorInfo> colorSchemes) {
this(colorSchemes, false);
}
public ColorSchemeComboBox(Map<String, ColorInfo> colorSchemes, boolean preDefined) {
this.preDefined = preDefined;
//通过配色方案的集合初始化下拉控件,如果参数为null,从配置中读取配色方案。
if (colorSchemes == null) {
colorSchemes = getColorSchemesFromConfig();
@ -59,6 +64,9 @@ public class ColorSchemeComboBox extends UIComboBox {
//所有的样式名称
Iterator names = config.names();
if (preDefined) {
colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Predefined"), null);
} else {
//添加默认的方案和第一个方案
String defaultName = config.getCurrentStyle();
ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName);
@ -76,6 +84,7 @@ public class ColorSchemeComboBox extends UIComboBox {
colorInfo.setColors(Collections.arrayToList(ChartConstants.CHART_COLOR_ARRAY));
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorInfo);
}
}
//添加其他的配色方案
while (names.hasNext()) {

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.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.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.general.Background;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
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;
import com.fr.config.ServerPreferenceConfig;
import com.fr.config.predefined.PredefinedStyle;
import com.fr.config.predefined.PredefinedStyleConfig;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
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.itextfield.UITextField;
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.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.PredefinedBackgroundSettingPane;
import com.fr.design.mainframe.predefined.ui.preview.PredefinedStylePreviewPane;
import com.fr.design.utils.DesignUtils;
import com.fr.log.FineLoggerFactory;
@ -36,7 +38,9 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
private PredefinedBackgroundSettingPane backgroundSettingPane;
private CellStyleSettingPane cellStyleSettingPane;
private ComponentStyleSettingPane componentStyleSettingPane;
private ChartStyleSettingPane chartStyleSettingPane;
private PredefinedStyleSelectPane selectPane;
private ColorFillStylePane colorFillStylePane;
private boolean isPopulating = false;
private UITabbedPane uiTabbedPane;
@ -118,6 +122,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel titlePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Basic_Setting"));
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
colorFillStylePane = new ColorFillStylePane();
contentPane.add(colorFillStylePane);
titlePane.add(contentPane);
jPanel.add(titlePane, BorderLayout.CENTER);
titlePane.setSize(new Dimension(348, 157));
@ -170,7 +176,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
private JPanel createChartStyleSettingPane() {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
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;
}
@ -190,6 +197,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
this.backgroundSettingPane.populateBean(previewObject.getPredefinedBackground());
this.cellStyleSettingPane.populateBean(previewObject.getCellStyleConfig());
this.componentStyleSettingPane.populateBean(previewObject.getComponentStyle());
this.colorFillStylePane.populateBean(previewObject.getPredefinedColorStyle());
this.chartStyleSettingPane.populateBean(previewObject.getPredefinedChartStyle());
previewPane.refresh(previewObject);
isPopulating = false;
}
@ -200,6 +209,8 @@ public class PredefinedStyleEditPane extends AbstractAttrNoScrollPane {
predefinedStyle.setCellStyleConfig(this.cellStyleSettingPane.updateBean());
predefinedStyle.setPredefinedBackground(this.backgroundSettingPane.updateBean());
predefinedStyle.setComponentStyle(this.componentStyleSettingPane.updateBean());
predefinedStyle.setPredefinedColorStyle(this.colorFillStylePane.update());
predefinedStyle.setPredefinedChartStyle(this.chartStyleSettingPane.updateBean());
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.background.ColorBackground;
import com.fr.design.chartx.component.button.ColorButton;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
@ -32,7 +30,7 @@ import java.awt.image.BufferedImage;
* @version 10.0
* 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 = {
new Color(99, 178, 238),
@ -58,11 +56,11 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
private ChangeListener changeListener;
public ChartColorAdjustPane() {
public ColorAdjustPane() {
this(DEFAULT_COLORS);
}
public ChartColorAdjustPane(Color[] colors) {
public ColorAdjustPane(Color[] colors) {
iniListener();
createColorButton(colors);
createContentPane();
@ -217,7 +215,7 @@ public class ChartColorAdjustPane extends JPanel implements UIObserver {
if(colorButtons.size() < MAX_BUTTON) {
colorButtons.add(createColorButton(color));
}
ChartColorAdjustPane.this.stateChanged();
ColorAdjustPane.this.stateChanged();
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.background.ColorBackground;
import com.fr.design.style.AbstractSelectBox;
import com.fr.design.style.color.ColorSelectPane;
import javax.swing.JPanel;
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.TableLayout;
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 javax.swing.BorderFactory;
@ -38,7 +38,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
private UIButtonGroup groupButton;
private ChartColorAdjustPane colorAdjustPane;
private ColorAdjustPane colorAdjustPane;
private FixedGradientBar colorGradient;
public ChartPreFillStylePane() {
@ -59,7 +59,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 150), "gradient");
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
changeColorSetPane.add(colorAdjustPane = new ColorAdjustPane(), "acc");
cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER);
@ -124,9 +124,9 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
if (colorList.isEmpty()) {
List<Color> resultList = new ArrayList<>();
Collections.addAll(resultList, ChartColorAdjustPane.DEFAULT_COLORS);
Collections.addAll(resultList, ColorAdjustPane.DEFAULT_COLORS);
condition.setColorList(resultList);
colorAdjustPane.updateColor(ChartColorAdjustPane.DEFAULT_COLORS);
colorAdjustPane.updateColor(ColorAdjustPane.DEFAULT_COLORS);
} else {
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.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.gui.ilable.UILabel;
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() {
return new VanChartBorderWithRadiusPane();
return new VanChartBorderWithRadiusPane(true);
}
private JPanel createSeriesStylePane(double[] row, double[] col) {

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

@ -1,5 +1,6 @@
package com.fr.van.chart.custom.style;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.chartattr.Chart;
import com.fr.chartx.config.info.constant.ConfigType;
import com.fr.design.layout.TableLayout;
@ -91,7 +92,12 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot();
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) {
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.VanChartTooltipContentPane;
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.VanChartRangeLegendPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
@ -65,12 +66,12 @@ import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import java.awt.Component;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.awt.Component;
/**
* Created by Mitisky on 16/3/1.
@ -128,8 +129,8 @@ public class PlotFactory {
legendMap.put(VanChartMultiPiePlot.class, VanLegendPaneWidthOutHighlight.class);
legendMap.put(VanChartScatterPlot.class, VanChartRangeLegendPane.class);
legendMap.put(VanChartBubblePlot.class, VanChartRangeLegendPane.class);
legendMap.put(VanChartMapPlot.class, VanChartRangeLegendPane.class);
legendMap.put(VanChartDrillMapPlot.class, VanChartRangeLegendPane.class);
legendMap.put(VanChartMapPlot.class, MapRangeLegendPane.class);
legendMap.put(VanChartDrillMapPlot.class, MapRangeLegendPane.class);
legendMap.put(VanChartHeatMapPlot.class, HeatMapRangeLegendPane.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;
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.ChartConstants;
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.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.mainframe.DesignerBean;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.design.mainframe.predefined.ui.detail.ColorFillStylePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
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.
*/
public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> implements DesignerBean {
public class VanChartFillStylePane extends ColorFillStylePane implements DesignerBean {
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() {
this.setLayout(new BorderLayout());
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();
super();
DesignerContext.setDesignerBean(name, this);
}
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);
}
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 styleSelectBoxChange() {
getCustomPane().setVisible(getStyleSelectBox().getSelectedIndex() != 0);
super.styleSelectBoxChange();
}
});
protected ColorSchemeComboBox createColorSchemeComboBox() {
return new ColorSchemeComboBox(null, true);
}
protected void initLayout() {
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
this.setLayout(new BorderLayout());
super.initLayout();
this.add(getContentPane(), BorderLayout.CENTER);
}
protected JPanel getContentPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
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},
JPanel contentPane = super.getContentPane();
contentPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
return contentPane;
}
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
@ -161,107 +59,31 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> implemen
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color");
}
@Override
public void populateBean(AttrFillStyle condition) {
String fillStyleName = condition == null ? "" : condition.getFillStyleName();
if (StringUtils.isBlank(fillStyleName) || !styleSelectBox.getItems().contains(fillStyleName)) {//兼容处理
if (condition == null || condition.getColorStyle() == ChartConstants.COLOR_DEFAULT) {
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);
if (condition.isPredefinedStyle()) {
getStyleSelectBox().setSelectType(ColorSchemeComboBox.SelectType.DEFAULT);
return;
}
populateBean(condition.getColorFillStyle());
}
@Override
public AttrFillStyle updateBean() {
switch (styleSelectBox.getSelectType()) {
case COMBINATION_COLOR:
return updateCombinationColor();
case GRADATION_COLOR:
return updateGradationColor();
case DEFAULT:
return updateDefaultColor();
default:
return updateNormalColor();
public void updateBean(AttrFillStyle attrFillStyle) {
if (getStyleSelectBox().getSelectedIndex() == 0) {
attrFillStyle.setPredefinedStyle(true);
return;
}
}
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);
return condition;
}
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;
attrFillStyle.setPredefinedStyle(false);
attrFillStyle.setColorFillStyle(updateBean());
}
/**
* 刷新组件对象
*/
public void refreshBeanElement() {
AttrFillStyle attrFillStyle = updateBean();
AttrFillStyle attrFillStyle = new AttrFillStyle();
updateBean(attrFillStyle);
styleSelectBox.refresh();
getStyleSelectBox().refresh();
populateBean(attrFillStyle);
GUICoreUtils.repaint(this);

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

@ -283,7 +283,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayoutHelper.createTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
}
private JPanel createCommonStylePane() {
protected JPanel createCommonStylePane() {
styleButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"),
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);
}
@ -693,6 +693,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
* CHART-1295
* 通过格式的面板宽度来判断在自定义js代码中是否显示this.seriesName字符串
* 图表对于其他的格式有要求也可以在这里继续添加
*
* @param attrTooltipContent
*/
private void updateFormatsWithPaneWidth(AttrTooltipContent attrTooltipContent) {

29
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.ImageBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane;
import com.fr.general.Background;
import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
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() {
typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout();
paneList = new ArrayList<BackgroundQuickPane>();
paneList = new ArrayList<>();
initList();
@ -130,6 +130,7 @@ public class VanChartBackgroundPane extends BasicPane {
/**
* 返回标题
*
* @return 标题
*/
public String title4PopupWindow() {
@ -140,13 +141,17 @@ public class VanChartBackgroundPane extends BasicPane {
if (attr == null) {
return;
}
Background background = attr.getBackground();
double alpha = attr.getAlpha() * ALPHA_V;
transparent.populateBean(alpha);
if (shadow != null) {
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);
if (pane.accept(background)) {
pane.populateBean(background);
@ -160,13 +165,17 @@ public class VanChartBackgroundPane extends BasicPane {
if (attr == null) {
attr = new GeneralInfo();
}
attr.setBackground(paneList.get(typeComboBox.getSelectedIndex()).updateBean());
if(attr.getBackground() instanceof ImageBackground){
((ImageBackground) attr.getBackground()).setLayout(Constants.IMAGE_EXTEND);
}
updateBackground(attr);
attr.setAlpha((float) (transparent.updateBean() / ALPHA_V));
if (shadow != null) {
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.NullBackgroundQuickPane;
import com.fr.design.mainframe.backgroundpane.VanChartGradientPane;
/**
* 图表 属性表.背景设置 界面.(包括 , 颜色, 渐变)+开启阴影

100
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.chartglyph.GeneralInfo;
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.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
@ -17,20 +18,41 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
//线型 + 颜色
public class VanChartBorderPane extends BasicPane {
private static final long serialVersionUID = -7770029552989609464L;
private UIButtonGroup<Integer> autoButton;
protected LineComboBox currentLineCombo;
protected ColorSelectBox currentLineColorPane;
protected JPanel colorPanel;
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();
initColorPanel();
initContent();
}
protected void initComponents() {
currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
currentLineColorPane = new ColorSelectBox(100);
}
protected void initContent() {
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
@ -40,24 +62,61 @@ public class VanChartBorderPane extends BasicPane {
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() {
UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style"));
UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color"));
return new Component[][]{
new Component[]{null, null},
new Component[]{lineStyleLabel, UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)},
new Component[]{colorLabel, currentLineColorPane},
new Component[]{colorPanel, null},
};
}
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p, p};
private void initListener() {
autoButton.addActionListener(new ActionListener() {
@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 标题
*/
public String title4PopupWindow() {
@ -68,8 +127,12 @@ public class VanChartBorderPane extends BasicPane {
if (attr == null) {
return;
}
if (currentLineCombo != null) {
currentLineCombo.setSelectedLineStyle(attr.getBorderStyle());
}
if (currentLineColorPane != null) {
currentLineColorPane.setSelectObject(attr.getBorderColor());
}
}
@ -77,8 +140,12 @@ public class VanChartBorderPane extends BasicPane {
if (attr == null) {
attr = new GeneralInfo();
}
if (currentLineCombo != null) {
attr.setBorderStyle(currentLineCombo.getSelectedLineStyle());
}
if (currentLineColorPane != null) {
attr.setBorderColor(currentLineColorPane.getSelectObject());
}
}
@ -86,23 +153,44 @@ public class VanChartBorderPane extends BasicPane {
if (attrBorder == null) {
return;
}
if (autoButton != null) {
attrBorder.setAutoColor(autoButton.getSelectedIndex() == 0);
}
if (currentLineCombo != null) {
attrBorder.setBorderStyle(currentLineCombo.getSelectedLineStyle());
}
if (currentLineColorPane != null) {
attrBorder.setBorderColor(currentLineColorPane.getSelectObject());
}
}
public void populate(AttrBorder attr) {
if (attr == null) {
return;
}
if (autoButton != null) {
autoButton.setSelectedIndex(attr.isAutoColor() ? 0 : 1);
checkPreButton();
}
if (currentLineCombo != null) {
currentLineCombo.setSelectedLineStyle(attr.getBorderStyle());
}
if (currentLineColorPane != null) {
currentLineColorPane.setSelectObject(attr.getBorderColor());
}
}
public AttrBorder update() {
AttrBorder attr = new AttrBorder();
if (autoButton != null) {
attr.setAutoColor(autoButton.getSelectedIndex() == 0);
}
if (currentLineCombo != null) {
attr.setBorderStyle(currentLineCombo.getSelectedLineStyle());
}
if (currentLineColorPane != null) {
attr.setBorderColor(currentLineColorPane.getSelectObject());
}
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.ilable.UILabel;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.VanChartAttrHelper;
@ -19,12 +18,23 @@ import java.awt.Component;
public class VanChartBorderWithAlphaPane extends VanChartBorderPane{
private UINumberDragPane transparent;
public VanChartBorderWithAlphaPane() {
super();
}
public VanChartBorderWithAlphaPane(boolean hasAuto) {
super(hasAuto);
}
@Override
protected void initComponents() {
super.initComponents();
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
@ -35,7 +45,7 @@ public class VanChartBorderWithAlphaPane extends VanChartBorderPane{
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
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}
};
}

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 UISpinner radius;
public VanChartBorderWithRadiusPane() {
super();
}
public VanChartBorderWithRadiusPane(boolean hasAuto) {
super(hasAuto);
}
public UISpinner getRadius() {
return radius;
}
@Override
protected void initComponents() {
super.initComponents();
radius = new UISpinner(0,1000,1,0);
}
@Override
protected void initContent() {
this.add(new JSeparator(), BorderLayout.SOUTH);
super.initComponents();
super.initContent();
}
@Override
@ -38,7 +51,7 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
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}
} ;
}

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.chartattr.Plot;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.plugin.chart.base.AttrLabel;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelNoCheckPane;
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() {
}

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.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.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartLegend;
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.TableLayout4VanChartHelper;
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.border.VanChartBorderWithRadiusPane;
@ -54,7 +56,7 @@ public class VanChartPlotLegendPane extends BasicPane {
private ChartTextAttrPane textAttrPane;
private VanChartBorderWithRadiusPane borderPane;
private VanChartBackgroundWithOutImagePane backgroundPane;
private VanChartBackgroundPane backgroundPane;
private UIButtonGroup<Integer> location;
private UIToggleButton customFloatPositionButton;
private UIButtonGroup<LayoutType> layoutButton;
@ -135,7 +137,7 @@ public class VanChartPlotLegendPane extends BasicPane {
protected JPanel createLegendPaneWithoutHighlight() {
borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane();
backgroundPane = creatBackgroundPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -153,9 +155,13 @@ public class VanChartPlotLegendPane extends BasicPane {
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
protected VanChartBackgroundPane creatBackgroundPane(){
return new VanChartBackgroundWithOutImagePane();
}
protected JPanel createLegendPane() {
borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane();
backgroundPane = creatBackgroundPane();
highlightPane = createHighlightPane();
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
@ -281,7 +287,7 @@ public class VanChartPlotLegendPane extends BasicPane {
}
private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPane();
textAttrPane = new ChartTextAttrPaneWithPreStyle();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
}
@ -382,7 +388,7 @@ public class VanChartPlotLegendPane extends BasicPane {
legend = new VanChartLegend();
}
legend.setLegendVisible(isLegendVisible.isSelected());
legend.setFRFont(textAttrPane.updateFRFont());
textAttrPane.update(legend.getTextAttr());
borderPane.update(legend);
backgroundPane.update(legend);
@ -408,7 +414,7 @@ public class VanChartPlotLegendPane extends BasicPane {
public void populateBean(VanChartLegend legend) {
if (legend != null) {
isLegendVisible.setSelected(legend.isLegendVisible());
textAttrPane.populate(legend.getFRFont());
textAttrPane.populate(legend.getTextAttr());
borderPane.populate(legend);
backgroundPane.populate(legend);
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.TableLayoutHelper;
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.utils.gui.UIComponentUtils;
import com.fr.plugin.chart.attr.VanChartTitle;
@ -54,7 +54,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private JPanel titlePane;
private TinyFormulaPane titleContent;
private ChartTextAttrPane textAttrPane;
private ChartTextAttrPaneWithPreStyle textAttrPane;
private UIButtonGroup<Integer> alignmentPane;
private VanChartBackgroundWithOutShadowWithRadiusPane backgroundPane;
private UIToggleButton useHtml;
@ -171,7 +171,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
}
private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPane();
textAttrPane = new ChartTextAttrPaneWithPreStyle();
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.mainframe.chart.PaneTitleConstants;
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.widget.FRWidgetFactory;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
@ -79,7 +80,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
private JPanel labelGapValuePane;
protected LineComboBox axisLineStyle;
protected ColorSelectBox axisLineColor;
protected ColorSelectBoxWithPreStyle axisLineColor;
protected UIButtonGroup<AxisTickLineType> mainTick;
protected UIButtonGroup<AxisTickLineType> secondTick;
@ -327,24 +328,16 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
}
protected ChartTextAttrPane getChartTextAttrPane() {
return new ChartTextAttrPane() {
@Override
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);
return new ChartTextAttrPaneWithPreStyle() {
protected double getEdithAreaWidth() {
return TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
}
};
}
protected JPanel createLineStylePane(double[] row, double[] col) {
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")};
AxisTickLineType[] values = new AxisTickLineType[]{AxisTickLineType.TICK_LINE_OUTSIDE, AxisTickLineType.TICK_LINE_NONE};
mainTick = new UIButtonGroup<AxisTickLineType>(strings, values);
@ -362,7 +355,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
return new Component[][]{
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_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_Second_Graduation_Line")), secondTick},
};
@ -656,7 +649,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
axisLineStyle.setSelectedLineStyle(axis.getAxisStyle());
}
if (axisLineColor != null) {
axisLineColor.setSelectObject(axis.getAxisColor());
axisLineColor.populate(axis.getLineColorWithPreStyle());
}
if (mainTick != null) {
mainTick.setSelectedItem(axis.getMainTickLine());
@ -796,7 +789,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
axis.setAxisStyle(axisLineStyle.getSelectedLineStyle());
}
if (axisLineColor != null) {
axis.setAxisColor(axisLineColor.getSelectObject());
axis.setLineColorWithPreStyle(axisLineColor.update());
}
if (mainTick != null) {
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.gui.style.ChartTextAttrPane;
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.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis;
@ -102,7 +103,7 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
if (isMulti(gaugeStyle)) {
return new ChartTextAttrPaneWithAuto(FontAutoType.SIZE_AND_COLOR);
} 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[][]{
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_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[][]{
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_Color")), axisLineColor},
new Component[]{axisLineColor, null},
};
}

5
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.TableLayout4VanChartHelper;
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.style.background.radar.VanChartRadarAxisAreaPane;
@ -41,7 +42,11 @@ public class VanChartAreaBackgroundPane extends AbstractVanChartScrollPane<Chart
protected JPanel createContentPane() {
contentPane = new JPanel(new BorderLayout());
chartBorderPane = new VanChartBorderWithRadiusPane();
if(isPlot) {
chartBackgroundPane = new VanChartBackgroundPane();
} else {
chartBackgroundPane = new VanChartBackgroundPaneWithPreStyle();
}
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;

21
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.layout.TableLayout;
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.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper;
@ -43,8 +44,8 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
private LineTypeComboBox horizonLineType;
private LineTypeComboBox verticalLineType;
private ColorSelectBox horizontalColorBox;
private ColorSelectBox verticalColorBox;
private ColorSelectBoxWithPreStyle horizontalColorBox;
private ColorSelectBoxWithPreStyle verticalColorBox;
private JPanel horizontalColorPane;
private JPanel verticalColorPane;
@ -53,8 +54,8 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
}
private void initComponents() {
horizontalColorBox = new ColorSelectBox(PREFERRED_WIDTH);
verticalColorBox = new ColorSelectBox(PREFERRED_WIDTH);
horizontalColorBox = new ColorSelectBoxWithPreStyle(PREFERRED_WIDTH);
verticalColorBox = new ColorSelectBoxWithPreStyle(PREFERRED_WIDTH);
horizonLineType = 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() {
Component[][] upComponent = new Component[][]{
new Component[]{null, null},
new Component[]{null, horizontalColorBox}
new Component[]{horizontalColorBox, null}
};
horizontalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(upComponent);
Component[][] downComponent = new Component[][]{
new Component[]{null, null},
new Component[]{null, verticalColorBox}
new Component[]{verticalColorBox, null}
};
verticalColorPane = TableLayout4VanChartHelper.createGapTableLayoutPane(downComponent);
@ -220,12 +221,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
if (defaultXAxis != null) {
verticalColorBox.setSelectObject(defaultXAxis.getMainGridColor());
verticalColorBox.populate(defaultXAxis.getMainGridColorWithPreStyle());
verticalLineType.setSelectedItem(defaultXAxis.getGridLineType());
}
if (defaultYAxis != null) {
horizontalColorBox.setSelectObject(defaultYAxis.getMainGridColor());
horizontalColorBox.populate(defaultYAxis.getMainGridColorWithPreStyle());
horizonLineType.setSelectedItem(defaultYAxis.getGridLineType());
}
}
@ -253,12 +254,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane<Plot> {
VanChartAxis defaultYAxis = rectanglePlot.getDefaultYAxis();
if (defaultXAxis != null) {
defaultXAxis.setMainGridColor(verticalColorBox.getSelectObject());
defaultXAxis.setMainGridColorWithPreStyle(verticalColorBox.update());
defaultXAxis.setGridLineType((LineType) verticalLineType.getSelectedItem());
}
if (defaultYAxis != null) {
defaultYAxis.setMainGridColor(horizontalColorBox.getSelectObject());
defaultYAxis.setMainGridColorWithPreStyle(horizontalColorBox.update());
defaultYAxis.setGridLineType((LineType) horizonLineType.getSelectedItem());
}
}

24
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;
import com.fr.base.FRContext;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
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.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.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
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.TableLayout4VanChartHelper;
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 javax.swing.JPanel;
@ -71,6 +71,7 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
});
}
}
protected Component[][] creatComponent(JPanel dataSheetPane) {
Component[][] components = new Component[][]{
@ -79,15 +80,16 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
};
return components;
}
// 检查数据表界面是否可用.
private void checkDataSheetPaneUse() {
dataSheetPane.setVisible(isShowDataSheet.isSelected());
}
private JPanel createDataSheetPane() {
textAttrPane = new ChartTextAttrPane();
textAttrPane = createChartTextAttrPane();
formatPane = new FormatPaneWithNormalType();
borderPane = new VanChartBorderPane();
borderPane = createBorderPanePane();
double p = TableLayout.PREFERRED;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
@ -103,6 +105,14 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
protected VanChartBorderPane createBorderPanePane() {
return new VanChartBorderPaneWithPreStyle();
}
protected ChartTextAttrPane createChartTextAttrPane() {
return new ChartTextAttrPaneWithPreStyle();
}
@Override
/**
* 标题
@ -173,16 +183,14 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane<Chart> {
}
public void populate(DataSheet dataSheet) {
FRFont font = FRContext.getDefaultValues().getFRFont() == null ? FRFont.getInstance() : FRContext.getDefaultValues().getFRFont();
textAttrPane.populate(dataSheet.getFont() == null ? font : dataSheet.getFont());
textAttrPane.populate(dataSheet.getTextAttr());
formatPane.populateBean(dataSheet.getFormat());
borderPane.populate(dataSheet);
}
public DataSheet update(DataSheet dataSheet) {
dataSheet.setFont(textAttrPane.updateFRFont());
textAttrPane.update(dataSheet.getTextAttr());
dataSheet.setFormat(formatPane.update());
borderPane.update(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.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.plugin.chart.base.AttrDataSheet;
import com.fr.van.chart.designer.component.border.VanChartBorderPane;
import javax.swing.JPanel;
import java.awt.Component;
@ -46,4 +48,13 @@ public class VanchartDataSheetNoCheckPane extends VanChartDataSheetPane {
update(dataSheet);
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;
}
protected boolean isFontColorAuto() {
return getGaugeStyle() == GaugeStyle.RING || getGaugeStyle() == GaugeStyle.SLOT;
}
protected boolean hasLabelPosition(Plot plot) {
switch (getGaugeStyle()) {
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() {
return false;
return true;
}
private FontAutoType getFontAutoType() {

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.chart.base.AttrAlpha;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.base.GradientStyle;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
@ -81,6 +82,14 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
super(parent, plot);
}
public UINumberDragPane getTransparent() {
return transparent;
}
public void setTransparent(UINumberDragPane transparent) {
this.transparent = transparent;
}
protected JPanel getContentPane(boolean custom) {
if (custom) {
JScrollPane scrollPane = new JScrollPane();
@ -245,7 +254,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
}
protected VanChartBorderPane createDiffBorderPane() {
return new VanChartBorderPane();
return new VanChartBorderPane(true);
}
@ -340,7 +349,12 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
checkoutMapType(plot);
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) {//风格

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.format.CategoryNameFormatPaneWithCheckBox;
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.SeriesNameFormatPaneWithoutCheckBox;
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 java.awt.BorderLayout;
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.
@ -38,6 +41,9 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
private static final long serialVersionUID = -4414343926082129759L;
private UIButtonGroup gaugeLayout;//布局:横向、纵向
private UIButtonGroup<Integer> hingeColorAuto;
private UIButtonGroup<Integer> paneBackgroundColorAuto;
private UIButtonGroup<Integer> slotBackgroundColorAuto;
private ColorSelectBox hingeColor;//枢纽颜色
private ColorSelectBox hingeBackgroundColor;//枢纽背景颜色
private ColorSelectBox needleColor;//指针颜色
@ -62,7 +68,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f};
double[] rowSize = {p,p,p,p,p,p};
double[] rowSize = {p,p,p,p,p,p,p};
Component[][] components = new Component[][]{
new Component[]{createGaugeLayoutPane()},
new Component[]{createGaugeStylePane(rowSize, new double[]{f,e})},
@ -138,7 +144,8 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
initRotate();
return new Component[][]{
new Component[]{null, null},
getPaneBackgroundColor(),
getPaneBackgroundColorAuto(),
new Component[]{null, paneBackgroundColor},
getInnerPaneBackgroundColor(),
new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null},
getChutePercent()
@ -147,7 +154,8 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
return new Component[][]{
new Component[]{null, null},
getNeedleColor(),
getSlotBackgroundColor(),
getSlotBackgroundColorAuto(),
new Component[]{null, slotBackgroundColor},
new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null},
getChutePercent()
};
@ -155,25 +163,37 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
return new Component[][]{
new Component[]{null, null},
getNeedleColor(),
getSlotBackgroundColor(),
getSlotBackgroundColorAuto(),
new Component[]{null, slotBackgroundColor},
new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Length_Set")), null},
getThermometerWidth()
};
default:
return new Component[][]{
new Component[]{null, null},
getHingeColor(),
getHingeColorAuto(),
new Component[]{null, hingeColor},
getHingeBackgroundColor(),
getNeedleColor(),
getPaneBackgroundColor(),
getPaneBackgroundColorAuto(),
new Component[]{null, paneBackgroundColor},
new Component[]{createRadiusPane(Toolkit.i18nText("Fine-Design_Chart_Radius_Set")), null}
};
}
}
private Component[] getHingeColor() {
private Component[] getHingeColorAuto() {
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() {
@ -186,11 +206,39 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
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() {
paneBackgroundColor = new ColorSelectBox(120);
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() {
slotBackgroundColor = new ColorSelectBox(120);
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);
}
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) {
if(plot == null) {
@ -231,6 +293,18 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
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){
hingeColor.setSelectObject(detailStyle.getHingeColor());
}
@ -275,6 +349,15 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
GaugeDetailStyle detailStyle = gaugePlot.getGaugeDetailStyle();
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){
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.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
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.mainframe.chart.gui.ChartStylePane;
import com.fr.design.style.color.ColorSelectBox;
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.plugin.chart.VanChartAttrHelper;
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.DefaultComboBoxModel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@ -72,6 +79,8 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
//area
private VanChartBorderWithAlphaPane borderWithAlphaPane;
private UIButtonGroup<Integer> nullValueAuto;
private ColorSelectBox nullValueColorBox;
//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() {
borderWithAlphaPane = new VanChartBorderWithAlphaPane();
borderWithAlphaPane = new VanChartBorderWithAlphaPane(true);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -253,9 +277,39 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
}
protected JPanel createNullValueColorPane() {
nullValueAuto = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto"),
Toolkit.i18nText("Fine-Design_Chart_Custom")});
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() {
@ -445,7 +499,13 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
markerTypeCom.setSelectedItem(((VanChartMapPlot) plot).getMapMarkerType().toLocalString());
}
if (nullValueColorBox != null) {
if (((VanChartMapPlot) plot).isAutoNullValue()) {
nullValueAuto.setSelectedIndex(0);
} else {
nullValueAuto.setSelectedIndex(1);
}
nullValueColorBox.setSelectObject(((VanChartMapPlot) plot).getNullValueColor());
checkNullValueButton();
}
//大数据模式 恢复用注释。下面3行删除。
if (lineMapLargeDataModelGroup != null) {
@ -461,6 +521,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
((VanChartMapPlot) plot).setMapMarkerType(MapMarkerType.parseInt(markerTypeCom.getSelectedIndex()));
}
if (nullValueColorBox != null) {
((VanChartMapPlot) plot).setAutoNullValue(nullValueAuto.getSelectedIndex() == 0);
((VanChartMapPlot) plot).setNullValueColor(nullValueColorBox.getSelectObject());
}
//大数据模式 恢复用注释。下面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) {
String layerName = mapPlot.getDefaultGisLayerName();
mapPlot.getGisLayer().setGisLayerType(GISLayerType.PREDEFINED_LAYER);
mapPlot.getGisLayer().setLayerName(layerName);
mapPlot.getGisLayer().setGisLayerType(GISLayerType.AUTO);
mapPlot.getGisLayer().setLayerName(GISLayerType.getLocString(GISLayerType.AUTO));
gisLayer.setSelectedItem(mapPlot.getGisLayer().getShowItemName());
}

Loading…
Cancel
Save