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(){ 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[][] 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() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
getWidgetOption(typeName, child); initAllChartsDemoImage(allCharts);
} }
}).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