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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/observatory_elements/json_view.dart

Issue 184233007: Refactor Observatory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library json_view_element;
6
7 import 'package:polymer/polymer.dart';
8 import 'observatory_element.dart';
9
10 @CustomTag('json-view')
11 class JsonViewElement extends ObservatoryElement {
12 @published var json = null;
13 var _count = 0;
14
15 JsonViewElement.created() : super.created();
16
17 void enteredView() {
18 super.enteredView();
19 _count = 0;
20 }
21
22 void jsonChanged(oldValue) {
23 notifyPropertyChange(#valueType, "a", "b");
24 }
25
26 String get primitiveString {
27 return json.toString();
28 }
29
30 String get valueType {
31 if (json is Map) {
32 return 'Map';
33 } else if (json is List) {
34 return 'List';
35 }
36 return 'Primitive';
37 }
38
39 int get counter {
40 return _count++;
41 }
42
43 List get list {
44 if (json is List) {
45 return json;
46 }
47 return [];
48 }
49
50 List get keys {
51 if (json is Map) {
52 return json.keys.toList();
53 }
54 return [];
55 }
56
57 dynamic value(String key) {
58 return json[key];
59 }
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698