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(){
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) {

Loading…
Cancel
Save