From 152b2890ccb3aab8efdeeb7a1c47c4b3bca60bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 10 Jan 2022 20:22:56 +0800 Subject: [PATCH] =?UTF-8?q?CHART-22247=20=E7=94=98=E7=89=B9=E5=9B=BE?= =?UTF-8?q?=E8=BE=B9=E6=A1=86/=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=A0=87=E8=AF=86=E7=BA=BF=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/VanChartGanttTimeLinePane.java | 97 +++++++++++++++++ .../component/VanChartGuideLinesPane.java | 4 - .../background/VanChartGantAreaPane.java | 15 +++ .../VanChartGantPlotAreaBackgroundPane.java | 102 ++++++++++++++++++ .../style/VanChartGanttStylePane.java | 6 ++ .../style/series/VanChartGanttSeriesPane.java | 15 ++- 6 files changed, 233 insertions(+), 6 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java delete mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java create mode 100644 designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java new file mode 100644 index 000000000..f6fb41edb --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGanttTimeLinePane.java @@ -0,0 +1,97 @@ +package com.fr.van.chart.designer.component; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; +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.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; +import com.fr.plugin.chart.gantt.VanChartGanttPlot; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; + +public class VanChartGanttTimeLinePane extends JPanel { + private UIButtonGroup switchButton; + private ColorSelectBoxWithOutTransparent colorSelect; + private UINumberDragPaneWithPercent opacity; + + public VanChartGanttTimeLinePane() { + this.setLayout(new BorderLayout()); + this.add(createSwitchButtonPane(), BorderLayout.NORTH); + this.add(createCenterPane(), BorderLayout.CENTER); + } + + private JPanel createSwitchButtonPane() { + double[] columnSize = {TableLayout.PREFERRED, TableLayout.FILL}; + double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED}; + String[] array = new String[]{Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Not_Show"), Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Show")}; + switchButton = new UIButtonGroup<>(array); + UILabel text = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Current_Line"), SwingConstants.LEFT); + return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { + new Component[]{null, null}, + new Component[] {text, switchButton} + }, rowSize, columnSize); + } + + private JPanel createCenterPane() { + double[] columnSize = {TableLayout.FILL, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; + double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED}; + + colorSelect = new ColorSelectBoxWithOutTransparent(100); + opacity = new UINumberDragPaneWithPercent(0, 100); + + return TableLayout4VanChartHelper.createGapTableLayoutPane(new Component[][] { + new Component[]{null, null}, + new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), colorSelect}, + new Component[] {new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), opacity} + }, rowSize, columnSize); + } + + public void populateBean(Plot plot) { + if (plot instanceof VanChartGanttPlot) { + VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot; + setShowTimeLine(ganttPlot.isShowTimeLine()); + setTimeLineColor(ganttPlot.getTimeLineColor()); + setTimeLineOpacity(ganttPlot.getTimeLineOpacity()); + } + } + + public void updateBean(Plot plot) { + if (plot instanceof VanChartGanttPlot) { + VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot; + ganttPlot.setShowTimeLine(isShowTimeLine()); + ganttPlot.setTimeLineColor(getTimeLineColor()); + ganttPlot.setTimeLineOpacity(getTimeLineOpacity()); + } + } + + public boolean isShowTimeLine() { + return switchButton.getSelectedIndex() == 1; + } + + public void setShowTimeLine(boolean showTimeLine) { + switchButton.setSelectedIndex(showTimeLine ? 1 : 0); + } + + public Color getTimeLineColor() { + return colorSelect.getSelectObject(); + } + + public void setTimeLineColor(Color timeLineColor) { + colorSelect.setSelectObject(timeLineColor); + } + + public double getTimeLineOpacity() { + return opacity.updateBean(); + } + + public void setTimeLineOpacity(double timeLineOpacity) { + opacity.populateBean(timeLineOpacity); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java deleted file mode 100644 index 4b7b140cd..000000000 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartGuideLinesPane.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.fr.van.chart.designer.component; - -public class VanChartGuideLinesPane { -} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java new file mode 100644 index 000000000..382a91827 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantAreaPane.java @@ -0,0 +1,15 @@ +package com.fr.van.chart.designer.style.background; + +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.van.chart.designer.style.VanChartStylePane; + +public class VanChartGantAreaPane extends VanChartAreaPane { + public VanChartGantAreaPane(Plot plot, VanChartStylePane parent) { + super(plot, parent); + } + + protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) { + plotPane = new VanChartGantPlotAreaBackgroundPane(parent); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java new file mode 100644 index 000000000..fbea84990 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartGantPlotAreaBackgroundPane.java @@ -0,0 +1,102 @@ +package com.fr.van.chart.designer.style.background; + +import com.fr.chart.chartattr.Chart; +import com.fr.chart.chartattr.Plot; +import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +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.ColorSelectBoxWithOutTransparent; +import com.fr.plugin.chart.gantt.VanChartGanttPlot; +import com.fr.van.chart.designer.TableLayout4VanChartHelper; + +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + +public class VanChartGantPlotAreaBackgroundPane extends VanChartAreaBackgroundPane { + private ColorSelectBoxWithOutTransparent axisColorPane; + private ColorSelectBoxWithOutTransparent contentColorPane; + + public VanChartGantPlotAreaBackgroundPane(AbstractAttrNoScrollPane parent) { + super(true, parent); + } + + @Override + protected JPanel createContentPane() { + JPanel contentPane = new JPanel(new BorderLayout()); + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f}; + double[] rowSize = {p, p}; + Component[][] components = new Component[][]{ + new Component[]{createAxisBorderPane()}, + new Component[]{createContentBorderPane()} + }; + + contentPane.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); + return contentPane; + } + + @Override + public void updateBean(Chart chart) { + if (chart == null) { + chart = new Chart(); + } + + Plot plot = chart.getPlot(); + if (plot instanceof VanChartGanttPlot) { + VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot; + ganttPlot.setAxisBorderColor(axisColorPane.getSelectObject()); + ganttPlot.setContentBorderColor(contentColorPane.getSelectObject()); + } + } + + @Override + public void populateBean(Chart chart) { + if (chart == null) { + chart = new Chart(); + } + + Plot plot = chart.getPlot(); + if (plot instanceof VanChartGanttPlot) { + VanChartGanttPlot ganttPlot = (VanChartGanttPlot) plot; + axisColorPane.setSelectObject(ganttPlot.getAxisBorderColor()); + contentColorPane.setSelectObject(ganttPlot.getContentBorderColor()); + } + } + + private JPanel createAxisBorderPane() { + axisColorPane = new ColorSelectBoxWithOutTransparent(100); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle( + Toolkit.i18nText("Fine-Design_Chart_Gant_Axis_Border"), + createBorderPane(axisColorPane) + ); + } + + private JPanel createContentBorderPane() { + contentColorPane = new ColorSelectBoxWithOutTransparent(100); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle( + Toolkit.i18nText("Fine-Design_Chart_Gant_Content_Border"), + createBorderPane(contentColorPane) + ); + } + + private JPanel createBorderPane(ColorSelectBoxWithOutTransparent colorPane) { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double[] columnSize = {f, TableLayout4VanChartHelper.EDIT_AREA_WIDTH}; + double[] rowSize = {p, p}; + + Component[][] components = new Component[][]{ + new Component[]{null, null}, + new Component[]{ + new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), + colorPane + } + }; + + return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); + } +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java index b12e0579f..7d1de704f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/VanChartGanttStylePane.java @@ -4,6 +4,8 @@ import com.fr.chart.chartattr.Plot; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.van.chart.designer.style.VanChartStylePane; +import com.fr.van.chart.designer.style.background.VanChartAreaPane; +import com.fr.van.chart.designer.style.background.VanChartGantAreaPane; import com.fr.van.chart.gantt.designer.style.axis.GanttProcessAxisPane; import com.fr.van.chart.gantt.designer.style.axis.GanttTimeAxisPane; @@ -31,4 +33,8 @@ public class VanChartGanttStylePane extends VanChartStylePane { private void addProjectAxisPane(List paneList, Plot plot) { paneList.add(new GanttProcessAxisPane()); } + + protected VanChartAreaPane createVanChartAreaPane() { + return new VanChartGantAreaPane(getChart().getPlot(), VanChartGanttStylePane.this); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java index 9236773e7..a62f054e7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/gantt/designer/style/series/VanChartGanttSeriesPane.java @@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane; 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.layout.TableLayoutHelper; import com.fr.design.mainframe.chart.gui.ChartStylePane; @@ -14,6 +15,7 @@ import com.fr.plugin.chart.gantt.VanChartGanttPlot; import com.fr.stable.CoreConstants; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.component.VanChartBeautyPane; +import com.fr.van.chart.designer.component.VanChartGanttTimeLinePane; 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; @@ -30,6 +32,8 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { private LineComboBox lineWidth;//线型 private ColorSelectBoxWithOutTransparent colorSelect;//颜色 + private VanChartGanttTimeLinePane timeLinePane; + public VanChartGanttSeriesPane(ChartStylePane parent, Plot plot) { super(parent, plot); } @@ -45,7 +49,8 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { new Component[]{createGanntStylePane()}, new Component[]{createLinkLinePane()}, new Component[]{createMarkerPane()}, - new Component[]{createLargeDataModelPane()} + new Component[]{createLargeDataModelPane()}, + new Component[]{createGuideLinePane()} }; contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); @@ -96,6 +101,11 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gannt_Marker"), markerPane); } + protected JPanel createGuideLinePane() { + timeLinePane = new VanChartGanttTimeLinePane(); + return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Guide_Line_Identify"), timeLinePane); + } + @Override public void populateBean(Plot plot) { super.populateBean(plot); @@ -104,10 +114,10 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { VanChartGanttPlot ganttPlot = (VanChartGanttPlot)plot; seriesNewLine.setSelectedIndex(ganttPlot.isSeriesNewLineEnable() ? 0 : 1); - lineWidth.setSelectedLineStyle(ganttPlot.getLineWidth()); colorSelect.setSelectObject(ganttPlot.getLineColor()); + timeLinePane.populateBean(plot); } } @@ -121,6 +131,7 @@ public class VanChartGanttSeriesPane extends VanChartAbstractPlotSeriesPane { ganttPlot.setLineWidth(lineWidth.getSelectedLineStyle()); ganttPlot.setLineColor(colorSelect.getSelectObject()); + timeLinePane.updateBean(plot); } }