OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
Brian Wilkerson
2012/06/12 14:58:50
nit: copyright year
| |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class SYLKReader extends Reader { | 5 class SYLKReader extends Reader { |
6 | 6 |
7 SYLKReader() : super() { } | 7 SYLKReader() : super() { } |
8 | 8 |
9 void loadSpreadsheet(Spreadsheet spreadsheet, List<String> sylk) { | 9 void loadSpreadsheet(Spreadsheet spreadsheet, List<String> sylk) { |
10 int row, col; | 10 int row, col; |
11 String contents; | 11 String contents; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 | 96 |
97 void request(String name, void callback(String spreadsheet)) { | 97 void request(String name, void callback(String spreadsheet)) { |
98 String url = '/spreadsheet/get?name=$name'; | 98 String url = '/spreadsheet/get?name=$name'; |
99 XMLHttpRequest req = new XMLHttpRequest(); | 99 XMLHttpRequest req = new XMLHttpRequest(); |
100 req.on.readyStateChange.add((Event event) { | 100 req.on.readyStateChange.add((Event event) { |
101 if (req.readyState != XMLHttpRequest.DONE) { | 101 if (req.readyState != XMLHttpRequest.DONE) { |
102 return; | 102 return; |
103 } | 103 } |
104 | 104 |
105 String text; | 105 String text; |
106 switch (true) { | 106 if (req.status == 200 && req.responseText != null) { |
107 case req.status == 200 && req.responseText != null : | 107 text = req.responseText; |
108 text = req.responseText; | 108 } else { |
109 break; | 109 text = 'ID;P'; |
110 | |
111 default: | |
112 text = 'ID;P'; | |
113 break; | |
114 } | 110 } |
115 | 111 |
116 try { | 112 try { |
117 callback(text); | 113 callback(text); |
118 } catch (var e, var s) { | 114 } catch (var e, var s) { |
119 print(e); | 115 print(e); |
120 } | 116 } |
121 }); | 117 }); |
122 | 118 |
123 req.open('GET', url, true); | 119 req.open('GET', url, true); |
124 req.send(); | 120 req.send(); |
125 } | 121 } |
126 } | 122 } |
OLD | NEW |