From 6ae8a27ead76eb8b46ff60aee6deb3f1b7406cb9 Mon Sep 17 00:00:00 2001 From: xiaohu Date: Mon, 4 Jul 2016 14:56:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E8=AF=BB=E5=8F=96=E9=A1=BA?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 75 ++++++++----------- .../creator/cardlayout/XWCoverCardLayout.java | 7 ++ 2 files changed, 37 insertions(+), 45 deletions(-) create mode 100644 designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 4f5db4b69d..599263004f 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -1,6 +1,5 @@ package com.fr.design; -import com.fr.base.Utils; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; @@ -30,26 +29,29 @@ import com.fr.stable.plugin.PluginSimplify; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; -import java.util.*; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** * Created by eason on 14/12/29. */ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider { - private static final String OLD_CHART_PREFIX = "FineReport"; - private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static ChartTypeInterfaceManager classManager = null; + private static boolean isReadDefault = false; + private static LinkedHashMap chartTypeInterfaces = new LinkedHashMap(); public synchronized static ChartTypeInterfaceManager getInstance() { if (classManager == null) { classManager = new ChartTypeInterfaceManager(); chartTypeInterfaces.clear(); - classManager.readDefault(); + //默认图表类型在新图表类型后面读取 classManager.readXMLFile(); } return classManager; @@ -68,25 +70,26 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh } private static void readDefault() { - - chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); - chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); - + if (!isReadDefault) { + chartTypeInterfaces.put(ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.LINE_CHART, new LineIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.BAR_CHART, new BarIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.PIE_CHART, new PieIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.METER_CHART, new MeterIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.MAP_CHART, new MapIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); + chartTypeInterfaces.put(ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); + } + isReadDefault = true; } @@ -133,32 +136,14 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh * @param paneList pane容器 */ public void addPlotTypePaneList(List> paneList) { - //先构建新旧图表数组 - List newChartList = new ArrayList(); - List oldChartList = new ArrayList(); + classManager.readDefault(); Iterator iterator = chartTypeInterfaces.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); - if (isNewChart(entry.getKey())){ - newChartList.add((IndependentChartUIProvider) entry.getValue()); - }else { - oldChartList.add((IndependentChartUIProvider) entry.getValue()); - } + IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); + paneList.add(creator.getPlotTypePane()); } - //新图表 - for (int i = 0; i < newChartList.size(); i++) { - paneList.add(newChartList.get(i).getPlotTypePane()); - } - //老图表 - for (int i = 0; i < oldChartList.size(); i++) { - paneList.add(oldChartList.get(i).getPlotTypePane()); - } - - - } - private boolean isNewChart(Object key) { - return !Utils.objectToString(key).startsWith(OLD_CHART_PREFIX); } public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java new file mode 100644 index 0000000000..12c8083829 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java @@ -0,0 +1,7 @@ +package com.fr.design.designer.creator.cardlayout; + +/** + * Created by Fangjie on 2016/6/30. + */ +public class XWCoverCardLayout { +}