Browse Source

Merge pull request #472 in BA/design from ~XIAOHU/design:dev to dev

* commit 'b2551fcccdf1564339871e55c2fb63600b9b2138':
  update
  图片异步处理
master
superman 8 years ago
parent
commit
2f7446b71a
  1. 36
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

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

Loading…
Cancel
Save