|
|
|
@ -27,7 +27,6 @@ import com.fr.design.chartinterface.RangeIndependentChartInterface;
|
|
|
|
|
import com.fr.design.chartinterface.StockIndependentChartInterface; |
|
|
|
|
import com.fr.design.chartinterface.XYScatterIndependentChartInterface; |
|
|
|
|
import com.fr.design.condition.ConditionAttributesPane; |
|
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
|
import com.fr.design.gui.core.WidgetOption; |
|
|
|
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
|
|
|
import com.fr.design.mainframe.chart.AbstractChartAttrPane; |
|
|
|
@ -60,7 +59,6 @@ import com.fr.plugin.chart.radar.VanChartRadarPlot;
|
|
|
|
|
import com.fr.plugin.chart.scatter.VanChartScatterPlot; |
|
|
|
|
import com.fr.plugin.chart.structure.VanChartStructurePlot; |
|
|
|
|
import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; |
|
|
|
|
import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent; |
|
|
|
|
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; |
|
|
|
|
import com.fr.plugin.injectable.PluginModule; |
|
|
|
|
import com.fr.plugin.injectable.PluginSingleInjection; |
|
|
|
@ -69,7 +67,6 @@ import com.fr.stable.ArrayUtils;
|
|
|
|
|
import com.fr.stable.EnvChangedListener; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; |
|
|
|
|
import com.fr.van.chart.DownloadOnlineSourcesHelper; |
|
|
|
|
import com.fr.van.chart.area.AreaIndependentVanChartInterface; |
|
|
|
|
import com.fr.van.chart.bar.BarIndependentVanChartInterface; |
|
|
|
|
import com.fr.van.chart.bubble.BubbleIndependentVanChartInterface; |
|
|
|
@ -109,22 +106,23 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static ChartTypeInterfaceManager classManager = new ChartTypeInterfaceManager(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>> chartTypeInterfaces = |
|
|
|
|
new LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>>(); |
|
|
|
|
new LinkedHashMap<String, CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>>(); |
|
|
|
|
|
|
|
|
|
private static Map<String, String> idAndPriorityMap = new HashMap<String, String>(); |
|
|
|
|
|
|
|
|
|
public synchronized static ChartTypeInterfaceManager getInstance() { |
|
|
|
|
|
|
|
|
|
return classManager; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
|
readDefault(); |
|
|
|
|
readVanChart(); |
|
|
|
|
PluginModule.registerAgent(PluginModule.ExtraChartDesign, classManager); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
|
|
|
|
|
|
GeneralContext.addEnvChangedListener(new EnvChangedListener() { |
|
|
|
@ -132,13 +130,11 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
public void envChanged() { |
|
|
|
|
//重新注册designModuleFactory
|
|
|
|
|
DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); |
|
|
|
|
DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); |
|
|
|
|
DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static WidgetOption[] initWidgetOption() { |
|
|
|
|
|
|
|
|
|
public static WidgetOption[] initWidgetOption() { |
|
|
|
|
|
|
|
|
|
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); |
|
|
|
|
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; |
|
|
|
@ -152,7 +148,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); |
|
|
|
|
Icon icon = IOUtils.readIcon(iconPath); |
|
|
|
|
child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
allCharts[i] = rowChart; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -167,10 +163,10 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
|
|
|
|
|
return child; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//加载所有图表图片
|
|
|
|
|
private static void initAllChartsDemoImage(Chart[][] allCharts) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Chart[] rowChart : allCharts) { |
|
|
|
|
if (rowChart == null) { |
|
|
|
|
continue; |
|
|
|
@ -179,9 +175,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
initChartsDemoImage(rowChart); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void initChartsDemoImage(Chart[] rowChart) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Chart aRowChart : rowChart) { |
|
|
|
|
//此时,为图片生成模型数据
|
|
|
|
|
aRowChart.createSlotImage(); |
|
|
|
@ -213,10 +209,10 @@ 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() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (chartTypeInterfaces.containsKey(CHART_PRIORITY)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -239,14 +235,14 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
addChartTypeInterface(CHART_PRIORITY, ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); |
|
|
|
|
addChartTypeInterface(CHART_PRIORITY, ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void addChartTypeInterface(String priority, String plotID, IndependentChartUIProvider provider) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (chartTypeInterfaces != null) { |
|
|
|
|
if (!chartTypeInterfaces.containsKey(priority)) { |
|
|
|
|
//新建一个具体图表列表
|
|
|
|
|
CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap> chartUIList |
|
|
|
|
= new CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>(LinkedHashMap.class); |
|
|
|
|
= new CloseableContainedMap<String, IndependentChartUIProvider, LinkedHashMap>(LinkedHashMap.class); |
|
|
|
|
chartUIList.put(plotID, provider); |
|
|
|
|
chartTypeInterfaces.put(priority, chartUIList); |
|
|
|
|
} else { |
|
|
|
@ -268,14 +264,14 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 把所有的pane加到list里 |
|
|
|
|
* |
|
|
|
|
* @param paneList pane容器 |
|
|
|
|
*/ |
|
|
|
|
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends Chart>> paneList) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Integer> priorityList = getPriorityInOrder(); |
|
|
|
|
for (Integer aPriorityList : priorityList) { |
|
|
|
|
String priority = String.valueOf(aPriorityList); |
|
|
|
@ -334,17 +330,17 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
|
|
|
|
|
return list.toArray(new String[list.size()]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取指定图表的标题 |
|
|
|
|
*/ |
|
|
|
|
public String getTitle4PopupWindow(String priority, String plotID) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority) && chartTypeInterfaces.get(priority).containsKey(plotID)) { |
|
|
|
|
IndependentChartUIProvider provider = chartTypeInterfaces.get(priority).get(plotID); |
|
|
|
|
return getChartName(plotID, provider); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//兼容老的插件
|
|
|
|
|
if (chartTypeInterfaces != null) { |
|
|
|
|
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); |
|
|
|
@ -358,9 +354,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
} |
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<Integer> getPriorityInOrder() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Integer> priorityList = new ArrayList<Integer>(); |
|
|
|
|
if (chartTypeInterfaces != null) { |
|
|
|
|
Iterator iterator = chartTypeInterfaces.entrySet().iterator(); |
|
|
|
@ -383,7 +379,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
} |
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ChartDataPane getChartDataPane(String plotID, AttributeChangeListener listener) { |
|
|
|
|
IndependentChartUIProvider provider = getChartTypeInterface(plotID); |
|
|
|
|
if (provider != null) { |
|
|
|
@ -392,19 +388,19 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
|
|
|
|
|
return new ChartDataPane(listener); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取对应ID的图表数量 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
private int getChartSize(String key) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(key)) { |
|
|
|
|
return chartTypeInterfaces.get(key).size(); |
|
|
|
|
} |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AbstractChartAttrPane[] getAttrPaneArray(String plotID, AttributeChangeListener listener) { |
|
|
|
|
IndependentChartUIProvider provider = getChartTypeInterface(plotID); |
|
|
|
|
if (provider != null) { |
|
|
|
@ -412,9 +408,9 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return new AbstractChartAttrPane[0]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { |
|
|
|
|
|
|
|
|
|
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID()); |
|
|
|
@ -424,7 +420,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { |
|
|
|
|
|
|
|
|
|
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID()); |
|
|
|
@ -434,15 +430,15 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean plotInChart(String plotID, String priority) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return chartTypeInterfaces != null |
|
|
|
|
&& chartTypeInterfaces.containsKey(priority) |
|
|
|
|
&& chartTypeInterfaces.get(priority).containsKey(plotID); |
|
|
|
|
&& chartTypeInterfaces.containsKey(priority) |
|
|
|
|
&& chartTypeInterfaces.get(priority).containsKey(plotID); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ConditionAttributesPane getPlotConditionPane(Plot plot) { |
|
|
|
|
|
|
|
|
|
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID()); |
|
|
|
@ -452,7 +448,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) { |
|
|
|
|
|
|
|
|
|
IndependentChartUIProvider provider = getChartTypeInterface(plot.getPlotID()); |
|
|
|
@ -462,7 +458,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 是否使用默认的界面,为了避免界面来回切换 |
|
|
|
|
* |
|
|
|
@ -475,7 +471,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
if (provider != null) { |
|
|
|
|
return provider.isUseDefaultPane(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -489,10 +485,10 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void mount(PluginSingleInjection injection) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isIndependentChartUIProvider(injection)) { |
|
|
|
|
String priority = injection.getAttribute("priority", CHART_PRIORITY); |
|
|
|
|
String plotID = injection.getAttribute("plotID"); |
|
|
|
@ -500,20 +496,20 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
addChartTypeInterface(priority, plotID, instance); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void demount(PluginSingleInjection injection) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isIndependentChartUIProvider(injection)) { |
|
|
|
|
String priority = injection.getAttribute("priority", CHART_PRIORITY); |
|
|
|
|
String plotID = injection.getAttribute("plotID"); |
|
|
|
|
removeChartTypeInterface(priority, plotID); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void removeChartTypeInterface(String priority, String plotID) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (chartTypeInterfaces != null) { |
|
|
|
|
if (chartTypeInterfaces.containsKey(priority)) { |
|
|
|
|
Map<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(priority); |
|
|
|
@ -521,10 +517,10 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isIndependentChartUIProvider(PluginSingleInjection injection) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return !(injection == null || injection.getObject() == null) && IndependentChartUIProvider.XML_TAG.equals(injection.getName()) && injection.getObject() instanceof IndependentChartUIProvider; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|