From fb5237b5448d687c4a8e34e3afdce327c517a528 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Mon, 31 Oct 2016 11:14:34 +0800 Subject: [PATCH 1/5] update --- designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 743cc54504..b3b04f948a 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -96,7 +96,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } }).start(); - return child; } From b05333e82147f6d8e09c52b462c5dbc173b98eb4 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Wed, 2 Nov 2016 11:32:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 53 ++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index b3b04f948a..d40b43bd27 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -21,10 +21,7 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane import com.fr.design.module.DesignModuleFactory; import com.fr.file.XMLFileManager; import com.fr.form.ui.ChartEditor; -import com.fr.general.FRLogger; -import com.fr.general.GeneralContext; -import com.fr.general.IOUtils; -import com.fr.general.Inter; +import com.fr.general.*; import com.fr.plugin.PluginCollector; import com.fr.plugin.PluginLicenseManager; import com.fr.plugin.PluginMessage; @@ -52,7 +49,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh private static ChartTypeInterfaceManager classManager = null; private static LinkedHashMap> chartTypeInterfaces = new LinkedHashMap>(); - private static final String DEFAULT_CHART_ID = "DefaultChart"; public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { @@ -150,7 +146,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh chartUIList.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); chartUIList.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); - chartTypeInterfaces.put(DEFAULT_CHART_ID, chartUIList); + chartTypeInterfaces.put(ChartTypeManager.DEFAULT_CHART_ID, chartUIList); } public String getIconPath(String plotID) { @@ -291,15 +287,36 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh int index = 0; + //处理vanChart + { + Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); + while (vanChartUI.hasNext()) { + Map.Entry chartUIEntry = (Map.Entry) vanChartUI.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + names[index++] = provider.getPlotTypePane().title4PopupWindow(); + } + } + //处理chart + { + Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); + while (chartUI.hasNext()) { + Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + names[index++] = provider.getPlotTypePane().title4PopupWindow(); + } + } + //其它图表 Iterator i = chartTypeInterfaces.entrySet().iterator(); while (i.hasNext()){ Map.Entry entry = (Map.Entry) i.next(); String chartID = (String) entry.getKey(); - Iterator chartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); - while (chartUI.hasNext()){ - Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); - IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index++] = provider.getPlotTypePane().title4PopupWindow(); + if (!(ComparatorUtils.equals(chartID, ChartTypeManager.chartID) || ComparatorUtils.equals(chartID, ChartTypeManager.vanChartID))) { + Iterator otherChartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); + while (otherChartUI.hasNext()) { + Map.Entry chartUIEntry = (Map.Entry) otherChartUI.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + names[index++] = provider.getPlotTypePane().title4PopupWindow(); + } } } return names; @@ -317,7 +334,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getChartDataPane(chartID, plotID, listener); } } - return getChartDataPane(DEFAULT_CHART_ID, plotID, listener); + return getChartDataPane(ChartTypeManager.DEFAULT_CHART_ID, plotID, listener); } private ChartDataPane getChartDataPane(String chartID, String plotID, AttributeChangeListener listener) { @@ -345,7 +362,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getAttrPaneArray(chartID, plotID, listener); } } - return getAttrPaneArray(DEFAULT_CHART_ID, plotID, listener); + return getAttrPaneArray(ChartTypeManager.DEFAULT_CHART_ID, plotID, listener); } private AbstractChartAttrPane[] getAttrPaneArray(String chartID, String plotID, AttributeChangeListener listener) { @@ -361,7 +378,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getTableDataSourcePane(chartID, plot, parent); } } - return getTableDataSourcePane(DEFAULT_CHART_ID, plot, parent); + return getTableDataSourcePane(ChartTypeManager.DEFAULT_CHART_ID, plot, parent); } private AbstractTableDataContentPane getTableDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { @@ -379,7 +396,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getReportDataSourcePane(chartID, plot, parent); } } - return getReportDataSourcePane(DEFAULT_CHART_ID, plot, parent); + return getReportDataSourcePane(ChartTypeManager.DEFAULT_CHART_ID, plot, parent); } private boolean plotInChart(String plotID, String chartID) { @@ -402,7 +419,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getPlotConditionPane(chartID, plot); } } - return getPlotConditionPane(DEFAULT_CHART_ID, plot); + return getPlotConditionPane(ChartTypeManager.DEFAULT_CHART_ID, plot); } private ConditionAttributesPane getPlotConditionPane(String chartID, Plot plot) { @@ -419,7 +436,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return getPlotSeriesPane(chartID, parent, plot); } } - return getPlotSeriesPane(DEFAULT_CHART_ID, parent, plot); + return getPlotSeriesPane(ChartTypeManager.DEFAULT_CHART_ID, parent, plot); } private BasicBeanPane getPlotSeriesPane(String chartID, ChartStylePane parent, Plot plot) { @@ -466,7 +483,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh extraChartDesignInterfaceList.add(tagName); } if (IndependentChartUIProvider.XML_TAG.equals(tagName)) { - addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); + addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", ChartTypeManager.DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); } } } From 0f67a73d231126c295fc0eec24933bdc7f12038e Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Wed, 2 Nov 2016 11:48:59 +0800 Subject: [PATCH 3/5] update --- .../fr/design/ChartTypeInterfaceManager.java | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index d40b43bd27..eaa8625302 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -290,20 +290,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh //处理vanChart { Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); - while (vanChartUI.hasNext()) { - Map.Entry chartUIEntry = (Map.Entry) vanChartUI.next(); - IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index++] = provider.getPlotTypePane().title4PopupWindow(); - } + fetchNames(vanChartUI, names, index++); } //处理chart { Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); - while (chartUI.hasNext()) { - Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); - IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index++] = provider.getPlotTypePane().title4PopupWindow(); - } + fetchNames(chartUI, names, index++); } //其它图表 Iterator i = chartTypeInterfaces.entrySet().iterator(); @@ -312,11 +304,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); if (!(ComparatorUtils.equals(chartID, ChartTypeManager.chartID) || ComparatorUtils.equals(chartID, ChartTypeManager.vanChartID))) { Iterator otherChartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); - while (otherChartUI.hasNext()) { - Map.Entry chartUIEntry = (Map.Entry) otherChartUI.next(); - IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index++] = provider.getPlotTypePane().title4PopupWindow(); - } + fetchNames(otherChartUI, names, index++); } } return names; @@ -325,6 +313,14 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return new String[0]; } + private void fetchNames(Iterator chartUI, String[] names, int index) { + while (chartUI.hasNext()) { + Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); + IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); + names[index] = provider.getPlotTypePane().title4PopupWindow(); + } + } + public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ From fadf534930ba580e6f6467b1827d85252d610934 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Wed, 2 Nov 2016 11:54:40 +0800 Subject: [PATCH 4/5] update --- .../fr/design/ChartTypeInterfaceManager.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index eaa8625302..51d03ab3dc 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -288,15 +288,11 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh int index = 0; //处理vanChart - { - Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); - fetchNames(vanChartUI, names, index++); - } + Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); + index = fetchNames(vanChartUI, names, index); //处理chart - { - Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); - fetchNames(chartUI, names, index++); - } + Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); + index = fetchNames(chartUI, names, index); //其它图表 Iterator i = chartTypeInterfaces.entrySet().iterator(); while (i.hasNext()){ @@ -304,7 +300,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh String chartID = (String) entry.getKey(); if (!(ComparatorUtils.equals(chartID, ChartTypeManager.chartID) || ComparatorUtils.equals(chartID, ChartTypeManager.vanChartID))) { Iterator otherChartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); - fetchNames(otherChartUI, names, index++); + index = fetchNames(otherChartUI, names, index); } } return names; @@ -313,12 +309,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return new String[0]; } - private void fetchNames(Iterator chartUI, String[] names, int index) { + private int fetchNames(Iterator chartUI, String[] names, int index) { while (chartUI.hasNext()) { Map.Entry chartUIEntry = (Map.Entry) chartUI.next(); IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); - names[index] = provider.getPlotTypePane().title4PopupWindow(); + names[index++] = provider.getPlotTypePane().title4PopupWindow(); } + return index; } public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { From 08ba6060241ebb8ec41fbcee67d7ad7ee5005222 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Wed, 2 Nov 2016 17:27:59 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E4=BC=98=E5=85=88?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 183 +++++++++--------- .../mainframe/chart/gui/ChartTypePane.java | 4 +- 2 files changed, 91 insertions(+), 96 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 51d03ab3dc..873a967501 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -54,6 +54,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (classManager == null) { classManager = new ChartTypeInterfaceManager(); chartTypeInterfaces.clear(); + classManager.readDefault(); } return classManager; } @@ -70,9 +71,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh GeneralContext.addPluginReadListener(new PluginReadListener() { @Override public void success() { - if (chartTypeInterfaces.size() == 0) { - ChartTypeInterfaceManager.getInstance().readDefault(); - } //重新注册designModuleFactory DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); } @@ -127,6 +125,9 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private static void readDefault() { + if (chartTypeInterfaces.containsKey(ChartTypeManager.CHART_PRIORITY)){ + return; + } LinkedHashMap chartUIList = new LinkedHashMap(); chartUIList.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); chartUIList.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); @@ -146,7 +147,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh chartUIList.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); chartUIList.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); - chartTypeInterfaces.put(ChartTypeManager.DEFAULT_CHART_ID, chartUIList); + chartTypeInterfaces.put(ChartTypeManager.CHART_PRIORITY, chartUIList); } public String getIconPath(String plotID) { @@ -154,8 +155,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - String imagePath = getIconPath(chartID, plotID); + String priority = (String) entry.getKey(); + String imagePath = getIconPath(priority, plotID); if (!StringUtils.isEmpty(imagePath)) { return imagePath; } @@ -164,23 +165,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh return StringUtils.EMPTY; } - private String getIconPath(String chartID, String plotID) { - if (chartTypeInterfaces.get(chartID) != null && chartTypeInterfaces.get(chartID).get(plotID) != null) { - return chartTypeInterfaces.get(chartID).get(plotID).getIconPath(); + private String getIconPath(String priority, String plotID) { + if (chartTypeInterfaces.get(priority) != null && chartTypeInterfaces.get(priority).get(plotID) != null) { + return chartTypeInterfaces.get(priority).get(plotID).getIconPath(); }else { return StringUtils.EMPTY; } } - public static void addChartTypeInterface(IndependentChartUIProvider provider, String chartID, String plotID) { + public static void addChartTypeInterface(IndependentChartUIProvider provider, String priority, String plotID) { if (chartTypeInterfaces != null){ - if (!chartTypeInterfaces.containsKey(chartID)){ + if (!chartTypeInterfaces.containsKey(priority)){ //新建一个具体图表列表 LinkedHashMap chartUIList = new LinkedHashMap(); chartUIList.put(plotID, provider); - chartTypeInterfaces.put(chartID, chartUIList); + chartTypeInterfaces.put(priority, chartUIList); }else { - LinkedHashMap chartUIList = chartTypeInterfaces.get(chartID); + LinkedHashMap chartUIList = chartTypeInterfaces.get(priority); if (!chartUIList.containsKey(plotID)) { chartUIList.put(plotID, provider); } @@ -194,7 +195,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param className 类名 * @param plotID 标志ID */ - public void addChartInterface(String className, String chartID, String plotID, PluginSimplify simplify) { + public void addChartInterface(String className, String priority, String plotID, PluginSimplify simplify) { if (StringUtils.isNotBlank(className)) { try { Class clazz = Class.forName(className); @@ -206,7 +207,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) { PluginMessage.remindUpdate(className); } else { - ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, chartID, plotID); + ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, priority, plotID); } } catch (ClassNotFoundException e) { FRLogger.getLogger().error("class not found:" + e.getMessage()); @@ -230,8 +231,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - Iterator chartUIIterator = chartTypeInterfaces.get(chartID).entrySet().iterator(); + String priority = (String) entry.getKey(); + Iterator chartUIIterator = chartTypeInterfaces.get(priority).entrySet().iterator(); while (chartUIIterator.hasNext()) { Map.Entry chartUIEntry = (Map.Entry) chartUIIterator.next(); IndependentChartUIProvider provider = (IndependentChartUIProvider) chartUIEntry.getValue(); @@ -240,13 +241,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } } - public String[] getTitle4PopupWindow(String chartID){ - if (chartID.isEmpty()){ + public String[] getTitle4PopupWindow(String priority){ + if (priority.isEmpty()){ return getTitle4PopupWindow(); } - String[] names = new String[getChartSize(chartID)]; - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){ - HashMap chartUIList = chartTypeInterfaces.get(chartID); + String[] names = new String[getChartSize(priority)]; + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)){ + HashMap chartUIList = chartTypeInterfaces.get(priority); Iterator iterator = chartUIList.entrySet().iterator(); int i = 0; while (iterator.hasNext()){ @@ -261,13 +262,13 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh /** * 获取指定图表的标题 - * @param chartID + * @param priority * @return */ - public String getTitle4PopupWindow(String chartID, String plotID){ - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)){ - HashMap chartUIList = chartTypeInterfaces.get(chartID); - IndependentChartUIProvider provider = chartTypeInterfaces.get(chartID).get(plotID); + public String getTitle4PopupWindow(String priority, String plotID){ + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)){ + HashMap chartUIList = chartTypeInterfaces.get(priority); + IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID); return provider.getPlotTypePane().title4PopupWindow(); } @@ -275,34 +276,28 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private String[] getTitle4PopupWindow(){ + List priorityList = new ArrayList(); int size = 0; if (chartTypeInterfaces != null){ Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - size += getChartSize(chartID); + String priority = (String) entry.getKey(); + priorityList.add(Integer.valueOf(priority)); + size += getChartSize(priority); } String[] names = new String[size]; + priorityList = ChartTypeManager.orderInPriority(priorityList); + int index = 0; - //处理vanChart - Iterator vanChartUI = chartTypeInterfaces.get(ChartTypeManager.vanChartID).entrySet().iterator(); - index = fetchNames(vanChartUI, names, index); - //处理chart - Iterator chartUI = chartTypeInterfaces.get(ChartTypeManager.chartID).entrySet().iterator(); - index = fetchNames(chartUI, names, index); - //其它图表 - Iterator i = chartTypeInterfaces.entrySet().iterator(); - while (i.hasNext()){ - Map.Entry entry = (Map.Entry) i.next(); - String chartID = (String) entry.getKey(); - if (!(ComparatorUtils.equals(chartID, ChartTypeManager.chartID) || ComparatorUtils.equals(chartID, ChartTypeManager.vanChartID))) { - Iterator otherChartUI = chartTypeInterfaces.get(chartID).entrySet().iterator(); - index = fetchNames(otherChartUI, names, index); - } + for (int i = 0; i < priorityList.size(); i++){ + String priority = String.valueOf(priorityList.get(i)); + Iterator chartUI = chartTypeInterfaces.get(priority).entrySet().iterator(); + index = fetchNames(chartUI, names, index); } + return names; } @@ -322,26 +317,26 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plotID, chartID)) { - return getChartDataPane(chartID, plotID, listener); + String priority = (String) entry.getKey(); + if (plotInChart(plotID, priority)) { + return getChartDataPane(priority, plotID, listener); } } - return getChartDataPane(ChartTypeManager.DEFAULT_CHART_ID, plotID, listener); + return getChartDataPane(ChartTypeManager.CHART_PRIORITY, plotID, listener); } - private ChartDataPane getChartDataPane(String chartID, String plotID, AttributeChangeListener listener) { - return chartTypeInterfaces.get(chartID).get(plotID).getChartDataPane(listener); + private ChartDataPane getChartDataPane(String priority, String plotID, AttributeChangeListener listener) { + return chartTypeInterfaces.get(priority).get(plotID).getChartDataPane(listener); } /** * 获取对应ID的图表数量 - * @param chartID + * @param key * @return */ - private int getChartSize(String chartID){ - if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID)){ - return chartTypeInterfaces.get(chartID).size(); + private int getChartSize(String key){ + if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(key)){ + return chartTypeInterfaces.get(key).size(); } return 0; } @@ -350,32 +345,32 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plotID, chartID)) { - return getAttrPaneArray(chartID, plotID, listener); + String priority = (String) entry.getKey(); + if (plotInChart(plotID, priority)) { + return getAttrPaneArray(priority, plotID, listener); } } - return getAttrPaneArray(ChartTypeManager.DEFAULT_CHART_ID, plotID, listener); + return getAttrPaneArray(ChartTypeManager.CHART_PRIORITY, plotID, listener); } - private AbstractChartAttrPane[] getAttrPaneArray(String chartID, String plotID, AttributeChangeListener listener) { - return chartTypeInterfaces.get(chartID).get(plotID).getAttrPaneArray(listener); + private AbstractChartAttrPane[] getAttrPaneArray(String priority, String plotID, AttributeChangeListener listener) { + return chartTypeInterfaces.get(priority).get(plotID).getAttrPaneArray(listener); } public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plot.getPlotID(), chartID)) { - return getTableDataSourcePane(chartID, plot, parent); + String priority = (String) entry.getKey(); + if (plotInChart(plot.getPlotID(), priority)) { + return getTableDataSourcePane(priority, plot, parent); } } - return getTableDataSourcePane(ChartTypeManager.DEFAULT_CHART_ID, plot, parent); + return getTableDataSourcePane(ChartTypeManager.CHART_PRIORITY, plot, parent); } - private AbstractTableDataContentPane getTableDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { - return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getTableDataSourcePane(plot, parent); + private AbstractTableDataContentPane getTableDataSourcePane(String priority, Plot plot, ChartDataPane parent) { + return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getTableDataSourcePane(plot, parent); } @@ -383,23 +378,23 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); + String priority = (String) entry.getKey(); String plotID = plot.getPlotID(); - if (plotInChart(plotID, chartID)) { - return getReportDataSourcePane(chartID, plot, parent); + if (plotInChart(plotID, priority)) { + return getReportDataSourcePane(priority, plot, parent); } } - return getReportDataSourcePane(ChartTypeManager.DEFAULT_CHART_ID, plot, parent); + return getReportDataSourcePane(ChartTypeManager.CHART_PRIORITY, plot, parent); } - private boolean plotInChart(String plotID, String chartID) { + private boolean plotInChart(String plotID, String priority) { return chartTypeInterfaces != null - && chartTypeInterfaces.containsKey(chartID) - && chartTypeInterfaces.get(chartID).containsKey(plotID); + && chartTypeInterfaces.containsKey(priority) + && chartTypeInterfaces.get(priority).containsKey(plotID); } - private AbstractReportDataContentPane getReportDataSourcePane(String chartID, Plot plot, ChartDataPane parent) { - return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getReportDataSourcePane(plot, parent); + private AbstractReportDataContentPane getReportDataSourcePane(String priority, Plot plot, ChartDataPane parent) { + return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getReportDataSourcePane(plot, parent); } @@ -407,16 +402,16 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plot.getPlotID(), chartID)) { - return getPlotConditionPane(chartID, plot); + String priority = (String) entry.getKey(); + if (plotInChart(plot.getPlotID(), priority)) { + return getPlotConditionPane(priority, plot); } } - return getPlotConditionPane(ChartTypeManager.DEFAULT_CHART_ID, plot); + return getPlotConditionPane(ChartTypeManager.CHART_PRIORITY, plot); } - private ConditionAttributesPane getPlotConditionPane(String chartID, Plot plot) { - return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotConditionPane(plot); + private ConditionAttributesPane getPlotConditionPane(String priority, Plot plot) { + return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getPlotConditionPane(plot); } @@ -424,16 +419,16 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (plotInChart(plot.getPlotID(), chartID)) { - return getPlotSeriesPane(chartID, parent, plot); + String priority = (String) entry.getKey(); + if (plotInChart(plot.getPlotID(), priority)) { + return getPlotSeriesPane(priority, parent, plot); } } - return getPlotSeriesPane(ChartTypeManager.DEFAULT_CHART_ID, parent, plot); + return getPlotSeriesPane(ChartTypeManager.CHART_PRIORITY, parent, plot); } - private BasicBeanPane getPlotSeriesPane(String chartID, ChartStylePane parent, Plot plot) { - return chartTypeInterfaces.get(chartID).get(plot.getPlotID()).getPlotSeriesPane(parent, plot); + private BasicBeanPane getPlotSeriesPane(String priority, ChartStylePane parent, Plot plot) { + return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getPlotSeriesPane(parent, plot); } /** @@ -446,19 +441,19 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry) iterator.next(); - String chartID = (String) entry.getKey(); - if (chartTypeInterfaces.get(chartID).containsKey(plotID)){ - return isUseDefaultPane(chartID, plotID); + String priority = (String) entry.getKey(); + if (chartTypeInterfaces.get(priority).containsKey(plotID)){ + return isUseDefaultPane(priority, plotID); } } return true; } - private boolean isUseDefaultPane(String chartID, String plotID){ + private boolean isUseDefaultPane(String priority, String plotID){ - if (chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)) { - return chartTypeInterfaces.get(chartID).get(plotID).isUseDefaultPane(); + if (chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) { + return chartTypeInterfaces.get(priority).get(plotID).isUseDefaultPane(); } return true; @@ -476,7 +471,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh extraChartDesignInterfaceList.add(tagName); } if (IndependentChartUIProvider.XML_TAG.equals(tagName)) { - addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("chartID", ChartTypeManager.DEFAULT_CHART_ID),reader.getAttrAsString("plotID", ""), simplify); + addChartInterface(reader.getAttrAsString("class", ""), reader.getAttrAsString("priority", ChartTypeManager.CHART_PRIORITY),reader.getAttrAsString("plotID", ""), simplify); } } } diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 78f3f62712..229206f4dd 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java @@ -188,7 +188,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ public void reactor(ChartCollection collection){ //重构需要重构下拉框选项和cardNames Chart chart = collection.getSelectedChart(); - String chartID = chart.getChartID(); + String chartID = chart.getPriority(); if (collection.getState() == SwitchState.DEFAULT){ chartID = StringUtils.EMPTY; } @@ -197,7 +197,7 @@ public class ChartTypePane extends AbstractChartAttrPane{ //重构下拉框选项 reactorComboBox(); //重新选择选中的下拉项 - chartID = chart.getChartID(); + chartID = chart.getPriority(); String plotID = chart.getPlot().getPlotID(); Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); jcb.setSelectedItem(item);