diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java index c9a6caf80a..25b8760339 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java @@ -18,7 +18,6 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorSelectBox; import com.fr.design.utils.gui.GUICoreUtils; - import com.fr.stable.StringUtils; import com.fr.van.chart.designer.TableLayout4VanChartHelper; @@ -29,6 +28,8 @@ import javax.swing.JPanel; import javax.swing.SwingConstants; 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.Color; import java.awt.Component; @@ -40,8 +41,6 @@ import java.awt.LayoutManager; import java.awt.Point; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.List; public class UIColorPickerPane extends BasicPane implements UIObserver { private static final int MARGIN_TOP = 7; @@ -635,7 +634,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { @Override public void layoutContainer(Container parent) { - upControlPane.setBounds(MARGIN_LEFT, MARGIN_TOP, UPCONTROLPANE_WIDTH, upControlPane.getPreferredSize().height); + upControlPane.setBounds(getBoundX(), getBoundY(), getBoundWidth(), upControlPane.getPreferredSize().height); colorGroup.setBounds(COLORGROUP_MARGIN_LEFT, 2 * MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height); textGroup.setBounds(colorGroup.getPreferredSize().width + COLORGROUP_MARGIN_LEFT, MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, textGroup.getPreferredSize().width, textGroup.getPreferredSize().height); } @@ -646,6 +645,17 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { } }; + protected int getBoundX() { + return MARGIN_LEFT; + } + + protected int getBoundY() { + return MARGIN_TOP; + } + + protected int getBoundWidth() { + return UPCONTROLPANE_WIDTH; + } /** *刷新颜色选取器 diff --git a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java index 3ec2af314c..9a4e9bc795 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java @@ -2,8 +2,8 @@ package com.fr.van.chart.bubble; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionAttr; -import com.fr.design.i18n.Toolkit; import com.fr.design.beans.BasicBeanPane; +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; @@ -12,7 +12,7 @@ import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; import com.fr.van.chart.bubble.component.VanChartBubblePane; import com.fr.van.chart.custom.component.VanChartCustomAxisConditionPane; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; import com.fr.van.chart.designer.style.series.VanChartStackedAndAxisListControlPane; import javax.swing.JPanel; @@ -22,7 +22,7 @@ import java.awt.Component; /** * Created by Mitisky on 16/3/31. */ -public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { +public class VanChartBubbleSeriesPane extends VanChartColorValueSeriesPane { private static final long serialVersionUID = 5595016643808487932L; private VanChartBubblePane bubblePane; diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java new file mode 100644 index 0000000000..dac55c81c1 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java @@ -0,0 +1,74 @@ +package com.fr.van.chart.designer.component; + +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.gui.frpane.UINumberDragPane; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.i18n.Toolkit; +import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; +import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; +import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick; +import com.fr.van.chart.range.component.GradualIntervalConfigPane; +import com.fr.van.chart.range.component.GradualLegendPane; +import com.fr.van.chart.range.component.LegendGradientBar; +import com.fr.van.chart.range.component.SectionIntervalConfigPaneWithOutNum; +import com.fr.van.chart.range.component.SectionLegendPane; + +import java.awt.Component; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-08-04 + */ +public class VanChartHeatValueColorPane extends VanChartValueColorPane { + + public VanChartHeatValueColorPane(VanChartStylePane parent) { + super(parent); + } + + protected GradualLegendPane createGradualLegendPane() { + return new GradualLegendPane() { + @Override + protected GradualIntervalConfigPane createGradualIntervalConfigPane() { + return new GradualIntervalConfigPane() { + @Override + protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) { + return new Component[][]{ + new Component[]{minMaxValuePane, null}, + new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, + new Component[]{null, legendGradientBar} + }; + } + }; + } + }; + } + + protected SectionLegendPane createSectionLegendPane() { + return new SectionLegendPane(getVanChartStylePane()) { + @Override + protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { + return new SectionIntervalConfigPaneWithOutNum(parent) { + private static final int WIDTH = 227; + + @Override + protected int getBoundX() { + return 0; + } + + @Override + protected int getBoundY() { + return 0; + } + + @Override + protected int getBoundWidth() { + return WIDTH; + } + }; + } + }; + } + +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java new file mode 100644 index 0000000000..c0d2ea7f4f --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java @@ -0,0 +1,153 @@ +package com.fr.van.chart.designer.component; + +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.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.PaneTitleConstants; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.plugin.chart.range.VanChartRangeLegend; +import com.fr.plugin.chart.type.LegendType; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.range.component.GradualLegendPane; +import com.fr.van.chart.range.component.SectionLegendPane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +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; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-08-03 + */ +public class VanChartValueColorPane extends BasicPane { + //颜色类型切换按钮 + private UIButtonGroup valueColorTypeButton; + + //连续渐变面板 + private GradualLegendPane gradualLegendPane; + //区域渐变面板 + private SectionLegendPane sectionLegendPane; + + private VanChartStylePane parent; + + private JPanel rangeLegendPane; + + public VanChartValueColorPane(VanChartStylePane parent) { + this.parent = parent; + initComponents(); + } + + public VanChartStylePane getVanChartStylePane() { + return parent; + } + + public void initComponents() { + valueColorTypeButton = createLegendTypeButton(); + valueColorTypeButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkCardPane(); + } + }); + valueColorTypeButton.setSelectedIndex(0); + + UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color_Type")); + Component[][] labelComponent = new Component[][]{ + new Component[]{label, valueColorTypeButton}, + }; + JPanel legendTypeButtonWithTilePane = TableLayout4VanChartHelper.createGapTableLayoutPane(labelComponent); + legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(10,0,0,0)); + //渐变色图例面板 + gradualLegendPane = createGradualLegendPane(); + //区域段图例面板 + sectionLegendPane = createSectionLegendPane(); + + rangeLegendPane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (valueColorTypeButton.getSelectedItem() == LegendType.GRADUAL) { + return gradualLegendPane.getPreferredSize(); + } else { + return sectionLegendPane.getPreferredSize(); + } + } + }; + + rangeLegendPane.add(gradualLegendPane, LegendType.GRADUAL.getStringType()); + rangeLegendPane.add(sectionLegendPane, LegendType.SECTION.getStringType()); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] col = {f}; + double[] row = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{legendTypeButtonWithTilePane}, + new Component[]{rangeLegendPane} + }; + JPanel tableLayoutPane = TableLayoutHelper.createTableLayoutPane(components, row, col); + + this.setLayout(new BorderLayout()); + this.add(tableLayoutPane, BorderLayout.CENTER); + } + + private void checkCardPane() { + CardLayout cardLayout = (CardLayout) rangeLegendPane.getLayout(); + cardLayout.show(rangeLegendPane, valueColorTypeButton.getSelectedItem().getStringType()); + this.validate(); + this.repaint(); + } + + private UIButtonGroup createLegendTypeButton() { + return new UIButtonGroup<>(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Continuous_Gradient"), + Toolkit.i18nText("Fine-Design_Chart_Area_Gradient") + }, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION}); + } + + protected GradualLegendPane createGradualLegendPane() { + return new GradualLegendPane(); + } + + protected SectionLegendPane createSectionLegendPane() { + return new SectionLegendPane(parent); + } + + /** + * 标题 + * + * @return 标题 + */ + public String title4PopupWindow() { + return PaneTitleConstants.CHART_STYLE_SERIES_TITLE; + } + + public void updateBean(VanChartRangeLegend legend) { + LegendType legendType = valueColorTypeButton.getSelectedItem(); + legend.setLegendType(legendType); + if (legendType == LegendType.GRADUAL) { + gradualLegendPane.update(legend.getGradualLegend()); + } else if (legendType == LegendType.SECTION) { + sectionLegendPane.update(legend.getSectionLegend()); + } + } + + public void populateBean(VanChartRangeLegend legend) { + //范围图例部分 + if (legend.getLegendType() != LegendType.ORDINARY) { + valueColorTypeButton.setSelectedItem(legend.getLegendType()); + } + gradualLegendPane.populate(legend.getGradualLegend()); + sectionLegendPane.populate(legend.getSectionLegend()); + checkCardPane(); + } +} 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 60c535ceb9..cb316dffeb 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 @@ -1,22 +1,6 @@ package com.fr.van.chart.designer.style; -import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; -import com.fr.design.gui.frpane.UINumberDragPane; -import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.design.i18n.Toolkit; -import com.fr.design.gui.ilable.BoldFontTextLabel; -import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; -import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; -import com.fr.plugin.chart.type.LegendType; -import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick; -import com.fr.van.chart.range.component.GradualIntervalConfigPane; -import com.fr.van.chart.range.component.GradualLegendPane; -import com.fr.van.chart.range.component.LegendGradientBar; -import com.fr.van.chart.range.component.SectionIntervalConfigPaneWithOutNum; -import com.fr.van.chart.range.component.SectionLegendPane; - import javax.swing.JPanel; -import java.awt.Component; /** * Created by Mitisky on 16/10/20. @@ -35,41 +19,4 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane { protected JPanel createCommonLegendPane(){ return this.createLegendPaneWithoutHighlight(); } - - @Override - protected UIButtonGroup createLegendTypeButton(){ - return new UIButtonGroup(new String[]{ - Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), - Toolkit.i18nText("Fine-Design_Chart_Legend_Section") - }, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION}); - } - - @Override - protected GradualLegendPane createGradualLegendPane() { - return new GradualLegendPane(){ - @Override - protected GradualIntervalConfigPane createGradualIntervalConfigPane() { - return new GradualIntervalConfigPane(){ - @Override - protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) { - return new Component[][]{ - new Component[]{minMaxValuePane, null}, - new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, - new Component[]{null, legendGradientBar} - }; - } - }; - } - }; - } - - @Override - protected SectionLegendPane createSectionLegendPane() { - return new SectionLegendPane(this.getLegendPaneParent()) { - @Override - protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { - return new SectionIntervalConfigPaneWithOutNum(parent); - } - }; - } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java index 25ef2a15b2..5fa030a287 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java @@ -1,24 +1,18 @@ package com.fr.van.chart.designer.style; -import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.layout.TableLayout; -import com.fr.design.i18n.Toolkit; import com.fr.design.layout.TableLayoutHelper; import com.fr.plugin.chart.attr.VanChartLegend; +import com.fr.plugin.chart.range.SectionLegend; import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.plugin.chart.type.LegendType; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.range.component.GradualLegendPane; -import com.fr.van.chart.range.component.SectionLegendPane; +import com.fr.van.chart.range.component.LegendLabelFormatPane; -import javax.swing.BorderFactory; import javax.swing.JPanel; import java.awt.CardLayout; import java.awt.Component; import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; /** @@ -28,87 +22,63 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { private static final long serialVersionUID = 1614283200308877353L; //散点图不同类型面板容器,容器布局管理 - private JPanel rangeLegendPane; - - //图例切换按钮 - private UIButtonGroup legendTypeButton; + private JPanel rangeLabelPane; //普通图例面板(因为普通图例没有新内容,故而为空) - private JPanel ordinaryLegendPane; - //渐变色图例面板 - private GradualLegendPane gradualLegendPane; - //区域段图例面板 - private SectionLegendPane sectionLegendPane; + private JPanel ordinaryLabelPane; + + private LegendLabelFormatPane gradualLabelFormPane; + + private LegendLabelFormatPane sectionLabelFormPane; + + private LegendType legendType; public VanChartRangeLegendPane() { super(); } - public VanChartRangeLegendPane(VanChartStylePane parent){ + + public VanChartRangeLegendPane(VanChartStylePane parent) { super(parent); } - private JPanel createRangeLegendPane() { - //普通图例面板 - ordinaryLegendPane = new JPanel(); - //渐变色图例面板 - gradualLegendPane = createGradualLegendPane(); - gradualLegendPane.setParentPane(this.getLegendPaneParent()); - //区域段图例面板 - sectionLegendPane = createSectionLegendPane(); - sectionLegendPane.setParentPane(this.getLegendPaneParent()); - - JPanel panel = new JPanel(new CardLayout()){ + + private JPanel createRangeLabelPane() { + ordinaryLabelPane = new JPanel(); + gradualLabelFormPane = new LegendLabelFormatPane(); + gradualLabelFormPane.setParentPane(this.getLegendPaneParent()); + sectionLabelFormPane = new LegendLabelFormatPane() { + @Override + protected void checkCustomLabelText() { + setCustomFormatterText(SectionLegend.DEFAULT_LABEL_FUNCTION); + } + }; + sectionLabelFormPane.setParentPane(this.getLegendPaneParent()); + + JPanel panel = new JPanel(new CardLayout()) { @Override public Dimension getPreferredSize() { - if(legendTypeButton.getSelectedItem() == LegendType.ORDINARY){ - return new Dimension(ordinaryLegendPane.getWidth(), 0); - } else if (legendTypeButton.getSelectedItem() == LegendType.GRADUAL){ - return gradualLegendPane.getPreferredSize(); - }else{ - return sectionLegendPane.getPreferredSize(); + if (legendType == LegendType.ORDINARY) { + return new Dimension(ordinaryLabelPane.getWidth(), 0); + } else if (legendType == LegendType.GRADUAL) { + return gradualLabelFormPane.getPreferredSize(); + } else { + return sectionLabelFormPane.getPreferredSize(); } } }; - panel.add(ordinaryLegendPane, LegendType.ORDINARY.getStringType()); - panel.add(gradualLegendPane, LegendType.GRADUAL.getStringType()); - panel.add(sectionLegendPane, LegendType.SECTION.getStringType()); + panel.add(ordinaryLabelPane, LegendType.ORDINARY.getStringType()); + panel.add(gradualLabelFormPane, LegendType.GRADUAL.getStringType()); + panel.add(sectionLabelFormPane, LegendType.SECTION.getStringType()); return panel; } - protected GradualLegendPane createGradualLegendPane() { - return new GradualLegendPane(); - } - - protected SectionLegendPane createSectionLegendPane() { - return new SectionLegendPane(this.getLegendPaneParent()); - } - - private JPanel createTableLayoutPaneWithTitle(String title, Component component) { - return TableLayout4VanChartHelper.createGapTableLayoutPane(title, component); - } - - protected UIButtonGroup createLegendTypeButton(){ - return new UIButtonGroup(new String[]{ - Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"), - Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"), - Toolkit.i18nText("Fine-Design_Chart_Legend_Section") - }, new LegendType[]{LegendType.ORDINARY, LegendType.GRADUAL, LegendType.SECTION}); - } - - protected JPanel createCommonLegendPane(){ + protected JPanel createCommonLegendPane() { return super.createLegendPane(); } @Override - protected JPanel createLegendPane(){ - legendTypeButton = createLegendTypeButton(); - - initLegendTypeButtonListener(); - - JPanel legendTypeButtonWithTilePane = createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Legend_Form"), legendTypeButton); - legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0)); - - rangeLegendPane = createRangeLegendPane(); + protected JPanel createLegendPane() { + rangeLabelPane = createRangeLabelPane(); //不包含新内容的普通面板内容 JPanel commonLegendPane = this.createCommonLegendPane(); @@ -116,28 +86,17 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] col = {f}; - double[] row = {p, p, p, p}; + double[] row = {p, p}; Component[][] components = new Component[][]{ - new Component[]{legendTypeButtonWithTilePane}, - new Component[]{rangeLegendPane}, + new Component[]{rangeLabelPane}, new Component[]{commonLegendPane} }; - return TableLayoutHelper.createTableLayoutPane(components,row,col); - } - - private void initLegendTypeButtonListener() { - legendTypeButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - checkCardPane(); - checkLayoutPaneVisible(); - } - }); + return TableLayoutHelper.createTableLayoutPane(components, row, col); } private void checkCardPane() { - CardLayout cardLayout = (CardLayout) rangeLegendPane.getLayout(); - cardLayout.show(rangeLegendPane, legendTypeButton.getSelectedItem().getStringType()); + CardLayout cardLayout = (CardLayout) rangeLabelPane.getLayout(); + cardLayout.show(rangeLabelPane, legendType.getStringType()); } @Override @@ -151,47 +110,41 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane { protected boolean isVisibleLayoutPane() { - return super.isVisibleLayoutPane() && legendTypeButton.getSelectedItem() != LegendType.GRADUAL; + return super.isVisibleLayoutPane() && legendType != LegendType.GRADUAL; } - private void checkHighlightVisible(){ + private void checkHighlightVisible() { JPanel highlightPane = this.getHighlightPane(); if (highlightPane != null) { - LegendType legendType = legendTypeButton.getSelectedItem(); highlightPane.setVisible(legendType != LegendType.GRADUAL); } } @Override public void updateBean(VanChartLegend legend) { - if(legend == null) { + if (legend == null) { legend = new VanChartRangeLegend(); } super.updateBean(legend); - VanChartRangeLegend scatterLegend = (VanChartRangeLegend)legend; + VanChartRangeLegend scatterLegend = (VanChartRangeLegend) legend; //范围图例部分 - LegendType legendType = legendTypeButton.getSelectedItem(); - scatterLegend.setLegendType(legendType); if (legendType == LegendType.GRADUAL) { - gradualLegendPane.update(scatterLegend.getGradualLegend()); - }else if (legendType == LegendType.SECTION) { - sectionLegendPane.update(scatterLegend.getSectionLegend()); + gradualLabelFormPane.update(scatterLegend.getGradualLegend().getLegendLabelFormat()); + } else if (legendType == LegendType.SECTION) { + sectionLabelFormPane.update(scatterLegend.getSectionLegend().getLegendLabelFormat()); } - - this.checkHighlightVisible(); } @Override public void populateBean(VanChartLegend legend) { - VanChartRangeLegend scatterLegend = (VanChartRangeLegend)legend; + VanChartRangeLegend scatterLegend = (VanChartRangeLegend) legend; + legendType = scatterLegend.getLegendType(); if (scatterLegend != null) { - //范围图例部分 - legendTypeButton.setSelectedItem(scatterLegend.getLegendType()); - gradualLegendPane.populate(scatterLegend.getGradualLegend()); - sectionLegendPane.populate(scatterLegend.getSectionLegend()); + gradualLabelFormPane.populate(scatterLegend.getGradualLegend().getLegendLabelFormat()); + sectionLabelFormPane.populate(scatterLegend.getSectionLegend().getLegendLabelFormat()); super.populateBean(scatterLegend); } checkAllUse(); diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java new file mode 100644 index 0000000000..34f86d0200 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java @@ -0,0 +1,173 @@ +package com.fr.van.chart.designer.style.series; + +import com.fr.chart.chartattr.Plot; +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.layout.TableLayoutHelper; +import com.fr.design.mainframe.chart.gui.ChartStylePane; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.plugin.chart.range.VanChartRangeLegend; +import com.fr.plugin.chart.type.LegendType; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; +import com.fr.van.chart.designer.component.VanChartBeautyPane; +import com.fr.van.chart.designer.component.VanChartValueColorPane; +import com.fr.van.chart.designer.style.VanChartStylePane; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +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; + +/** + * @author Bjorn + * @version 10.0 + * Created by Bjorn on 2020-08-03 + */ +public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotSeriesPane { + + //颜色划分切换 + private UIButtonGroup colorDivideButton; + + private VanChartValueColorPane vanChartValueColorPane; + + private JPanel colorDividePane; + + public VanChartColorValueSeriesPane(ChartStylePane parent, Plot plot) { + super(parent, plot); + } + + + public VanChartValueColorPane getVanChartValueColorPane() { + return vanChartValueColorPane; + } + + public void setVanChartValueColorPane(VanChartValueColorPane vanChartValueColorPane) { + this.vanChartValueColorPane = vanChartValueColorPane; + } + + //获取颜色面板 + protected JPanel getColorPane() { + JPanel panel = new JPanel(new BorderLayout()); + JPanel colorChoosePane = createColorChoosePane(); + if (colorChoosePane != null) { + panel.add(colorChoosePane, BorderLayout.CENTER); + } + + stylePane = createStylePane(); + setColorPaneContent(panel); + JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); + panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0)); + return panel.getComponentCount() == 0 ? null : colorPane; + } + + protected JPanel createColorChoosePane() { + vanChartFillStylePane = getVanChartFillStylePane(); + if (vanChartFillStylePane != null) { + JPanel divideButtonPane = initDivideButtonPane(); + vanChartValueColorPane = new VanChartValueColorPane((VanChartStylePane) parentPane); + + colorDividePane = new JPanel(new CardLayout()) { + @Override + public Dimension getPreferredSize() { + if (colorDivideButton.getSelectedIndex() == 0) { + return vanChartFillStylePane.getPreferredSize(); + } else { + return vanChartValueColorPane.getPreferredSize(); + } + } + }; + colorDividePane.add(vanChartFillStylePane, "series"); + colorDividePane.add(vanChartValueColorPane, "value"); + + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] col = {f}; + double[] row = {p, p, p}; + Component[][] components = new Component[][]{ + new Component[]{divideButtonPane}, + new Component[]{colorDividePane} + }; + return TableLayoutHelper.createCommonTableLayoutPane(components, row, col, 0); + } + return null; + } + + private JPanel initDivideButtonPane() { + colorDivideButton = new UIButtonGroup<>(new String[]{ + Toolkit.i18nText("Fine-Design_Chart_Series"), + Toolkit.i18nText("Fine-Design_Chart_Use_Value") + }, new String[]{"series", "value"}); + colorDivideButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + checkCardPane(); + } + }); + colorDivideButton.setSelectedIndex(0); + UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color_Divide")); + Component[][] labelComponent = new Component[][]{ + new Component[]{label, colorDivideButton}, + }; + JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(labelComponent); + gapTableLayoutPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); + return gapTableLayoutPane; + } + + private void checkCardPane() { + CardLayout cardLayout = (CardLayout) colorDividePane.getLayout(); + cardLayout.show(colorDividePane, colorDivideButton.getSelectedItem()); + colorDividePane.validate(); + colorDividePane.repaint(); + } + + //风格 + protected VanChartBeautyPane createStylePane() { + return null; + } + + /** + * 保存 系列界面的属性到Plot + */ + public void updateBean(Plot plot) { + if (plot == null) { + return; + } + super.updateBean(plot); + if (colorDivideButton != null) { + VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend(); + int selectedIndex = colorDivideButton.getSelectedIndex(); + if (selectedIndex == 0) { + legend.setLegendType(LegendType.ORDINARY); + } else { + vanChartValueColorPane.updateBean(legend); + } + } + } + + /** + * 更新Plot的属性到系列界面 + */ + public void populateBean(Plot plot) { + if (plot == null) { + return; + } + super.populateBean(plot); + if (colorDivideButton != null) { + VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend(); + LegendType legendType = legend.getLegendType(); + if (legendType == LegendType.ORDINARY) { + colorDivideButton.setSelectedIndex(0); + } else { + colorDivideButton.setSelectedIndex(1); + } + vanChartValueColorPane.populateBean(legend); + checkCardPane(); + } + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java index 7c4fa4ad4a..6e4309a870 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java @@ -6,12 +6,16 @@ import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; +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.plugin.chart.heatmap.VanChartHeatMapPlot; +import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartFillStylePane; +import com.fr.van.chart.designer.component.VanChartHeatValueColorPane; +import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.map.VanChartMapSeriesPane; import javax.swing.JPanel; @@ -45,7 +49,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { } //设置色彩面板内容 - protected void setColorPaneContent (JPanel panel) { + protected void setColorPaneContent(JPanel panel) { panel.add(createNullValueColorPane(), BorderLayout.NORTH); panel.add(createAlphaPane(), BorderLayout.CENTER); } @@ -66,14 +70,14 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { detailPane.add(heatPointPane, "heatPointPane"); detailPane.add(backgroundAreaPane, "backgroundAreaPane"); - JPanel contentPane = new JPanel(new BorderLayout(0,6)); + JPanel contentPane = new JPanel(new BorderLayout(0, 6)); contentPane.add(group, BorderLayout.NORTH); contentPane.add(detailPane, BorderLayout.CENTER); group.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - if(group.getSelectedIndex() == 0){ + if (group.getSelectedIndex() == 0) { layout.show(detailPane, "heatPointPane"); } else { layout.show(detailPane, "backgroundAreaPane"); @@ -84,13 +88,14 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { return contentPane; } - private JPanel createHeatPointPane(){ + private JPanel createHeatPointPane() { double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] row = {p, p, p, p, p}; double[] col = {f}; Component[][] components = new Component[][]{ + new Component[]{createHeatColorPane()}, new Component[]{createHeatPointStylePane()}, new Component[]{createOpacityPane()} }; @@ -98,9 +103,24 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { return TableLayoutHelper.createTableLayoutPane(components, row, col); } - private JPanel createHeatPointStylePane(){ - radius = new UISpinner(0,Double.MAX_VALUE,1,30); - blur = new UISpinner(0,100,1,30); + private JPanel createHeatColorPane() { + setVanChartValueColorPane(new VanChartHeatValueColorPane((VanChartStylePane) parentPane)); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] row = {p}; + double[] col = {f}; + + Component[][] components = new Component[][]{ + new Component[]{getVanChartFillStylePane()}, + }; + + JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel); + } + + private JPanel createHeatPointStylePane() { + radius = new UISpinner(0, Double.MAX_VALUE, 1, 30); + blur = new UISpinner(0, 100, 1, 30); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -121,8 +141,8 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { } private JPanel createOpacityPane() { - maxOpacity = new UINumberDragPane(0,100); - minOpacity = new UINumberDragPane(0,100); + maxOpacity = new UINumberDragPane(0, 100); + minOpacity = new UINumberDragPane(0, 100); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; @@ -146,12 +166,13 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { public void populateBean(Plot plot) { super.populateBean(plot); - if(plot instanceof VanChartHeatMapPlot){ - VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot)plot; + if (plot instanceof VanChartHeatMapPlot) { + VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot) plot; radius.setValue(heatMapPlot.getRadius()); blur.setValue(heatMapPlot.getBlur()); maxOpacity.populateBean(heatMapPlot.getMaxOpacity()); minOpacity.populateBean(heatMapPlot.getMinOpacity()); + getVanChartValueColorPane().populateBean((VanChartRangeLegend) plot.getLegend()); } } @@ -163,12 +184,13 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane { public void updateBean(Plot plot) { super.updateBean(plot); - if(plot instanceof VanChartHeatMapPlot){ - VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot)plot; + if (plot instanceof VanChartHeatMapPlot) { + VanChartHeatMapPlot heatMapPlot = (VanChartHeatMapPlot) plot; heatMapPlot.setRadius(radius.getValue()); heatMapPlot.setBlur(blur.getValue()); heatMapPlot.setMaxOpacity(maxOpacity.updateBean()); heatMapPlot.setMinOpacity(minOpacity.updateBean()); + getVanChartValueColorPane().updateBean((VanChartRangeLegend) plot.getLegend()); } } 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 b24e8fc33d..ccc2e012e5 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 @@ -31,7 +31,7 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.border.VanChartBorderWithAlphaPane; import com.fr.van.chart.designer.component.marker.VanChartImageMarkerPane; import com.fr.van.chart.designer.other.VanChartInteractivePane; -import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; import com.fr.van.chart.designer.style.series.VanChartEffectPane; import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane; import com.fr.van.chart.map.line.VanChartCurvePane; @@ -52,7 +52,7 @@ import java.awt.event.ItemListener; * Created by Mitisky on 16/5/4. * 地图-系列界面 */ -public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { +public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane { private static final String AREA_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Region"); private static final String POINT_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point"); private static final String LINE_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Flow"); @@ -163,9 +163,10 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { protected JPanel getContentPane(boolean custom) { JPanel panel = new JPanel(new BorderLayout()); mapType = ((VanChartMapPlot) plot).getAllLayersMapType(); - if(mapType == MapType.CUSTOM || mapType == MapType.DRILL_CUSTOM) { - vanChartFillStylePane = getVanChartFillStylePane(); - panel.add(vanChartFillStylePane, BorderLayout.NORTH); + if (mapType == MapType.CUSTOM || mapType == MapType.DRILL_CUSTOM) { + JPanel pane = createColorChoosePane(); + pane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); + panel.add(pane, BorderLayout.NORTH); } panel.add(getContentInPlotType(), BorderLayout.CENTER); return panel; @@ -176,10 +177,10 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { JPanel panel = new JPanel(new BorderLayout()); stylePane = createStylePane(); mapType = ((VanChartMapPlot) plot).getAllLayersMapType(); - if(mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) { - vanChartFillStylePane = getVanChartFillStylePane(); - if (vanChartFillStylePane != null) { - panel.add(vanChartFillStylePane, BorderLayout.NORTH); + if (mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) { + JPanel pane = createColorChoosePane(); + if (pane != null) { + panel.add(pane, BorderLayout.NORTH); } } setColorPaneContent(panel, paneType); diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java index d1858fb13d..88dd54790c 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java @@ -2,68 +2,51 @@ package com.fr.van.chart.range.component; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; - import com.fr.plugin.chart.range.GradualLegend; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -public class GradualLegendPane extends JPanel{ +public class GradualLegendPane extends JPanel { private static final long serialVersionUID = 1614283200308877353L; private GradualIntervalConfigPane intervalConfigPane; - private LegendLabelFormatPane labelFormPane; - public GradualLegendPane(){ + public GradualLegendPane() { initComponents(); } - public void setParentPane(VanChartStylePane parent) { - labelFormPane.setParentPane(parent); - } private void initComponents() { intervalConfigPane = createGradualIntervalConfigPane(); - JPanel intervalConfigPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Section_Config"),intervalConfigPane); - labelFormPane = new LegendLabelFormatPane(); double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] col = {f}; - double[] row = {p, p, p, p}; + double[] row = {p}; Component[][] components = new Component[][]{ - new Component[]{null}, - new Component[]{intervalConfigPaneWithTitle}, - new Component[]{labelFormPane}, + new Component[]{intervalConfigPane}, }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); this.setLayout(new BorderLayout()); - this.add(panel,BorderLayout.CENTER); + this.add(panel, BorderLayout.CENTER); } protected GradualIntervalConfigPane createGradualIntervalConfigPane() { return new GradualIntervalConfigPane(); } - public void populate(GradualLegend gradualLegend){ + public void populate(GradualLegend gradualLegend) { if (intervalConfigPane != null) { intervalConfigPane.populate(gradualLegend.getGradualIntervalConfig()); } - if (labelFormPane != null) { - labelFormPane.populate(gradualLegend.getLegendLabelFormat()); - } } - public void update(GradualLegend gradualLegend){ + public void update(GradualLegend gradualLegend) { if (intervalConfigPane != null) { intervalConfigPane.update(gradualLegend.getGradualIntervalConfig()); } - if (labelFormPane != null) { - labelFormPane.update(gradualLegend.getLegendLabelFormat()); - } } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java index 79038cdd79..eec9225f58 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java @@ -21,7 +21,7 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -public class LegendLabelFormatPane extends JPanel{ +public class LegendLabelFormatPane extends JPanel { private static final long serialVersionUID = 1614283200308877354L; private UIButtonGroup labelFormatStyle; @@ -33,25 +33,33 @@ public class LegendLabelFormatPane extends JPanel{ htmlLabelPane.setParent(parent); } - public LegendLabelFormatPane(){ + public LegendLabelFormatPane() { labelFormatStyle = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); - labelFormat = new FormatPaneWithOutFont(); + labelFormat = new FormatPaneWithOutFont() { + @Override + protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) { + typePane.setBorder(BorderFactory.createEmptyBorder()); + return new Component[][]{ + new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane}, + new Component[]{null, centerPane}, + }; + } + }; htmlLabelPane = new VanChartHtmlLabelPaneWithOutWidthAndHeight(); - htmlLabelPane.setBorder(BorderFactory.createEmptyBorder(0, (int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0)); + htmlLabelPane.setBorder(BorderFactory.createEmptyBorder(0, (int) TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL, 0, 0)); - - centerPane = new JPanel(new CardLayout()){ + centerPane = new JPanel(new CardLayout()) { @Override public Dimension getPreferredSize() { - if(labelFormatStyle.getSelectedIndex() == 0){ + if (labelFormatStyle.getSelectedIndex() == 0) { return labelFormat.getPreferredSize(); - }else{ + } else { return htmlLabelPane.getPreferredSize(); } } }; - centerPane.add(labelFormat,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); + centerPane.add(labelFormat, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); centerPane.add(htmlLabelPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); @@ -61,11 +69,11 @@ public class LegendLabelFormatPane extends JPanel{ double[] columnSize = {f, e}; double[] rowSize = {p, p, p}; Component[][] components = new Component[][]{ - new Component[]{null,null}, + new Component[]{null, null}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Format"), SwingConstants.LEFT), labelFormatStyle}, - new Component[]{centerPane,null}, + new Component[]{centerPane, null}, }; - JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); + JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); labelFormatStyle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -74,19 +82,19 @@ public class LegendLabelFormatPane extends JPanel{ }); labelFormatStyle.setSelectedIndex(0); - JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Format"), contentPane); + JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Format"), contentPane); this.setLayout(new BorderLayout()); - this.add(panel,BorderLayout.CENTER); + this.add(panel, BorderLayout.CENTER); } private void checkCardPane(boolean populate) { - if(centerPane != null && labelFormatStyle != null){ + if (centerPane != null && labelFormatStyle != null) { CardLayout cardLayout = (CardLayout) centerPane.getLayout(); if (labelFormatStyle.getSelectedIndex() == 1) { - if(!populate) { + if (!populate) { checkCustomLabelText(); } - cardLayout.show(centerPane,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); + cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); } else { cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); } @@ -101,21 +109,21 @@ public class LegendLabelFormatPane extends JPanel{ } /*标签部分的更新和存储数据部分要重写*/ - public void populate(LegendLabelFormat legendLabelFormat){ + public void populate(LegendLabelFormat legendLabelFormat) { if (labelFormatStyle != null) { labelFormatStyle.setSelectedIndex(legendLabelFormat.isCommonValueFormat() ? 0 : 1); } if (labelFormat != null) { labelFormat.populateBean(legendLabelFormat.getFormat()); } - if (htmlLabelPane != null){ + if (htmlLabelPane != null) { htmlLabelPane.populate(legendLabelFormat.getHtmlLabel()); } checkCardPane(true); } - public void update(LegendLabelFormat legendLabelFormat){ + public void update(LegendLabelFormat legendLabelFormat) { if (labelFormatStyle != null) { legendLabelFormat.setCommonValueFormat(labelFormatStyle.getSelectedIndex() == 0); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java index cad289f100..a6fc4cfbe8 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java @@ -5,9 +5,7 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.Component; @@ -38,15 +36,6 @@ public class SectionIntervalConfigPaneWithOutNum extends MapColorPickerPaneWithF }); } - @Override - protected JPanel getUpControlPane(Component[][] components) { - double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; - double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH; - double[] columnSize = {d, e}; - JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSIze(), columnSize); - return panel; - } - private void setRegionVisible(boolean visible) { getRegionNumPane().setVisible(visible); numLabel.setVisible(visible); diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java index 828f40d733..f2da407285 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java @@ -5,18 +5,15 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; import com.fr.plugin.chart.range.SectionLegend; -import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.style.VanChartStylePane; import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; -public class SectionLegendPane extends JPanel{ +public class SectionLegendPane extends JPanel { private static final long serialVersionUID = 1614283200308877353L; private MapColorPickerPaneWithFormula intervalConfigPane; - private LegendLabelFormatPane labelFormPane; private AbstractAttrNoScrollPane parent; public SectionLegendPane(AbstractAttrNoScrollPane parent) { @@ -24,28 +21,15 @@ public class SectionLegendPane extends JPanel{ initComponents(); } - public void setParentPane(VanChartStylePane parent){ - labelFormPane.setParentPane(parent); - } - private void initComponents() { intervalConfigPane = createSectionIntervalConfigPane(this.parent); - JPanel intervalConfigPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Section_Config"), intervalConfigPane); - labelFormPane = new LegendLabelFormatPane(){ - @Override - protected void checkCustomLabelText() { - setCustomFormatterText(SectionLegend.DEFAULT_LABEL_FUNCTION); - } - }; double p = TableLayout.PREFERRED; double f = TableLayout.FILL; double[] col = {f}; - double[] row = {p, p, p}; + double[] row = {p}; Component[][] components = new Component[][]{ - new Component[]{null}, - new Component[]{intervalConfigPaneWithTitle}, - new Component[]{labelFormPane}, + new Component[]{intervalConfigPane}, }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); @@ -55,24 +39,35 @@ public class SectionLegendPane extends JPanel{ } protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { - return new SectionIntervalConfigPane(parent); + return new SectionIntervalConfigPane(parent) { + private static final int WIDTH = 225; + + @Override + protected int getBoundX() { + return 0; + } + + @Override + protected int getBoundY() { + return 0; + } + + @Override + protected int getBoundWidth() { + return WIDTH; + } + }; } - public void populate(SectionLegend sectionLegend){ + public void populate(SectionLegend sectionLegend) { if (intervalConfigPane != null) { intervalConfigPane.populateBean(sectionLegend.getMapHotAreaColor()); } - if (labelFormPane != null) { - labelFormPane.populate(sectionLegend.getLegendLabelFormat()); - } } - public void update(SectionLegend sectionLegend){ + public void update(SectionLegend sectionLegend) { if (intervalConfigPane != null) { intervalConfigPane.updateBean(sectionLegend.getMapHotAreaColor()); } - if (labelFormPane != null) { - labelFormPane.update(sectionLegend.getLegendLabelFormat()); - } } } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java index 98c900219f..b462faa811 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java @@ -13,7 +13,7 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartLineTypePane; import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane; -import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; import com.fr.van.chart.designer.style.series.VanChartStackedAndAxisListControlPane; import com.fr.van.chart.scatter.component.VanChartScatterLineTypePane; @@ -24,7 +24,7 @@ import java.awt.Component; /** * 散点图的系列界面 */ -public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane { +public class VanChartScatterSeriesPane extends VanChartColorValueSeriesPane { private static final long serialVersionUID = 5595016643808487932L; public VanChartScatterSeriesPane(ChartStylePane parent, Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java index 884e96b330..4e9c612c09 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java @@ -18,8 +18,7 @@ import com.fr.general.IOUtils; import com.fr.plugin.chart.wordcloud.CloudShapeType; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.van.chart.designer.TableLayout4VanChartHelper; -import com.fr.van.chart.designer.component.VanChartBeautyPane; -import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; +import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -34,7 +33,7 @@ import java.awt.event.ItemListener; /** * Created by Mitisky on 16/11/29. */ -public class VanChartWordCloudSeriesPane extends VanChartAbstractPlotSeriesPane { +public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane { private static final String AUTO_FONT_SIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto"); private static final String CUSTOM_FONT_SIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Define_Size"); private static final double MAX_ROTATION = 90; @@ -228,9 +227,4 @@ public class VanChartWordCloudSeriesPane extends VanChartAbstractPlotSeriesPane } } } - - @Override - protected VanChartBeautyPane createStylePane() { - return null; - } }