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 29c89e0f4..a0d664fc0 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 @@ -44,13 +44,25 @@ public class VanChartBackgroundPane extends BasicPane { protected JPanel centerPane; + private boolean hasAuto; + public VanChartBackgroundPane() { + this(false); + } + + public VanChartBackgroundPane(boolean hasAuto) { + this.hasAuto = hasAuto; initComponents(); JPanel panel = initContentPanel(); this.setLayout(new BorderLayout()); this.add(panel, BorderLayout.CENTER); } + + public boolean isHasAuto() { + return hasAuto; + } + protected JPanel initContentPanel() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; 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 deleted file mode 100644 index cd5d26d4a..000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundPaneWithAutoColor.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.fr.van.chart.designer.component.background; - -import com.fr.chart.chartglyph.GeneralInfo; -import com.fr.design.i18n.Toolkit; -import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; -import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; -import com.fr.design.mainframe.backgroundpane.VanChartGradientPane; - -/** - * @author Bjorn - * @version 10.0 - * Created by Bjorn on 2020-09-11 - */ -public class VanChartBackgroundPaneWithAutoColor extends VanChartBackgroundPane { - - private static final int AUTO = 0; - - public VanChartBackgroundPaneWithAutoColor() { - super(); - } - - protected void initList() { - paneList.add(new NullBackgroundQuickPane() { - public String title4PopupWindow() { - return Toolkit.i18nText("Fine-Design_Chart_Automatic"); - } - }); - paneList.add(new NullBackgroundQuickPane()); - paneList.add(new ColorBackgroundQuickPane()); - paneList.add(new VanChartGradientPane()); - } - - public void populateBackground(GeneralInfo attr, int begin) { - if (attr.isAutoBackground()) { - typeComboBox.setSelectedIndex(AUTO); - return; - } - super.populateBackground(attr, begin + 1); - } - - public void updateBackground(GeneralInfo attr) { - if (typeComboBox.getSelectedIndex() == AUTO) { - attr.setAutoBackground(true); - return; - } - attr.setAutoBackground(false); - super.updateBackground(attr); - } -} 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 cf9530547..06c7aba70 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 @@ -1,5 +1,7 @@ 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; @@ -11,13 +13,49 @@ import com.fr.design.mainframe.backgroundpane.VanChartGradientPane; public class VanChartBackgroundWithOutImagePane extends VanChartBackgroundPane { private static final long serialVersionUID = 1322979785605013853L; + private static final int AUTO = 0; + public VanChartBackgroundWithOutImagePane() { - super(); + this(false); + } + + public VanChartBackgroundWithOutImagePane(boolean hasAuto) { + super(hasAuto); } protected void initList() { + if (isHasAuto()) { + 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 (isHasAuto()) { + if (attr.isAutoBackground()) { + typeComboBox.setSelectedIndex(AUTO); + return; + } + super.populateBackground(attr, begin + 1); + } else { + super.populateBackground(attr, begin); + } + } + + public void updateBackground(GeneralInfo attr) { + if (isHasAuto()) { + if (typeComboBox.getSelectedIndex() == AUTO) { + attr.setAutoBackground(true); + return; + } + attr.setAutoBackground(false); + } + super.updateBackground(attr); + } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java index dadd754d6..902d10ad7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/background/VanChartBackgroundWithOutShadowWithRadiusPane.java @@ -19,6 +19,10 @@ public class VanChartBackgroundWithOutShadowWithRadiusPane extends VanChartBackg super(); } + public VanChartBackgroundWithOutShadowWithRadiusPane(boolean hasAuto){ + super(hasAuto); + } + protected Component[][] getPaneComponents() { radius = new UISpinner(0,1000,1,0); return new Component[][]{ 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 index 7c88c088a..c2b1620b4 100644 --- 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 @@ -1,7 +1,7 @@ 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; +import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane; /** * @author Bjorn @@ -20,6 +20,6 @@ public class MapRangeLegendPane extends VanChartRangeLegendPane { @Override protected VanChartBackgroundPane creatBackgroundPane(){ - return new VanChartBackgroundPaneWithAutoColor(); + return new VanChartBackgroundWithOutImagePane(true); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java index 4dc9b6ba5..32a4f8e54 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartStylePane.java @@ -25,8 +25,8 @@ public class VanChartStylePane extends ChartStylePane { protected java.util.List getPaneList() { java.util.List paneList = new ArrayList(); Plot plot = getChart().getPlot(); - paneList.add(new VanChartTitlePane(VanChartStylePane.this)); - if(plot.isSupportLegend()){ + paneList.add(createVanChartTitlePane()); + if (plot.isSupportLegend()) { paneList.add(new VanChartLegendPane(VanChartStylePane.this)); } @@ -34,14 +34,14 @@ public class VanChartStylePane extends ChartStylePane { paneList.add(createChartSeriesPane()); - if(plot.isHaveAxis()){ - if(plot instanceof VanChartAxisPlot) { + if (plot.isHaveAxis()) { + if (plot instanceof VanChartAxisPlot) { createVanChartAxisPane(paneList, (VanChartAxisPlot) plot); } addOtherAxisPane(paneList, plot); - if(plot.isSupportDataSheet()) { + if (plot.isSupportDataSheet()) { paneList.add(new VanChartDataSheetPane()); } } @@ -53,6 +53,10 @@ public class VanChartStylePane extends ChartStylePane { return paneList; } + protected VanChartTitlePane createVanChartTitlePane() { + return new VanChartTitlePane(VanChartStylePane.this); + } + protected void addOtherAxisPane(java.util.List paneList, Plot plot) { } @@ -68,7 +72,7 @@ public class VanChartStylePane extends ChartStylePane { paneList.add(new VanChartLabelPane(VanChartStylePane.this)); } - protected void addVanChartTooltipPane(List paneList){ + protected void addVanChartTooltipPane(List paneList) { paneList.add(new VanChartTooltipPane(VanChartStylePane.this)); } } \ No newline at end of file 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 d5dba9df8..cfcb0debb 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 @@ -112,7 +112,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { } private JPanel createTitlePane() { - backgroundPane = new VanChartBackgroundWithOutShadowWithRadiusPane(); + backgroundPane = createBackgroundPane(); double p = TableLayout.PREFERRED; @@ -132,6 +132,10 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane { return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); } + protected VanChartBackgroundWithOutShadowWithRadiusPane createBackgroundPane() { + return new VanChartBackgroundWithOutShadowWithRadiusPane(); + } + private JPanel createTitleContentPane(double[] row, double[] col) { titleContent = new TinyFormulaPane(); useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitleWithAutoBackground.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitleWithAutoBackground.java new file mode 100644 index 000000000..eb87f4363 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitleWithAutoBackground.java @@ -0,0 +1,19 @@ +package com.fr.van.chart.designer.style; + +import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutShadowWithRadiusPane; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-10-20 + */ +public class VanChartTitleWithAutoBackground extends VanChartTitlePane { + + public VanChartTitleWithAutoBackground(VanChartStylePane parent) { + super(parent); + } + + protected VanChartBackgroundWithOutShadowWithRadiusPane createBackgroundPane() { + return new VanChartBackgroundWithOutShadowWithRadiusPane(true); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java index cc912cf3f..f25802130 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/other/VanChartDrillMapInteractivePane.java @@ -3,8 +3,11 @@ package com.fr.van.chart.drillmap.designer.other; import com.fr.chart.base.DrillMapTools; import com.fr.chart.chartattr.Chart; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; +import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; @@ -12,7 +15,6 @@ import com.fr.plugin.chart.vanchart.VanChart; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.background.VanChartBackgroundPaneWithOutImageAndShadow; import com.fr.van.chart.designer.other.VanChartInteractivePaneWithMapZoom; -import com.fr.design.i18n.Toolkit; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -74,7 +76,20 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith }; } }; - backgroundPane = new VanChartBackgroundPaneWithOutImageAndShadow(); + + backgroundPane = new VanChartBackgroundPaneWithOutImageAndShadow() { + @Override + protected void initList() { + paneList.add(new NullBackgroundQuickPane() { + @Override + public String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"); + } + }); + paneList.add(new ColorBackgroundQuickPane()); + } + }; + selectBackgroundPane = new VanChartBackgroundPaneWithOutImageAndShadow(); catalogSuperLink = new VanChartCatalogHyperLinkPane(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapStylePane.java index 68ec083e4..2083d9f12 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/style/VanChartMapStylePane.java @@ -7,6 +7,8 @@ import com.fr.general.ComparatorUtils; import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.type.MapType; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.designer.style.VanChartTitlePane; +import com.fr.van.chart.designer.style.VanChartTitleWithAutoBackground; import com.fr.van.chart.map.designer.style.label.VanChartMapLabelPane; import com.fr.van.chart.map.designer.style.tooltip.VanChartMapTooltipPane; @@ -20,6 +22,11 @@ public class VanChartMapStylePane extends VanChartStylePane { super(listener); } + + protected VanChartTitlePane createVanChartTitlePane() { + return new VanChartTitleWithAutoBackground(VanChartMapStylePane.this); + } + protected void createVanChartLabelPane(List paneList) { Plot plot = getChart().getPlot(); if(!isLineMapPlot(plot)) {