From 6c6b16522614afbf794325ffb1814eacd8026125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B2=B3?= <445798420@qq.com> Date: Wed, 18 Sep 2019 17:40:54 +0800 Subject: [PATCH] =?UTF-8?q?CHART-10233=20=E5=AF=B9=E6=96=B0=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=81=9A=E4=BA=86=E9=80=82=E9=85=8D=E5=92=8C=E5=85=BC?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 76 ++++++++++--------- .../design/chart/fun/ChartTypeUIProvider.java | 4 +- .../chart/fun/impl/AbstractChartTypeUI.java | 2 + 3 files changed, 46 insertions(+), 36 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index b931aa9910..eedced540b 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -125,7 +125,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public static final String TYPE_PANE_DEFAULT_TITLE = "DEFAULT_NAME"; public synchronized static ChartTypeInterfaceManager getInstance() { - + return classManager; } @@ -158,7 +158,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } }); } - + public static WidgetOption[] initWidgetOption() { String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs(); @@ -201,8 +201,8 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface()); addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new StructureIndependentVanChartInterface()); } - - + + private static void readDefault() { addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); @@ -225,7 +225,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } private static void addChartTypeInterface(String priority, String plotID, ChartTypeUIProvider provider) { - + if (chartTypeInterfaces != null) { if (!chartTypeInterfaces.containsKey(priority)) { //新建一个具体图表列表 @@ -252,14 +252,14 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } return null; } - + /** * 把所有的pane加到list里 * * @param paneList pane容器 */ public void addPlotTypePaneList(List> paneList, Map>> allChartTypePane) { - + List priorityList = getPriorityInOrder(); for (Integer aPriorityList : priorityList) { String priority = String.valueOf(aPriorityList); @@ -302,9 +302,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public String getTitle4PopupWindow(String plotID) { return getName(plotID); } - + private List getPriorityInOrder() { - + List priorityList = new ArrayList(); if (chartTypeInterfaces != null) { Iterator iterator = chartTypeInterfaces.entrySet().iterator(); @@ -464,7 +464,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return provider.getPlotTypePane().title4PopupWindow(); } - + public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { ChartTypeUIProvider provider = getChartTypeInterface(plotID); if (provider != null) { @@ -473,7 +473,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return new ChartDataPane(listener); } - + public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) { ChartTypeUIProvider provider = getChartTypeInterface(plotID); if (provider != null) { @@ -481,9 +481,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } return new AbstractChartAttrPane[0]; - + } - + public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); @@ -493,7 +493,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return null; } - + public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); @@ -503,7 +503,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return null; } - + public ConditionAttributesPane getPlotConditionPane(Plot plot) { ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); @@ -513,7 +513,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return null; } - + public BasicBeanPane getPlotSeriesPane(ChartStylePane parent, Plot plot) { ChartTypeUIProvider provider = getChartTypeInterface(plot.getPlotID()); @@ -523,7 +523,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return null; } - + /** * 是否使用默认的界面,为了避免界面来回切换 * @@ -536,7 +536,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr if (provider != null) { return provider.isUseDefaultPane(); } - + return true; } @@ -551,31 +551,37 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr return true; } - + @Override public void mount(PluginSingleInjection injection) { - - if (isIndependentChartUIProvider(injection)) { + + if (isChartTypeUIProvider(injection)) { + String id = injection.getAttribute("chartID"); + if (StringUtils.isEmpty(id)) { + id = injection.getAttribute("plotID"); + } String priority = injection.getAttribute("priority", DEFAULT_PRIORITY); - String plotID = injection.getAttribute("plotID"); ChartTypeUIProvider instance = (ChartTypeUIProvider) injection.getObject(); - addChartTypeInterface(priority, plotID, instance); + addChartTypeInterface(priority, id, instance); } } - - + + @Override public void demount(PluginSingleInjection injection) { - - if (isIndependentChartUIProvider(injection)) { + + if (isChartTypeUIProvider(injection)) { String priority = injection.getAttribute("priority", DEFAULT_PRIORITY); - String plotID = injection.getAttribute("plotID"); - removeChartTypeInterface(priority, plotID); + String id = injection.getAttribute("chartID"); + if (StringUtils.isEmpty(id)) { + id = injection.getAttribute("plotID"); + } + removeChartTypeInterface(priority, id); } } - + private void removeChartTypeInterface(String priority, String plotID) { - + if (chartTypeInterfaces != null) { if (chartTypeInterfaces.containsKey(priority)) { Map chartUIList = chartTypeInterfaces.get(priority); @@ -583,11 +589,11 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } } } - - - private boolean isIndependentChartUIProvider(PluginSingleInjection injection) { - return !(injection == null || injection.getObject() == null) && ChartTypeUIProvider.XML_TAG.equals(injection.getName()) && injection.getObject() instanceof ChartTypeUIProvider; + + private boolean isChartTypeUIProvider(PluginSingleInjection injection) { + + return !(injection == null || injection.getObject() == null) && (ChartTypeUIProvider.XML_TAG.equals(injection.getName()) || ChartTypeUIProvider.OLD_TAG.equals(injection.getName())) && injection.getObject() instanceof ChartTypeUIProvider; } diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java b/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java index 586b3fc6ad..9db47e4318 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/ChartTypeUIProvider.java @@ -23,7 +23,9 @@ import com.fr.stable.fun.Level; */ public interface ChartTypeUIProvider extends Level { - String XML_TAG = SpecialLevel.IndependentChartUIProvider.getTagName(); + String XML_TAG = "ChartTypeUIProvider"; + + String OLD_TAG = SpecialLevel.IndependentChartUIProvider.getTagName(); int CURRENT_API_LEVEL = 3; diff --git a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java index 86d7ee9fab..289505aa0e 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java +++ b/designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java @@ -16,10 +16,12 @@ 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; /** * Created by shine on 2019/09/03. */ +@API(level = ChartTypeUIProvider.CURRENT_API_LEVEL) public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider { @Override