Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Unified Diff: samples/total/client/SYLKReader.dart

Issue 10635015: Delete proxy and total samples, which have bit-rotted. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/total/client/RowColStyle.dart ('k') | samples/total/client/Scanner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/total/client/SYLKReader.dart
===================================================================
--- samples/total/client/SYLKReader.dart (revision 9011)
+++ samples/total/client/SYLKReader.dart (working copy)
@@ -1,122 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-class SYLKReader extends Reader {
-
- SYLKReader() : super() { }
-
- void loadSpreadsheet(Spreadsheet spreadsheet, List<String> sylk) {
- int row, col;
- String contents;
- CellLocation lastLocation;
-
- for (int i = 0; i < sylk.length; i++) {
- List<String> parts = StringUtils.split(sylk[i], StringUtils.SEMICOLON);
- String cmd = parts[0];
- switch (cmd) {
- case "ID":
- break;
- case "B":
- for (int j = 1; j < parts.length; j++) {
- String part = parts[j];
- if (part.startsWith("X")) {
- col = Math.parseInt(part.substring(1, part.length));
- spreadsheet.setColumnCount(col);
- } else if (part.startsWith("Y")) {
- row = Math.parseInt(part.substring(1, part.length));
- spreadsheet.setRowCount(row);
- }
- }
- break;
- case "C":
- row = -1;
- col = -1;
- contents = "";
- for (int j = 1; j < parts.length; j++) {
- String part = parts[j];
- if (part.startsWith("Y")) {
- row = Math.parseInt(part.substring(1, part.length));
- } else if (part.startsWith("X")) {
- col = Math.parseInt(part.substring(1, part.length));
- } if (part.startsWith("K")) {
- contents = StringUtils.stripQuotes(part.substring(1, part.length));
- }
- }
- if (row == -1) {
- throw new RuntimeException("${i}: No row (Y) specified in ${sylk[i]}");
- }
- if (col == -1) {
- throw new RuntimeException("${i}: No col (X) specified in ${sylk[i]}");
- }
- lastLocation = new CellLocation(spreadsheet, new RowCol(row, col));
- spreadsheet.execute(new SetCellContentsCommand(lastLocation, contents));
- break;
- case "F":
- Cell lastCell = lastLocation.getCell();
- if (lastCell == null) {
- break;
- }
- Style style = lastCell.style;
- for (int j = 1; j < parts.length; j++) {
- String part = parts[j];
- if (part.startsWith("P")) {
- int formatIndex = Math.parseInt(part.substring(1, part.length));
- style = style.setNumericFormatByIndex(formatIndex);
- } else if (part.startsWith("S")) {
- switch (part[1]) {
- case "I"[0]:
- style = style.setTextFormatByIndex(Style.ITALIC);
- break;
- case "D"[0]:
- style = style.setTextFormatByIndex(Style.BOLD);
- break;
- }
- } else if (part.startsWith("F")) {
- // F;...;F<format><decimal_places><alignment>
- // Only handle alignment for now
- switch (part[3]) {
- case "L"[0]:
- style = style.setTextAlignment(Style.LEFT);
- break;
- case "C"[0]:
- style = style.setTextAlignment(Style.CENTER);
- break;
- case "R"[0]:
- style = style.setTextAlignment(Style.RIGHT);
- break;
- }
- }
- }
- spreadsheet.setCellStyle(lastLocation.rowCol, style);
- break;
- }
- }
- }
-
- void request(String name, void callback(String spreadsheet)) {
- String url = '/spreadsheet/get?name=$name';
- XMLHttpRequest req = new XMLHttpRequest();
- req.on.readyStateChange.add((Event event) {
- if (req.readyState != XMLHttpRequest.DONE) {
- return;
- }
-
- String text;
- if (req.status == 200 && req.responseText != null) {
- text = req.responseText;
- } else {
- text = 'ID;P';
- }
-
- try {
- callback(text);
- } catch (var e, var s) {
- print(e);
- }
- });
-
- req.open('GET', url, true);
- req.send();
- }
-}
« no previous file with comments | « samples/total/client/RowColStyle.dart ('k') | samples/total/client/Scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698