From 4774ad05f04f6bbe561b181e744fe8d0a605c51d Mon Sep 17 00:00:00 2001 From: shine Date: Mon, 7 Jun 2021 09:58:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=E7=BC=96=E8=BE=91=E5=99=A8=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=20=E6=B2=A1=E6=9C=89=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90=20=E5=9B=BE=E8=A1=A8=E5=88=87?= =?UTF-8?q?=E6=8D=A2=20=E7=9B=91=E6=8E=A7=E5=88=B7=E6=96=B0=E7=AD=89?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/chart/gui/ChartTypePane.java | 12 +++++++-- .../chart/gui/data/NormalChartDataPane.java | 9 ++++--- .../chart/mode/ChartEditContext.java | 26 +++++++++++++++++++ .../mainframe/chart/mode/ChartEditMode.java | 12 +++++++++ .../other/VanChartCustomInteractivePane.java | 4 ++- .../other/VanChartInteractivePane.java | 15 +++++++++-- .../VanChartDrillMapInteractivePane.java | 8 +++++- .../other/VanChartMapInteractivePane.java | 3 +++ 8 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java create mode 100644 designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 553895a18..5137901ee 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -17,6 +17,7 @@ import com.fr.design.mainframe.chart.PaneTitleConstants; import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox; import com.fr.design.mainframe.chart.gui.item.ItemEventType; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.module.DesignModuleFactory; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -60,7 +61,14 @@ public class ChartTypePane extends AbstractChartAttrPane { if (editingCollection != null) { relayoutChartTypePane(editingCollection); } else { - chartTypeComBox = new ComboBoxPane(); + chartTypeComBox = new ComboBoxPane() { + @Override + protected void initLayout() { + super.initLayout(); + jcb.setVisible(ChartEditContext.normalMode()); + } + }; + } BasicScrollPane scrollPane = new BasicScrollPane() { @@ -388,7 +396,7 @@ public class ChartTypePane extends AbstractChartAttrPane { buttonPane.populateBean(collection); chartTypeComBox.populateBean(chart); - buttonPane.setVisible(ChartTypeInterfaceManager.getInstance().needChartChangePane(chart)); + buttonPane.setVisible(ChartTypeInterfaceManager.getInstance().needChartChangePane(chart) && ChartEditContext.normalMode()); this.initAllListeners(); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index 42cf782c3..86f7e4da8 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java @@ -7,16 +7,17 @@ import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.chart.gui.ChartDataPane; +import com.fr.design.mainframe.chart.mode.ChartEditContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.van.chart.designer.AbstractVanChartScrollPane; import javax.swing.BorderFactory; import javax.swing.JPanel; -import java.util.ArrayList; -import java.util.List; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; +import java.util.ArrayList; +import java.util.List; /** * 一般数据界面 @@ -67,7 +68,9 @@ public class NormalChartDataPane extends DataContentsPane { label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT)); northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); northPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,8)); - this.add(northPane, BorderLayout.NORTH); + if (ChartEditContext.normalMode()) { + this.add(northPane, BorderLayout.NORTH); + } this.add(cardPane, BorderLayout.CENTER); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java new file mode 100644 index 000000000..23616a482 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditContext.java @@ -0,0 +1,26 @@ +package com.fr.design.mainframe.chart.mode; + +import com.fr.common.annotations.Open; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/6/4 + */ +@Open +public class ChartEditContext { + + private static ChartEditMode current = ChartEditMode.NORMAL; + + public static void switchTo(ChartEditMode mode) { + current = mode; + } + + public static boolean duchampMode() { + return current == ChartEditMode.DUCHAMP; + } + + public static boolean normalMode() { + return current == ChartEditMode.NORMAL; + } +} diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java new file mode 100644 index 000000000..c5cc9da48 --- /dev/null +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/mode/ChartEditMode.java @@ -0,0 +1,12 @@ +package com.fr.design.mainframe.chart.mode; + +/** + * @author shine + * @version 10.0 + * Created by shine on 2021/6/4 + */ +//todo:refactor 弹出框图表没有单元格数据源,就不用一层层传下去了 +public enum ChartEditMode { + NORMAL, + DUCHAMP +} diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java index f399d90e8..8aab51b3f 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java @@ -1,7 +1,6 @@ package com.fr.van.chart.custom.other; import com.fr.chart.chartattr.Plot; - import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.custom.VanChartCustomPlot; import com.fr.plugin.chart.custom.type.CustomStyle; @@ -37,6 +36,9 @@ public class VanChartCustomInteractivePane extends VanChartInteractivePane { @Override protected void populateHyperlink(Plot plot) { + if (hyperlinkPane == null) { + return; + } hyperlinkPane.populateBean(chart); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java index 885931cb9..8e487a690 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java @@ -17,6 +17,7 @@ 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.mode.ChartEditContext; import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; @@ -120,7 +121,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { double[] rowSize = {p, p, p, p, p, p, p}; - Component[][] components = new Component[][]{ + Component[][] components = ChartEditContext.normalMode() ? new Component[][]{ new Component[]{createToolBarPane(getToolBarRowSize(), columnSize), null}, //大数据模式 恢复用注释。取消注释。 //new Component[]{createLargeDataModePane(), null}, @@ -129,6 +130,11 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createHyperlinkPane(), null} + } : new Component[][]{ + new Component[]{createToolBarPane(getToolBarRowSize(), columnSize), null}, + new Component[]{createAnimationPane(), null}, + new Component[]{createAxisRotationPane(new double[]{p, p}, columnSize, plot), null}, + new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null} }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -487,6 +493,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { protected void populateHyperlink(Plot plot) { + if (superLink == null) { + return; + } superLink.populate(plot); } @@ -526,7 +535,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane { } protected void populateAutoRefresh(VanChart chart) { - VanChartPlot plot = chart.getPlot(); + if (autoRefreshPane == null) { + return; + } RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel(); if (refreshMoreLabel == null) { 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 1c8c98f42..0122b529b 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 @@ -7,6 +7,7 @@ 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.mode.ChartEditContext; import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.drillmap.VanChartDrillMapPlot; import com.fr.plugin.chart.vanchart.VanChart; @@ -39,13 +40,18 @@ public class VanChartDrillMapInteractivePane extends VanChartInteractivePaneWith double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double[] columnSize = {f, e}; double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p}; - Component[][] components = new Component[][]{ + Component[][] components = ChartEditContext.normalMode() ? new Component[][]{ new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, new Component[]{createAnimationPane(), null}, new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, new Component[]{createDrillToolsPane(), null}, new Component[]{createAutoRefreshPane(plot), null}, new Component[]{createHyperlinkPane(), null} + } : new Component[][]{ + new Component[]{createToolBarPane(new double[]{p, p, p}, columnSize), null}, + new Component[]{createAnimationPane(), null}, + new Component[]{createZoomPane(new double[]{p, p, p}, columnSize, plot), null}, + new Component[]{createDrillToolsPane(), null} }; return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java index 0f89fed69..a6ede0df7 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java @@ -27,6 +27,9 @@ public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZo @Override protected void populateHyperlink(Plot plot) { + if (hyperlinkPane == null) { + return; + } hyperlinkPane.populateBean(plot); } From 65d5e8179b44118b44a52a4569168d38625b4e02 Mon Sep 17 00:00:00 2001 From: shine Date: Tue, 8 Jun 2021 19:47:52 +0800 Subject: [PATCH 2/2] api level --- .../fr/extended/chart/AbstractExtendedChartUIProvider.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java index a1a088020..64b480853 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartUIProvider.java @@ -14,10 +14,14 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import static com.fr.design.chart.fun.ChartTypeUIProvider.CURRENT_API_LEVEL; /** * Created by shine on 2018/3/2. */ +@API(level = CURRENT_API_LEVEL) public abstract class AbstractExtendedChartUIProvider extends AbstractProvider implements ChartTypeUIProvider { protected abstract AbstractExtendedChartTableDataPane getTableDataSourcePane();