OLD | NEW |
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:html'; | 7 import 'dart:html'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'package:observatory/models.dart' as M; | 9 import 'package:observatory/models.dart' as M; |
10 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 10 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 ..children = [ | 85 ..children = [ |
86 new FormElement() | 86 new FormElement() |
87 ..autocomplete = 'on' | 87 ..autocomplete = 'on' |
88 ..children = [ | 88 ..children = [ |
89 _multiline ? _createEvalTextArea() : _createEvalTextBox(), | 89 _multiline ? _createEvalTextArea() : _createEvalTextBox(), |
90 new SpanElement() | 90 new SpanElement() |
91 ..classes = ['buttons'] | 91 ..classes = ['buttons'] |
92 ..children = [ | 92 ..children = [ |
93 _createEvalButton(), | 93 _createEvalButton(), |
94 _createMultilineCheckbox(), | 94 _createMultilineCheckbox(), |
95 new SpanElement()..text = 'multi-line' | 95 new SpanElement()..text = 'Multi-line' |
96 ] | 96 ] |
97 ] | 97 ] |
98 ], | 98 ], |
99 new TableElement() | 99 new TableElement() |
100 ..children = _results.reversed | 100 ..children = _results.reversed |
101 .map((result) => new TableRowElement() | 101 .map((result) => new TableRowElement() |
102 ..children = [ | 102 ..children = [ |
103 new TableCellElement() | 103 new TableCellElement() |
104 ..classes = ['historyExpr'] | 104 ..classes = ['historyExpr'] |
105 ..children = [ | 105 ..children = [ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 _run(); | 159 _run(); |
160 }); | 160 }); |
161 textbox.onInput.listen((e) { | 161 textbox.onInput.listen((e) { |
162 _expression = textbox.value; | 162 _expression = textbox.value; |
163 }); | 163 }); |
164 return textbox; | 164 return textbox; |
165 } | 165 } |
166 | 166 |
167 ButtonElement _createEvalButton() { | 167 ButtonElement _createEvalButton() { |
168 final button = new ButtonElement() | 168 final button = new ButtonElement() |
169 ..text = 'evaluate' | 169 ..text = 'Evaluate' |
170 ..onClick.listen((e) { | 170 ..onClick.listen((e) { |
171 e.preventDefault(); | 171 e.preventDefault(); |
172 _run(); | 172 _run(); |
173 }); | 173 }); |
174 return button; | 174 return button; |
175 } | 175 } |
176 | 176 |
177 CheckboxInputElement _createMultilineCheckbox() { | 177 CheckboxInputElement _createMultilineCheckbox() { |
178 final checkbox = new CheckboxInputElement()..checked = _multiline; | 178 final checkbox = new CheckboxInputElement()..checked = _multiline; |
179 checkbox.onClick.listen((e) { | 179 checkbox.onClick.listen((e) { |
(...skipping 19 matching lines...) Expand all Loading... |
199 } | 199 } |
200 | 200 |
201 class _ExpressionDescription { | 201 class _ExpressionDescription { |
202 final String expression; | 202 final String expression; |
203 final M.ObjectRef value; | 203 final M.ObjectRef value; |
204 bool get isPending => value == null; | 204 bool get isPending => value == null; |
205 | 205 |
206 _ExpressionDescription(this.expression, this.value); | 206 _ExpressionDescription(this.expression, this.value); |
207 _ExpressionDescription.pending(this.expression) : value = null; | 207 _ExpressionDescription.pending(this.expression) : value = null; |
208 } | 208 } |
OLD | NEW |