Browse Source

迭代-凸显新图表

master
xiaohu 8 years ago
parent
commit
b3401f978c
  1. 32
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

32
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -1,5 +1,6 @@
package com.fr.design; package com.fr.design;
import com.fr.base.Utils;
import com.fr.chart.base.ChartConstants; import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
@ -29,16 +30,15 @@ import com.fr.stable.plugin.PluginSimplify;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import java.util.Iterator; import java.util.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/** /**
* Created by eason on 14/12/29. * Created by eason on 14/12/29.
*/ */
public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider { public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraChartDesignClassManagerProvider {
private static final String OLD_CHART_PREFIX = "FineReport";
private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static ClassLoader loader = Thread.currentThread().getContextClassLoader();
private static ChartTypeInterfaceManager classManager = null; private static ChartTypeInterfaceManager classManager = null;
@ -133,14 +133,32 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
* @param paneList pane容器 * @param paneList pane容器
*/ */
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList) { public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList) {
//先构建新旧图表数组
List<IndependentChartUIProvider> newChartList = new ArrayList<IndependentChartUIProvider>();
List<IndependentChartUIProvider> oldChartList = new ArrayList<IndependentChartUIProvider>();
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next(); Map.Entry entry = (Map.Entry) iterator.next();
IndependentChartUIProvider creator = (IndependentChartUIProvider) entry.getValue(); if (isNewChart(entry.getKey())){
paneList.add(creator.getPlotTypePane()); newChartList.add((IndependentChartUIProvider) entry.getValue());
}else {
oldChartList.add((IndependentChartUIProvider) entry.getValue());
}
}
//新图表
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) { public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) {

Loading…
Cancel
Save