diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index aae009dc42..3515be8f24 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -79,37 +79,43 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh public static WidgetOption[] initWidgetOption(){ - final ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); - final ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; + ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); + ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; + final Chart[][] allCharts = new Chart[typeName.length][]; + for (int i = 0; i < typeName.length; i++) { + String plotID = typeName[i].getPlotID(); + Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); + if(rowChart == null) { + continue; + } + 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; + } - //异步加载 + //异步加载图片 new Thread(new Runnable() { @Override public void run() { - getWidgetOption(typeName, child); + initAllChartsDemoImage(allCharts); } }).start(); return child; } - private static void getWidgetOption(ChartInternationalNameContentBean[] typeName, ChartWidgetOption[] child){ - for (int i = 0; i < typeName.length; i++) { - String plotID = typeName[i].getPlotID(); - Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); + //加载所有图表图片 + private static void initAllChartsDemoImage(Chart[][] allCharts){ + for (int i = 0; i < allCharts.length; i++) { + Chart[] rowChart = allCharts[i]; if(rowChart == null) { continue; } - //加载初始化图表模型图片 initChartsDemoImage(rowChart); - - 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]); } - - DesignModuleFactory.registerExtraWidgetOptions(child); } private static void initChartsDemoImage(Chart[] rowChart) {