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

Side by Side Diff: runtime/observatory/lib/src/elements/eval_box.dart

Issue 1275173003: Minor Observatory UI tweaks. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library eval_box_element; 5 library eval_box_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'package:polymer/polymer.dart'; 10 import 'package:polymer/polymer.dart';
11 11
12 12
13 typedef Future evalType(String text); 13 typedef Future evalType(String text);
14 14
15 15
16 @CustomTag('eval-box') 16 @CustomTag('eval-box')
17 class EvalBoxElement extends ObservatoryElement { 17 class EvalBoxElement extends ObservatoryElement {
18 @observable String text; 18 @observable String text;
19 @observable String lineMode = "1-line"; 19 @observable String lineMode = "1-line";
20 int _exprCount = 0; 20 int _exprCount = 0;
21 21
22 @published evalType callback; 22 @published evalType callback;
23 @observable ObservableList results = toObservable([]); 23 @observable ObservableList results = toObservable([]);
24 24
25 void updateLineMode(Event e, var detail, Node target) { 25 void updateLineMode(Event e, var detail, Node target) {
26 lineMode = (e.target as InputElement).value; 26 lineMode = (e.target as InputElement).value;
27 if (lineMode == '1-line') { 27 if (lineMode == '1-line' && text != null) {
28 text = text.replaceAll('\n', ' '); 28 text = text.replaceAll('\n', ' ');
29 } 29 }
30 } 30 }
31 31
32 void evaluate(Event e, var detail, Node target) { 32 void evaluate(Event e, var detail, Node target) {
33 // Prevent any form action. 33 // Prevent any form action.
34 e.preventDefault(); 34 e.preventDefault();
35 35
36 // Clear the text box. 36 // Clear the text box.
37 var expr = text; 37 var expr = text;
(...skipping 22 matching lines...) Expand all
60 60
61 void closeItem(MouseEvent e) { 61 void closeItem(MouseEvent e) {
62 assert(e.target is Element); 62 assert(e.target is Element);
63 Element targetElement = e.target; 63 Element targetElement = e.target;
64 var closeId = targetElement.getAttribute('closeId'); 64 var closeId = targetElement.getAttribute('closeId');
65 results.removeWhere((item) => item['id'] == closeId); 65 results.removeWhere((item) => item['id'] == closeId);
66 } 66 }
67 67
68 EvalBoxElement.created() : super.created(); 68 EvalBoxElement.created() : super.created();
69 } 69 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/class_view.html ('k') | runtime/observatory/lib/src/elements/eval_box.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698