diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java similarity index 85% rename from designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java rename to designer-base/src/main/java/com/fr/design/gui/icombobox/ColorSchemeComboBox.java index e09362cb6..044bb6518 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java +++ b/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 colorSchemes; + private boolean preDefined; + public ColorSchemeComboBox() { - this(null); + this(null, false); } public ColorSchemeComboBox(Map colorSchemes) { + this(colorSchemes, false); + } + + public ColorSchemeComboBox(Map colorSchemes, boolean preDefined) { + this.preDefined = preDefined; //通过配色方案的集合初始化下拉控件,如果参数为null,从配置中读取配色方案。 if (colorSchemes == null) { colorSchemes = getColorSchemesFromConfig(); @@ -59,22 +64,26 @@ public class ColorSchemeComboBox extends UIComboBox { //所有的样式名称 Iterator names = config.names(); - //添加默认的方案和第一个方案 - String defaultName = config.getCurrentStyle(); - ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName); - if (names.hasNext()) { - Object firstName = names.next(); - ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName); - if (defaultStyle == null) { - defaultStyle = firstStyle; - } - colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle)); - colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle)); + if (preDefined) { + colorSchemes.put(Toolkit.i18nText("Fine-Design_Chart_Predefined"), null); } else { - ColorInfo colorInfo = new ColorInfo(); - colorInfo.setGradient(false); - colorInfo.setColors(Collections.arrayToList(ChartConstants.CHART_COLOR_ARRAY)); - colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorInfo); + //添加默认的方案和第一个方案 + String defaultName = config.getCurrentStyle(); + ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName); + if (names.hasNext()) { + Object firstName = names.next(); + ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName); + if (defaultStyle == null) { + defaultStyle = firstStyle; + } + colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle)); + colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle)); + } else { + ColorInfo colorInfo = new ColorInfo(); + colorInfo.setGradient(false); + colorInfo.setColors(Collections.arrayToList(ChartConstants.CHART_COLOR_ARRAY)); + colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorInfo); + } } //添加其他的配色方案 diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartGradientPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/VanChartGradientPane.java similarity index 96% rename from designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartGradientPane.java rename to designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/VanChartGradientPane.java index 2cdcf2401..e891bd934 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartGradientPane.java +++ b/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; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java index d9e7e0839..ef7644f71 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/PredefinedStyleEditPane.java +++ b/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; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ChartStyleSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ChartStyleSettingPane.java new file mode 100644 index 000000000..6eb155eb6 --- /dev/null +++ b/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 { + + 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 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() { + + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java new file mode 100644 index 000000000..f22221958 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/ColorFillStylePane.java @@ -0,0 +1,284 @@ +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 { + + protected ColorSchemeComboBox styleSelectBox; + protected JPanel customPane; + protected JPanel changeColorSetPane; + protected FixedGradientBar colorGradient; + + protected CardLayout cardLayout; + + protected ColorAdjustPane colorAdjustPane; + + protected Color[] gradientColors; + protected 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(); + + } + + 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 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 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 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 colors = selectColorInfo.getColors(); + colorFillStyle.setColorList(colors); + colorFillStyle.setCustomFillStyle(true); + colorFillStyle.setColorStyle(isGradient ? ChartConstants.COLOR_GRADIENT : ChartConstants.COLOR_ACC); + return colorFillStyle; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/AbstractChartStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/AbstractChartStylePane.java new file mode 100644 index 000000000..2fd47d6b2 --- /dev/null +++ b/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); +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartAxisStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartAxisStylePane.java new file mode 100644 index 000000000..4c6fc16dd --- /dev/null +++ b/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()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartBackgroundStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartBackgroundStylePane.java new file mode 100644 index 000000000..0cb602eea --- /dev/null +++ b/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 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()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartDataSheetStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartDataSheetStylePane.java new file mode 100644 index 000000000..2da8ee35f --- /dev/null +++ b/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()); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartFontPane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartFontPane.java new file mode 100644 index 000000000..93c0f8a6b --- /dev/null +++ b/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())); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartLabelStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartLabelStylePane.java new file mode 100644 index 000000000..b51535b82 --- /dev/null +++ b/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 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()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartLegendStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartLegendStylePane.java new file mode 100644 index 000000000..c956dfcfd --- /dev/null +++ b/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()); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/predefined/ui/detail/chart/ChartTitleStylePane.java new file mode 100644 index 000000000..38fa767d3 --- /dev/null +++ b/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 com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title"); + } + + public void populate(PredefinedChartStyle chartStyle) { + chartFontPane.populate(chartStyle.getTitleFont()); + } + + + public void update(PredefinedChartStyle chartStyle) { + chartStyle.setTitleFont(chartFontPane.update()); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java similarity index 94% rename from designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java rename to designer-base/src/main/java/com/fr/design/style/color/ColorAdjustPane.java index b053a5eb9..909501857 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartColorAdjustPane.java +++ b/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(); } }); diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java b/designer-base/src/main/java/com/fr/design/style/color/ColorButton.java similarity index 97% rename from designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java rename to designer-base/src/main/java/com/fr/design/style/color/ColorButton.java index dd908505d..f5f2288ff 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/button/ColorButton.java +++ b/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; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java new file mode 100644 index 000000000..e1119df31 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPaneWithPreStyle.java @@ -0,0 +1,94 @@ +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 UIButtonGroup 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() == 1); + textFontPane.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); + } + + public void populate(TextAttr textAttr) { + if (textAttr.isPredefinedStyle()) { + preButton.setSelectedIndex(0); + } else { + preButton.setSelectedIndex(1); + } + super.populate(textAttr); + checkPreButton(); + } + + public void update(TextAttr textAttr) { + int selectedIndex = preButton.getSelectedIndex(); + if (selectedIndex == 0) { + textAttr.setPredefinedStyle(true); + } else { + textAttr.setPredefinedStyle(false); + } + super.update(textAttr); + } +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java new file mode 100644 index 000000000..5494f4d60 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ColorSelectBoxWithPreStyle.java @@ -0,0 +1,85 @@ +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 UIButtonGroup 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() == 1); + this.setPreferredSize(preButton.getSelectedIndex() == 1 ? new Dimension(0, 55) : new Dimension(0, 23)); + } + + public String title4PopupWindow() { + return null; + } + + public void populate(ColorWithPreStyle colorWithPreStyle) { + preButton.setSelectedIndex(colorWithPreStyle.isPredefinedStyle() ? 0 : 1); + colorSelectBox.setSelectObject(colorWithPreStyle.getColor()); + checkPreButton(); + } + + public ColorWithPreStyle update() { + ColorWithPreStyle colorWithPreStyle = new ColorWithPreStyle(); + colorWithPreStyle.setPredefinedStyle(preButton.getSelectedIndex() == 0); + colorWithPreStyle.setColor(colorSelectBox.getSelectObject()); + return colorWithPreStyle; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java index 09ba3d3ce..8091a78eb 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java +++ b/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 { private UIButtonGroup groupButton; - private ChartColorAdjustPane colorAdjustPane; + private ColorAdjustPane colorAdjustPane; private FixedGradientBar colorGradient; public ChartPreFillStylePane() { @@ -59,7 +59,7 @@ public class ChartPreFillStylePane extends BasicBeanPane { 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 { if (colorList.isEmpty()) { List 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()])); } diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java index 44b504ef3..98f3862dc 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java +++ b/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; diff --git a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java index a5a3238d5..c92cfd857 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java +++ b/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) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java index d92e35506..f8a920dbc 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java +++ b/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; @@ -90,10 +91,15 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane { VanChartCustomPlot plot = (VanChartCustomPlot) chart.getPlot(); - if (fillStylePane != null){ - plot.setPlotFillStyle(fillStylePane.updateBean()); + if (fillStylePane != null) { + AttrFillStyle plotFillStyle = plot.getPlotFillStyle(); + if(plotFillStyle == null) { + plotFillStyle = new AttrFillStyle(); + plot.setPlotFillStyle(plotFillStyle); + } + fillStylePane.updateBean(plotFillStyle); } - if (seriesPane != null){ + if (seriesPane != null) { plotSeriesPane.updateBean(plot); } //系列埋点 diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java index d3e1adbb9..b8e23c61f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java @@ -27,6 +27,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; @@ -63,12 +64,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. @@ -110,8 +111,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); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java index 8f3f83c5b..54d524d20 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java @@ -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 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); + } + protected void styleSelectBoxChange() { + customPane.setVisible(styleSelectBox.getSelectedIndex() != 0); + super.styleSelectBoxChange(); } - 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 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[][]{ + 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")), styleSelectBox}, new Component[]{null, customPane}, - }; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); - panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - return panel; } @Override @@ -161,105 +59,29 @@ public class VanChartFillStylePane extends BasicBeanPane 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()) { + styleSelectBox.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(); - } - } - - 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]); + public void updateBean(AttrFillStyle attrFillStyle) { + if (styleSelectBox.getSelectedIndex() == 0) { + attrFillStyle.setPredefinedStyle(true); + return; } - 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 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(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java index 314408c68..29c89e0f4 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPane.java +++ b/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(); + paneList = new ArrayList<>(); initList(); @@ -86,7 +86,7 @@ public class VanChartBackgroundPane extends BasicPane { @Override public void itemStateChanged(ItemEvent e) { - cardlayout.show(centerPane, (String)typeComboBox.getSelectedItem()); + cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem()); fireStateChanged(); } }); @@ -97,7 +97,7 @@ public class VanChartBackgroundPane extends BasicPane { protected Component[][] getPaneComponents() { shadow = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); - return new Component[][]{ + return new Component[][]{ new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill")), typeComboBox}, new Component[]{null, centerPane}, @@ -123,13 +123,14 @@ public class VanChartBackgroundPane extends BasicPane { if (e == null) { e = new ChangeEvent(this); } - ((ChangeListener)listeners[i + 1]).stateChanged(e); + ((ChangeListener) listeners[i + 1]).stateChanged(e); } } } /** * 返回标题 + * * @return 标题 */ public String title4PopupWindow() { @@ -137,16 +138,20 @@ public class VanChartBackgroundPane extends BasicPane { } public void populate(GeneralInfo attr) { - if(attr == null) { + if (attr == null) { return; } - Background background = attr.getBackground(); double alpha = attr.getAlpha() * ALPHA_V; transparent.populateBean(alpha); - if(shadow != null){ + 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){ + 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); + } + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java new file mode 100644 index 000000000..ba8c2352d --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java @@ -0,0 +1,47 @@ +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 { + + 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(0); + return; + } + super.populateBackground(attr, begin + 1); + } + + public void updateBackground(GeneralInfo attr) { + if (typeComboBox.getSelectedIndex() == 0) { + attr.setAutoBackground(true); + return; + } + attr.setAutoBackground(false); + super.updateBackground(attr); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java new file mode 100644 index 000000000..bc0a8f718 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithPreStyle.java @@ -0,0 +1,49 @@ +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 { + + @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(0); + return; + } + super.populateBackground(attr, begin + 1); + } + + public void updateBackground(GeneralInfo attr) { + if (typeComboBox.getSelectedIndex() == 0) { + attr.getBackgroundWithPreStyle().setPredefinedStyle(true); + return; + } + attr.getBackgroundWithPreStyle().setPredefinedStyle(false); + super.updateBackground(attr); + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java index e457f8c03..cf9530547 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutImagePane.java +++ b/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; /** * 图表 属性表.背景设置 界面.(包括 无, 颜色, 渐变)+开启阴影 diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java index 478929662..6ccc2d29f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java @@ -4,8 +4,10 @@ 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; import com.fr.design.layout.TableLayout; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.UIComponentUtils; @@ -16,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 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 p = TableLayout.PREFERRED; double f = TableLayout.FILL; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; @@ -38,22 +61,59 @@ public class VanChartBorderPane extends BasicPane { Component[][] components = getUseComponent(); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); - this.add(panel,BorderLayout.CENTER); + this.add(panel, BorderLayout.CENTER); + } + + protected void initColorPanel() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] rowSize; + UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color")); + Component[][] components; + if (autoButton != null) { + rowSize = new double[]{p, p}; + components = new Component[][]{ + new Component[]{colorLabel, autoButton}, + new Component[]{null, currentLineColorPane} + }; + } else { + rowSize = new double[]{p}; + components = new Component[][]{ + new Component[]{colorLabel, currentLineColorPane} + }; + } + colorPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); } protected Component[][] getUseComponent() { - UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")); - UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")); + UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")); return new Component[][]{ - new Component[]{null,null}, + new Component[]{null, null}, new Component[]{lineStyleLabel, UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)}, - new Component[]{colorLabel, currentLineColorPane}, + new Component[]{colorPanel, null}, }; } + 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() { @@ -61,44 +121,73 @@ public class VanChartBorderPane extends BasicPane { } public void populate(GeneralInfo attr) { - if(attr == null) { + if (attr == null) { return; } - currentLineCombo.setSelectedLineStyle(attr.getBorderStyle()); - currentLineColorPane.setSelectObject(attr.getBorderColor()); + if (currentLineCombo != null) { + currentLineCombo.setSelectedLineStyle(attr.getBorderStyle()); + } + if (currentLineColorPane != null) { + currentLineColorPane.setSelectObject(attr.getBorderColor()); + } } public void update(GeneralInfo attr) { - if(attr == null) { + if (attr == null) { attr = new GeneralInfo(); } - attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); - attr.setBorderColor(currentLineColorPane.getSelectObject()); + if (currentLineCombo != null) { + attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); + } + if (currentLineColorPane != null) { + attr.setBorderColor(currentLineColorPane.getSelectObject()); + } } - public void update(AttrBorder attrBorder){ - if(attrBorder == null){ + public void update(AttrBorder attrBorder) { + if (attrBorder == null) { return; } - attrBorder.setBorderStyle(currentLineCombo.getSelectedLineStyle()); - attrBorder.setBorderColor(currentLineColorPane.getSelectObject()); + 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) { + if (attr == null) { return; } - currentLineCombo.setSelectedLineStyle(attr.getBorderStyle()); - currentLineColorPane.setSelectObject(attr.getBorderColor()); + 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(); - - attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); - attr.setBorderColor(currentLineColorPane.getSelectObject()); + if (autoButton != null) { + attr.setAutoColor(autoButton.getSelectedIndex() == 0); + } + if (currentLineCombo != null) { + attr.setBorderStyle(currentLineCombo.getSelectedLineStyle()); + } + if (currentLineColorPane != null) { + attr.setBorderColor(currentLineColorPane.getSelectObject()); + } return attr; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPaneWithPreStyle.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPaneWithPreStyle.java new file mode 100644 index 000000000..790082ae4 --- /dev/null +++ b/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()); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java index e2ff67c91..724cefe92 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithAlphaPane.java +++ b/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} }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java index 63eff9047..f6bbe9c41 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java @@ -7,7 +7,6 @@ import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; - import javax.swing.JSeparator; import java.awt.BorderLayout; import java.awt.Component; @@ -19,11 +18,24 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane { private static final long serialVersionUID = -3937853702118283803L; private UISpinner radius; + public VanChartBorderWithRadiusPane() { + super(); + } + + public VanChartBorderWithRadiusPane(boolean hasAuto) { + super(hasAuto); + } + @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 @@ -34,7 +46,7 @@ public class VanChartBorderWithRadiusPane 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_Radius")),radius} } ; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartLabelConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartLabelConditionPane.java index 706a9cb75..bdf73c779 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartLabelConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartLabelConditionPane.java @@ -3,9 +3,7 @@ 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; import javax.swing.JPanel; @@ -27,7 +25,7 @@ public class VanChartLabelConditionPane extends AbstractNormalMultiLineCondition } protected VanChartPlotLabelPane createLabelPane() { - return new VanChartPlotLabelNoCheckPane(getPlot(),null); + return new VanChartPlotLabelPane(getPlot(),null, true); } public VanChartLabelConditionPane(ConditionAttributesPane conditionAttributesPane, Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java index cb316dffe..d77a106a2 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java +++ b/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() { } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/MapRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/MapRangeLegendPane.java new file mode 100644 index 000000000..7c88c088a --- /dev/null +++ b/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(); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java index 241a93ea0..ef1e8573a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java +++ b/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 location; private UIToggleButton customFloatPositionButton; private UIButtonGroup 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()) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java index 3d5042e6a..d5dba9df8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java +++ b/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 { private JPanel titlePane; private TinyFormulaPane titleContent; - private ChartTextAttrPane textAttrPane; + private ChartTextAttrPaneWithPreStyle textAttrPane; private UIButtonGroup alignmentPane; private VanChartBackgroundWithOutShadowWithRadiusPane backgroundPane; private UIToggleButton useHtml; @@ -171,7 +171,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { } private JPanel createTitleStylePane() { - textAttrPane = new ChartTextAttrPane(); + textAttrPane = new ChartTextAttrPaneWithPreStyle(); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java index be2c7d8a5..3a5904d70 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java +++ b/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 { private JPanel labelGapValuePane; protected LineComboBox axisLineStyle; - protected ColorSelectBox axisLineColor; + protected ColorSelectBoxWithPreStyle axisLineColor; protected UIButtonGroup mainTick; protected UIButtonGroup secondTick; @@ -327,24 +328,16 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { } 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(strings, values); @@ -362,7 +355,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane { 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 { 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 { axis.setAxisStyle(axisLineStyle.getSelectedLineStyle()); } if (axisLineColor != null) { - axis.setAxisColor(axisLineColor.getSelectObject()); + axis.setLineColorWithPreStyle(axisLineColor.update()); } if (mainTick != null) { axis.setMainTickLine(mainTick.getSelectedItem()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java index 39c6321a2..60c77734c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java +++ b/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(); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarXAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarXAxisPane.java index c69fc9b52..a280bc394 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarXAxisPane.java +++ b/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}, }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java index d30d24573..c528fe734 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/radar/VanChartRadarYAxisPane.java +++ b/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}, }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java index 48473996f..d53a7ebc6 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAreaBackgroundPane.java +++ b/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 { 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 { } 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 { 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); @@ -143,7 +144,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane { return panel; } - protected AlertLineListControlPane getAlertLinePane () { + protected AlertLineListControlPane getAlertLinePane() { return new AlertLineListControlPane(); } @@ -153,7 +154,7 @@ public class VanChartAxisAreaPane extends BasicBeanPane { verticalColorBackground = new ColorSelectBox(100); Component[][] components = getIntervalPaneComponents(); JPanel defaultPane = TableLayoutHelper.createTableLayoutPane(components, row, col); - defaultPane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); + defaultPane.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0)); customIntervalBackground = getBackgroundListControlPane(); cardLayout = new CardLayout(); @@ -220,12 +221,12 @@ public class VanChartAxisAreaPane extends BasicBeanPane { 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 { 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()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java index 884a1e1c4..724fb6426 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanChartDataSheetPane.java +++ b/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; @@ -58,11 +58,11 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { double f = TableLayout.FILL; double[] columnSize = {f}; double[] rowSize = {p, p, p}; - Component[][] components =creatComponent(dataSheetPane); + Component[][] components = creatComponent(dataSheetPane); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); - this.add(panel,BorderLayout.CENTER); + this.add(panel, BorderLayout.CENTER); isShowDataSheet.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -71,7 +71,8 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { }); } } - protected Component[][] creatComponent(JPanel dataSheetPane){ + + protected Component[][] creatComponent(JPanel dataSheetPane) { Component[][] components = new Component[][]{ new Component[]{isShowDataSheet}, @@ -79,28 +80,37 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { }; return components; } + // 检查数据表界面是否可用. private void checkDataSheetPaneUse() { dataSheetPane.setVisible(isShowDataSheet.isSelected()); } - private JPanel createDataSheetPane(){ - textAttrPane = new ChartTextAttrPane(); + private JPanel createDataSheetPane() { + textAttrPane = createChartTextAttrPane(); formatPane = new FormatPaneWithNormalType(); - borderPane = new VanChartBorderPane(); + borderPane = createBorderPanePane(); double p = TableLayout.PREFERRED; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; double[] columnSize = {d, e}; - double[] rowSize = {p,p,p}; + double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"),formatPane),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"),textAttrPane),null}, - new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), formatPane), null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane), null}, + new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null}, }; - return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + } + + protected VanChartBorderPane createBorderPanePane() { + return new VanChartBorderPaneWithPreStyle(); + } + + protected ChartTextAttrPane createChartTextAttrPane() { + return new ChartTextAttrPaneWithPreStyle(); } @Override @@ -119,11 +129,11 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { @Override public void updateBean(Chart chart) { - if(chart == null) { + if (chart == null) { return; } Plot plot = chart.getPlot(); - if(plot == null) { + if (plot == null) { return; } DataSheet dataSheet = plot.getDataSheet(); @@ -133,7 +143,7 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { plot.setDataSheet(dataSheet); } dataSheet.setVisible(isShowDataSheet.isSelected()); - if(isShowDataSheet.isSelected()){ + if (isShowDataSheet.isSelected()) { update(dataSheet); } @@ -144,14 +154,14 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { @Override public void populateBean(Chart chart) { - if(chart == null || chart.getPlot() == null) { + if (chart == null || chart.getPlot() == null) { return; } - VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot)chart.getPlot(); - if(rectanglePlot.getXAxisList().size() == 1){ - if(ComparatorUtils.equals(rectanglePlot.getDefaultXAxis().getAxisType(), AxisType.AXIS_CATEGORY) + VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) chart.getPlot(); + if (rectanglePlot.getXAxisList().size() == 1) { + if (ComparatorUtils.equals(rectanglePlot.getDefaultXAxis().getAxisType(), AxisType.AXIS_CATEGORY) && rectanglePlot.getDefaultXAxis().getPosition() == VanChartConstants.AXIS_BOTTOM - && rectanglePlot.getCategoryNum() == 1 ){ + && rectanglePlot.getCategoryNum() == 1) { //只有单个分类坐标轴且坐标轴位置在下面,数据表才可以用 isShowDataSheet.setEnabled(!rectanglePlot.isAxisRotation()); @@ -173,16 +183,14 @@ public class VanChartDataSheetPane extends AbstractVanChartScrollPane { } 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; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanchartDataSheetNoCheckPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanchartDataSheetNoCheckPane.java index cc47a3fc1..a81ed1902 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanchartDataSheetNoCheckPane.java +++ b/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(); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java index 64187f89b..804296497 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java +++ b/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: diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java index bbdb6acb3..5f8c72b20 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java @@ -68,7 +68,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane { } protected boolean isFontColorAuto() { - return false; + return true; } private FontAutoType getFontAutoType() { diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index c506d89ea..ff09fa828 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -7,12 +7,12 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIToggleButton; 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.ChartTextAttrPane; +import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithPreStyle; import com.fr.design.style.color.ColorSelectBox; -import com.fr.design.i18n.Toolkit; - import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot; import com.fr.plugin.chart.base.AttrLabelDetail; @@ -55,18 +55,24 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected VanChartStylePane parent; private Plot plot; + private boolean inCondition; public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent) { + this(plot, parent, false); + } + + public VanChartPlotLabelDetailPane(Plot plot, VanChartStylePane parent, boolean inCondition) { this.parent = parent; this.plot = plot; + this.inCondition = inCondition; initLabelDetailPane(plot); } - protected void initLabelDetailPane (Plot plot) { + protected void initLabelDetailPane(Plot plot) { this.setLayout(new BorderLayout()); initToolTipContentPane(plot); JPanel contentPane = createLabelPane(plot); - this.add(contentPane,BorderLayout.CENTER); + this.add(contentPane, BorderLayout.CENTER); } public Plot getPlot() { @@ -90,16 +96,16 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { - if(hasLabelPosition(plot)){ + if (hasLabelPosition(plot)) { return new Component[][]{ - new Component[]{dataLabelContentPane,null}, + new Component[]{dataLabelContentPane, null}, new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null}, - new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot),null}, + new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, }; } else { - return new Component[][]{ - new Component[]{dataLabelContentPane,null}, - new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot),null}, + return new Component[][]{ + new Component[]{dataLabelContentPane, null}, + new Component[]{createLabelStylePane(getLabelStyleRowSize(p), columnSize, plot), null}, }; } } @@ -109,7 +115,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } protected double[] getLabelPaneRowSize(Plot plot, double p) { - return hasLabelPosition(plot) ? new double[]{p,p,p,p,p} : new double[]{p,p,p}; + return hasLabelPosition(plot) ? new double[]{p, p, p, p, p} : new double[]{p, p, p}; } protected boolean hasLabelPosition(Plot plot) { @@ -199,8 +205,8 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } - protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ - JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); + protected JPanel getLabelPositionPane(Component[][] comps, double[] row, double[] col) { + JPanel panel = TableLayoutHelper.createTableLayoutPane(comps, row, col); return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); } @@ -217,32 +223,36 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel createLabelStylePane(double[] row, double[] col, Plot plot) { style = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Custom")}); - textFontPane =initTextFontPane(); + textFontPane = initTextFontPane(); initStyleListener(); - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(getLabelStyleComponents(plot),row,col); + JPanel panel = inCondition ? TableLayout4VanChartHelper.createGapTableLayoutPane(getLabelStyleComponents(plot), row, col) : + textFontPane; return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), panel); } - protected ChartTextAttrPane initTextFontPane () { - return new ChartTextAttrPane(){ - protected Component[][] getComponents(JPanel buttonPane) { - return new Component[][]{ - new Component[]{null, null}, - new Component[]{null, getFontNameComboBox()}, - new Component[]{null, buttonPane} - }; - } - }; + protected ChartTextAttrPane initTextFontPane() { + if (inCondition) { + return new ChartTextAttrPane() { + protected Component[][] getComponents(JPanel buttonPane) { + return new Component[][]{ + new Component[]{null, null}, + new Component[]{null, getFontNameComboBox()}, + new Component[]{null, buttonPane} + }; + } + }; + } + return new ChartTextAttrPaneWithPreStyle(); } protected Component[][] getLabelStyleComponents(Plot plot) { UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Character"), SwingConstants.LEFT); return new Component[][]{ - new Component[]{null,null}, - new Component[]{text,style}, - new Component[]{textFontPane,null}, + new Component[]{null, null}, + new Component[]{text, style}, + new Component[]{textFontPane, null}, }; } @@ -266,45 +276,48 @@ public class VanChartPlotLabelDetailPane extends BasicPane { private void checkAllUse() { checkStyleUse(); - if(tractionLine == null){ + if (tractionLine == null) { return; } checkPositionEnabled(); } protected void checkStyleUse() { - textFontPane.setVisible(style.getSelectedIndex() == 1); - textFontPane.setPreferredSize(style.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); + if (inCondition) { + textFontPane.setVisible(style.getSelectedIndex() == 1); + textFontPane.setPreferredSize(style.getSelectedIndex() == 1 ? new Dimension(0, 60) : new Dimension(0, 0)); + } } private void checkPosition() { tractionLine.setSelected(position.getSelectedItem() == Constants.OUTSIDE); checkPositionEnabled(); } + private void checkPositionEnabled() { tractionLinePane.setVisible(position.getSelectedItem() == Constants.OUTSIDE); } - protected void checkPane(){ + protected void checkPane() { checkPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")); } public void populate(AttrLabelDetail detail) { checkPane(); dataLabelContentPane.populateBean(detail.getContent()); - if(position != null){ + if (position != null) { position.setSelectedItem(detail.getPosition()); } - if(tractionLine != null){ + if (tractionLine != null) { tractionLine.setSelected(detail.isShowGuidLine()); } - if(autoAdjust != null){ + if (autoAdjust != null) { autoAdjust.setSelectedIndex(detail.isAutoAdjust() == true ? 0 : 1); } style.setSelectedIndex(detail.isCustom() ? 1 : 0); textFontPane.populate(detail.getTextAttr()); - if(backgroundColor != null){ + if (backgroundColor != null) { backgroundColor.setSelectObject(detail.getBackgroundColor()); } @@ -315,23 +328,23 @@ public class VanChartPlotLabelDetailPane extends BasicPane { public void update(AttrLabelDetail detail) { detail.setContent(dataLabelContentPane.updateBean()); - if(position != null && position.getSelectedItem() != null){ + if (position != null && position.getSelectedItem() != null) { detail.setPosition(position.getSelectedItem()); - } else if(position != null){ + } else if (position != null) { position.setSelectedItem(detail.getPosition()); } detail.setAutoAdjust(autoAdjust != null && autoAdjust.getSelectedItem()); - if(tractionLine != null){ + if (tractionLine != null) { detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE); } detail.setCustom(style.getSelectedIndex() == 1); - if(textFontPane != null){ - detail.setTextAttr(textFontPane.update()); + if (textFontPane != null) { + textFontPane.update(detail.getTextAttr()); } - if(backgroundColor != null){ + if (backgroundColor != null) { detail.setBackgroundColor(backgroundColor.getSelectObject()); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelNoCheckPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelNoCheckPane.java deleted file mode 100644 index 95eb30204..000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelNoCheckPane.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fr.van.chart.designer.style.label; - -import com.fr.chart.chartattr.Plot; -import com.fr.plugin.chart.base.AttrLabel; -import com.fr.van.chart.designer.style.VanChartStylePane; - -import java.awt.BorderLayout; - -/** - * 条件属性中用到 - */ -public class VanChartPlotLabelNoCheckPane extends VanChartPlotLabelPane { - - private static final long serialVersionUID = 8124894034484334810L; - - public VanChartPlotLabelNoCheckPane(Plot plot,VanChartStylePane parent) { - super(plot, parent); - } - - protected void addComponents() { - this.setLayout(new BorderLayout()); - this.add(labelPane,BorderLayout.CENTER); - } - - public void populate(AttrLabel attr) { - super.populate(attr); - isLabelShow.setSelected(true); - labelPane.setVisible(true); - } -} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java index e0a007dd2..35903c34a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelPane.java @@ -28,9 +28,16 @@ public class VanChartPlotLabelPane extends BasicPane { protected JPanel labelPane; + protected boolean inCondition; + public VanChartPlotLabelPane(Plot plot, VanChartStylePane parent) { + this(plot, parent, false); + } + + public VanChartPlotLabelPane(Plot plot, VanChartStylePane parent, boolean inCondition) { this.parent = parent; this.plot = plot; + this.inCondition = inCondition; isLabelShow = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Label")); labelPane = new JPanel(new BorderLayout(0, 4)); createLabelPane(); @@ -38,29 +45,35 @@ public class VanChartPlotLabelPane extends BasicPane { } protected void createLabelPane() { - labelDetailPane = new VanChartPlotLabelDetailPane(this.plot, this.parent); + labelDetailPane = new VanChartPlotLabelDetailPane(this.plot, this.parent, inCondition); labelPane.add(labelDetailPane, BorderLayout.CENTER); } protected void addComponents() { - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - double[] columnSize = {f}; - double[] rowSize = {p,p}; - Component[][] components = new Component[][]{ - new Component[]{isLabelShow}, - new Component[]{labelPane} - }; - - JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); this.setLayout(new BorderLayout()); - this.add(panel,BorderLayout.CENTER); - - isLabelShow.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - checkBoxUse(); - } - }); + if (inCondition) { + isLabelShow.setSelected(true); + this.add(labelPane, BorderLayout.CENTER); + } else { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{isLabelShow}, + new Component[]{labelPane} + }; + + JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + this.setLayout(new BorderLayout()); + this.add(panel, BorderLayout.CENTER); + + isLabelShow.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + checkBoxUse(); + } + }); + } } @Override @@ -70,7 +83,7 @@ public class VanChartPlotLabelPane extends BasicPane { private void checkBoxUse() { labelPane.setVisible(isLabelShow.isSelected()); - if(checkEnabled4Large()) { + if (checkEnabled4Large()) { isLabelShow.setEnabled(!PlotFactory.largeDataModel(plot)); } } @@ -80,19 +93,21 @@ public class VanChartPlotLabelPane extends BasicPane { } public void populate(AttrLabel attr) { - if(attr == null) { - attr = ((VanChartPlot)this.plot).getDefaultAttrLabel(); + if (attr == null) { + attr = ((VanChartPlot) this.plot).getDefaultAttrLabel(); } - isLabelShow.setSelected(attr.isEnable()); labelDetailPane.populate(attr.getAttrLabelDetail()); - checkBoxUse(); + if (!inCondition) { + isLabelShow.setSelected(attr.isEnable()); + checkBoxUse(); + } } public AttrLabel update() { //刪除返回null,否則無法保存不顯示標籤的屬性 - AttrLabel attrLabel = ((VanChartPlot)this.plot).getDefaultAttrLabel(); + AttrLabel attrLabel = ((VanChartPlot) this.plot).getDefaultAttrLabel(); attrLabel.setEnable(isLabelShow.isSelected()); labelDetailPane.update(attrLabel.getAttrLabelDetail()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java index e8f9def4b..855b2658b 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java +++ b/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; @@ -64,7 +65,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP protected VanChartFillStylePane vanChartFillStylePane;//配色 - private UINumberDragPane transparent;//不透明度 + protected UINumberDragPane transparent;//不透明度 protected VanChartStackedAndAxisListControlPane stackAndAxisEditPane;//堆積和坐標軸 protected JPanel stackAndAxisEditExpandablePane;//堆積和坐標軸展开面板 @@ -245,7 +246,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP } protected VanChartBorderPane createDiffBorderPane() { - return new VanChartBorderPane(); + return new VanChartBorderPane(true); } @@ -340,7 +341,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) {//风格 diff --git a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java index af7aaf001..ed237d4c3 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java +++ b/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 hingeColorAuto; + private UIButtonGroup paneBackgroundColorAuto; + private UIButtonGroup 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()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java index bf44ded48..1d008aebd 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java +++ b/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 nullValueAuto; private ColorSelectBox nullValueColorBox; //point @@ -235,9 +244,24 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { } } + //不透明度 + protected JPanel createAlphaPane() { + transparent = 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(transparent)}, + }; + 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行删除。 diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index e58797dca..17b275e30 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/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()); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterLabelConditionPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterLabelConditionPane.java index 2ff71ee0c..cd03c58d5 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterLabelConditionPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterLabelConditionPane.java @@ -13,6 +13,6 @@ public class VanChartScatterLabelConditionPane extends VanChartLabelConditionPan @Override protected VanChartPlotLabelPane createLabelPane() { - return new VanChartScatterPlotLabelNoCheckPane(getPlot(), null); + return new VanChartScatterPlotLabelPane(getPlot(), null, true); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelDetailPane.java index d507934e6..028244098 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelDetailPane.java @@ -6,19 +6,23 @@ import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane; import com.fr.van.chart.scatter.VanChartScatterLabelContentPane; - /** * 散点图的分类,多x、y标签 */ public class VanChartScatterPlotLabelDetailPane extends VanChartPlotLabelDetailPane { private static final long serialVersionUID = 5176535960949074940L; + public VanChartScatterPlotLabelDetailPane(Plot plot, VanChartStylePane parent) { super(plot, parent); } + public VanChartScatterPlotLabelDetailPane(Plot plot, VanChartStylePane parent, boolean inCondition) { + super(plot, parent, inCondition); + } + @Override protected void initToolTipContentPane(Plot plot) { - dataLabelContentPane = new VanChartScatterLabelContentPane(parent,VanChartScatterPlotLabelDetailPane.this); + dataLabelContentPane = new VanChartScatterLabelContentPane(parent, VanChartScatterPlotLabelDetailPane.this); } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelNoCheckPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelNoCheckPane.java deleted file mode 100644 index 71e783b06..000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelNoCheckPane.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fr.van.chart.scatter.component.label; - -import com.fr.chart.chartattr.Plot; -import com.fr.plugin.chart.base.AttrLabel; -import com.fr.van.chart.designer.style.VanChartStylePane; - -import java.awt.BorderLayout; - -/** - * 条件属性中用到 - */ -public class VanChartScatterPlotLabelNoCheckPane extends VanChartScatterPlotLabelPane { - - private static final long serialVersionUID = 8124894034484334810L; - - public VanChartScatterPlotLabelNoCheckPane(Plot plot, VanChartStylePane parent) { - super(plot, parent); - } - - protected void addComponents() { - this.setLayout(new BorderLayout()); - this.add(labelPane,BorderLayout.CENTER); - } - - public void populate(AttrLabel attr) { - super.populate(attr); - isLabelShow.setSelected(true); - labelPane.setVisible(true); - } -} \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelPane.java index 632ce7f6f..9d8c5f0de 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/component/label/VanChartScatterPlotLabelPane.java @@ -16,9 +16,13 @@ public class VanChartScatterPlotLabelPane extends VanChartPlotLabelPane { super(plot, parent); } + public VanChartScatterPlotLabelPane(Plot plot, VanChartStylePane parent, boolean inCondition) { + super(plot, parent, inCondition); + } + @Override protected void createLabelPane() { - labelDetailPane = new VanChartScatterPlotLabelDetailPane(this.plot, this.parent); + labelDetailPane = new VanChartScatterPlotLabelDetailPane(this.plot, this.parent, this.inCondition); labelPane.add(labelDetailPane, BorderLayout.CENTER); } }