Browse Source

插件读取顺序

master
xiaohu 9 years ago
parent
commit
6ae8a27ead
  1. 75
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  2. 7
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCoverCardLayout.java

75
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<String, IndependentChartUIProvider> chartTypeInterfaces = new LinkedHashMap<String, IndependentChartUIProvider>();
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<FurtherBasicBeanPane<? extends Chart>> paneList) {
//先构建新旧图表数组
List<IndependentChartUIProvider> newChartList = new ArrayList<IndependentChartUIProvider>();
List<IndependentChartUIProvider> oldChartList = new ArrayList<IndependentChartUIProvider>();
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) {

7
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 {
}
Loading…
Cancel
Save