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

Side by Side Diff: client/samples/total/src/ContextMenuBuilder.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
« no previous file with comments | « client/samples/total/src/ContextMenu.dart ('k') | client/samples/total/src/HtmlTable.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * Helper class to build the Total context menu. 6 * Helper class to build the Total context menu.
7 */ 7 */
8 class ContextMenuBuilder { 8 class ContextMenuBuilder {
9 9
10 ContextMenu _contextMenu; 10 ContextMenu _contextMenu;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 _contextMenu.addMenuItem("Reset Row/Column Sizes", idx++, 163 _contextMenu.addMenuItem("Reset Row/Column Sizes", idx++,
164 bool _() => true, 164 bool _() => true,
165 void _(Element elmt, int value) { 165 void _(Element elmt, int value) {
166 execute(new ResetRowColumnSizesCommand(_spreadsheet)); 166 execute(new ResetRowColumnSizesCommand(_spreadsheet));
167 _spreadsheet.refresh(); 167 _spreadsheet.refresh();
168 }); 168 });
169 169
170 Window window = _presenter.window; 170 Window window = _presenter.window;
171 Document doc = window.document; 171 Document doc = window.document;
172 172
173 CanvasElement graphCanvas = doc.createElement("canvas"); 173 CanvasElement graphCanvas = new Element.tag("canvas");
174 graphCanvas.id = "graphCanvas-${_spreadsheet.name}"; 174 graphCanvas.id = "graphCanvas-${_spreadsheet.name}";
175 graphCanvas.attributes["class"] = "graphCanvas"; 175 graphCanvas.attributes["class"] = "graphCanvas";
176 graphCanvas.classes.add("graphCanvas"); 176 graphCanvas.classes.add("graphCanvas");
177 graphCanvas.classes.add("fadeOut"); 177 graphCanvas.classes.add("fadeOut");
178 graphCanvas.width = 600; 178 graphCanvas.width = 600;
179 graphCanvas.height = 400; 179 graphCanvas.height = 400;
180 graphCanvas.on.click.add((Event e) { 180 graphCanvas.on.click.add((Event e) {
181 graphCanvas.classes.remove("fadeIn"); 181 graphCanvas.classes.remove("fadeIn");
182 graphCanvas.classes.add("fadeOut"); 182 graphCanvas.classes.add("fadeOut");
183 }); 183 });
184 _contextMenu.parent.nodes.add(graphCanvas); 184 _contextMenu.parent.nodes.add(graphCanvas);
185 185
186 DivElement chartDiv = doc.createElement("div"); 186 DivElement chartDiv = new Element.tag("div");
187 chartDiv.id = "chartDiv-{$_spreadsheet.name}"; 187 chartDiv.id = "chartDiv-{$_spreadsheet.name}";
188 chartDiv.attributes["class"] = "chartDiv"; 188 chartDiv.attributes["class"] = "chartDiv";
189 chartDiv.classes.add("chartDiv"); 189 chartDiv.classes.add("chartDiv");
190 chartDiv.classes.add("fadeOut"); 190 chartDiv.classes.add("fadeOut");
191 chartDiv.style.setProperty("width", HtmlUtils.toPx(600)); 191 chartDiv.style.setProperty("width", HtmlUtils.toPx(600));
192 chartDiv.on.click.add((Event e) { 192 chartDiv.on.click.add((Event e) {
193 chartDiv.classes.remove("fadeIn"); 193 chartDiv.classes.remove("fadeIn");
194 chartDiv.classes.add("fadeOut"); 194 chartDiv.classes.add("fadeOut");
195 }); 195 });
196 ImageElement image = doc.createElement("img"); 196 ImageElement image = new Element.tag("img");
197 chartDiv.nodes.add(image); 197 chartDiv.nodes.add(image);
198 198
199 SelectElement chartType = doc.createElement("select"); 199 SelectElement chartType = new Element.tag("select");
200 List<String> values = <String>[ "Line", "Pie", "3D Pie", "Concentric Pie", " Grouped Bar", 200 List<String> values = <String>[ "Line", "Pie", "3D Pie", "Concentric Pie", " Grouped Bar",
201 "Stacked Bar", "Overlapped Bar" ]; 201 "Stacked Bar", "Overlapped Bar" ];
202 StringBuffer sb = new StringBuffer(); 202 StringBuffer sb = new StringBuffer();
203 values.forEach((String value) { 203 values.forEach((String value) {
204 sb.add("<option>"); 204 sb.add("<option>");
205 sb.add(value); 205 sb.add(value);
206 sb.add("</option>"); 206 sb.add("</option>");
207 }); 207 });
208 chartType.innerHTML = sb.toString(); 208 chartType.innerHTML = sb.toString();
209 chartType.on.change.add((Event e) { 209 chartType.on.change.add((Event e) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 266 }
267 267
268 void execute(Command command) { 268 void execute(Command command) {
269 _spreadsheet.execute(command); 269 _spreadsheet.execute(command);
270 } 270 }
271 271
272 bool hasMultiCellSelection() => !_selectionManager.isSingleCellSelection(); 272 bool hasMultiCellSelection() => !_selectionManager.isSingleCellSelection();
273 273
274 bool hasSelection() => !_selectionManager.isSelectionEmpty(); 274 bool hasSelection() => !_selectionManager.isSelectionEmpty();
275 } 275 }
OLDNEW
« no previous file with comments | « client/samples/total/src/ContextMenu.dart ('k') | client/samples/total/src/HtmlTable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698