From a597b91fd527681663d3feb89945b835ab53526a Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 10 Nov 2016 15:43:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index aae009dc42..f9a75a1058 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -79,37 +79,42 @@ 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[][] allChart = new Chart[typeName.length][]; + for (int i = 0; i < typeName.length; i++) { + String plotID = typeName[i].getPlotID(); + Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); + allChart[i] = rowChart; + 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]); + } - //异步加载 + //异步加载图片 new Thread(new Runnable() { @Override public void run() { - getWidgetOption(typeName, child); + initAllChartsDemoImage(allChart); } }).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) { From b2551fcccdf1564339871e55c2fb63600b9b2138 Mon Sep 17 00:00:00 2001 From: Fangjie Hu Date: Thu, 10 Nov 2016 15:46:13 +0800 Subject: [PATCH 2/2] update --- .../src/com/fr/design/ChartTypeInterfaceManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index f9a75a1058..3515be8f24 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -81,24 +81,25 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; - final Chart[][] allChart = new Chart[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); - allChart[i] = rowChart; 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() { - initAllChartsDemoImage(allChart); + initAllChartsDemoImage(allCharts); } }).start();