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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
9 import 'package:observatory/src/elements/helpers/tag.dart'; | 9 import 'package:observatory/src/elements/helpers/tag.dart'; |
10 import 'package:observatory/src/elements/helpers/uris.dart'; | 10 import 'package:observatory/src/elements/helpers/uris.dart'; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if (!_profileVM) { | 216 if (!_profileVM) { |
217 values = const [M.SampleProfileTag.userOnly, M.SampleProfileTag.none]; | 217 values = const [M.SampleProfileTag.userOnly, M.SampleProfileTag.none]; |
218 } | 218 } |
219 var s; | 219 var s; |
220 return [ | 220 return [ |
221 s = new SelectElement() | 221 s = new SelectElement() |
222 ..classes = ['tag-select'] | 222 ..classes = ['tag-select'] |
223 ..value = tagToString(_tag) | 223 ..value = tagToString(_tag) |
224 ..children = values.map((tag) { | 224 ..children = values.map((tag) { |
225 return new OptionElement( | 225 return new OptionElement( |
226 value: tagToString(tag), | 226 value: tagToString(tag), selected: _tag == tag) |
227 selected: _tag == tag)..text = tagToString(tag); | 227 ..text = tagToString(tag); |
228 }).toList(growable: false) | 228 }).toList(growable: false) |
229 ..onChange.listen((_) { | 229 ..onChange.listen((_) { |
230 _tag = values[s.selectedIndex]; | 230 _tag = values[s.selectedIndex]; |
231 }) | 231 }) |
232 ..onChange.map(_toEvent).listen(_triggerModeChange), | 232 ..onChange.map(_toEvent).listen(_triggerModeChange), |
233 ]; | 233 ]; |
234 } | 234 } |
235 | 235 |
236 static String tagToString(M.SampleProfileTag tag) { | 236 static String tagToString(M.SampleProfileTag tag) { |
237 switch (tag) { | 237 switch (tag) { |
(...skipping 10 matching lines...) Expand all Loading... |
248 } | 248 } |
249 throw new Exception('Unknown tagToString'); | 249 throw new Exception('Unknown tagToString'); |
250 } | 250 } |
251 | 251 |
252 SampleBufferControlChangedElement _toEvent(_) { | 252 SampleBufferControlChangedElement _toEvent(_) { |
253 return new SampleBufferControlChangedElement(this); | 253 return new SampleBufferControlChangedElement(this); |
254 } | 254 } |
255 | 255 |
256 void _triggerModeChange(e) => _onTagChange.add(e); | 256 void _triggerModeChange(e) => _onTagChange.add(e); |
257 } | 257 } |
OLD | NEW |