Browse Source

图片异步处理

master
Fangjie Hu 8 years ago
parent
commit
a597b91fd5
  1. 35
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

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

@ -79,37 +79,42 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
public static WidgetOption[] initWidgetOption(){ public static WidgetOption[] initWidgetOption(){
final ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
final ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; 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() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
getWidgetOption(typeName, child); initAllChartsDemoImage(allChart);
} }
}).start(); }).start();
return child; return child;
} }
private static void getWidgetOption(ChartInternationalNameContentBean[] typeName, ChartWidgetOption[] child){ //加载所有图表图片
for (int i = 0; i < typeName.length; i++) { private static void initAllChartsDemoImage(Chart[][] allCharts){
String plotID = typeName[i].getPlotID(); for (int i = 0; i < allCharts.length; i++) {
Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); Chart[] rowChart = allCharts[i];
if(rowChart == null) { if(rowChart == null) {
continue; continue;
} }
//加载初始化图表模型图片 //加载初始化图表模型图片
initChartsDemoImage(rowChart); 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) { private static void initChartsDemoImage(Chart[] rowChart) {

Loading…
Cancel
Save