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

Side by Side Diff: client/samples/total/src/HtmlTable.dart

Issue 8835006: New version of dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typos Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 /** 5 /**
6 * A class encapsulating the managemnet of the Html [:<table>:] representing the spreadsheet grid. 6 * A class encapsulating the managemnet of the Html [:<table>:] representing the spreadsheet grid.
7 */ 7 */
8 class HtmlTable { 8 class HtmlTable {
9 9
10 DivElement _formulaCellSelectingDiv; 10 DivElement _formulaCellSelectingDiv;
11 Spreadsheet _spreadsheet; 11 Spreadsheet _spreadsheet;
12 TableElement _table; 12 TableElement _table;
13 13
14 // Must be called after the creation of the <tbody> element 14 // Must be called after the creation of the <tbody> element
15 DivElement get formulaCellSelectingDiv() { 15 DivElement get formulaCellSelectingDiv() {
16 if (_formulaCellSelectingDiv == null) { 16 if (_formulaCellSelectingDiv == null) {
17 _formulaCellSelectingDiv = _table.document.createElement("div"); 17 _formulaCellSelectingDiv = new Element.tag("div");
18 _formulaCellSelectingDiv.id = "formulaSelectingCell-${_spreadsheet.name}"; 18 _formulaCellSelectingDiv.id = "formulaSelectingCell-${_spreadsheet.name}";
19 _formulaCellSelectingDiv.attributes["class"] = "formulaSelectingCell"; 19 _formulaCellSelectingDiv.attributes["class"] = "formulaSelectingCell";
20 } 20 }
21 _table.nodes.add(_formulaCellSelectingDiv); 21 _table.nodes.add(_formulaCellSelectingDiv);
22 return _formulaCellSelectingDiv; 22 return _formulaCellSelectingDiv;
23 } 23 }
24 24
25 // FIXME 25 // FIXME
26 ElementEvents get on() => _table.on; 26 ElementEvents get on() => _table.on;
27 27
28 HtmlTable(this._spreadsheet, Element parent) { 28 HtmlTable(this._spreadsheet, Element parent) {
29 Document doc = parent.document; 29 Document doc = parent.document;
30 30
31 _table = doc.createElement("table"); 31 _table = new Element.tag("table");
32 _table.attributes["class"] = "spreadsheet"; 32 _table.attributes["class"] = "spreadsheet";
33 _table.style.setProperty("position", "absolute"); 33 _table.style.setProperty("position", "absolute");
34 _table.style.setProperty("z-index", "2"); 34 _table.style.setProperty("z-index", "2");
35 _table.style.setProperty("left", "0"); 35 _table.style.setProperty("left", "0");
36 _table.style.setProperty("top", "0"); 36 _table.style.setProperty("top", "0");
37 37
38 parent.nodes.add(_table); 38 parent.nodes.add(_table);
39 } 39 }
40 40
41 void addColumn(int col, int columnWidth) { 41 void addColumn(int col, int columnWidth) {
42 Document doc = _table.document; 42 Document doc = _table.document;
43 bool first = true; 43 bool first = true;
44 for (TableRowElement row in _table.rows) { 44 for (TableRowElement row in _table.rows) {
45 TableCellElement cell; 45 TableCellElement cell;
46 if (first) { 46 if (first) {
47 first = false; 47 first = false;
48 cell = doc.createElement("td"); 48 cell = new Element.tag("td");
49 cell.width = HtmlUtils.toPx(columnWidth); 49 cell.width = HtmlUtils.toPx(columnWidth);
50 row.insertBefore(cell, row.cells[col]); 50 row.insertBefore(cell, row.cells[col]);
51 } else { 51 } else {
52 cell = row.insertCell(col); 52 cell = row.insertCell(col);
53 } 53 }
54 } 54 }
55 } 55 }
56 56
57 void addRow(int row, int columns) { 57 void addRow(int row, int columns) {
58 TableRowElement rowElement = _table.insertRow(row); 58 TableRowElement rowElement = _table.insertRow(row);
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 if (row <= 0 || row > rows) { 413 if (row <= 0 || row > rows) {
414 return false; 414 return false;
415 } 415 }
416 int col = rowCol.col - columnShift; 416 int col = rowCol.col - columnShift;
417 if (col <= 0 || col > columns) { 417 if (col <= 0 || col > columns) {
418 return false; 418 return false;
419 } 419 }
420 return true; 420 return true;
421 } 421 }
422 } 422 }
OLDNEW
« no previous file with comments | « client/samples/total/src/ContextMenuBuilder.dart ('k') | client/samples/total/src/InnerMenuView.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698