| 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 objectstore_view_element; | 5 library objectstore_view_element; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 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 23 matching lines...) Expand all Loading... |
| 34 RenderingScheduler<ObjectStoreViewElement> _r; | 34 RenderingScheduler<ObjectStoreViewElement> _r; |
| 35 | 35 |
| 36 Stream<RenderedEvent<ObjectStoreViewElement>> get onRendered => _r.onRendered; | 36 Stream<RenderedEvent<ObjectStoreViewElement>> get onRendered => _r.onRendered; |
| 37 | 37 |
| 38 M.VM _vm; | 38 M.VM _vm; |
| 39 M.IsolateRef _isolate; | 39 M.IsolateRef _isolate; |
| 40 M.EventRepository _events; | 40 M.EventRepository _events; |
| 41 M.NotificationRepository _notifications; | 41 M.NotificationRepository _notifications; |
| 42 M.ObjectStore _store; | 42 M.ObjectStore _store; |
| 43 M.ObjectStoreRepository _stores; | 43 M.ObjectStoreRepository _stores; |
| 44 M.InstanceRepository _instances; | 44 M.ObjectRepository _objects; |
| 45 | 45 |
| 46 M.VMRef get vm => _vm; | 46 M.VMRef get vm => _vm; |
| 47 M.IsolateRef get isolate => _isolate; | 47 M.IsolateRef get isolate => _isolate; |
| 48 M.NotificationRepository get notifications => _notifications; | 48 M.NotificationRepository get notifications => _notifications; |
| 49 | 49 |
| 50 factory ObjectStoreViewElement( | 50 factory ObjectStoreViewElement( |
| 51 M.VM vm, | 51 M.VM vm, |
| 52 M.IsolateRef isolate, | 52 M.IsolateRef isolate, |
| 53 M.EventRepository events, | 53 M.EventRepository events, |
| 54 M.NotificationRepository notifications, | 54 M.NotificationRepository notifications, |
| 55 M.ObjectStoreRepository stores, | 55 M.ObjectStoreRepository stores, |
| 56 M.InstanceRepository instances, | 56 M.ObjectRepository objects, |
| 57 {RenderingQueue queue}) { | 57 {RenderingQueue queue}) { |
| 58 assert(vm != null); | 58 assert(vm != null); |
| 59 assert(isolate != null); | 59 assert(isolate != null); |
| 60 assert(events != null); | 60 assert(events != null); |
| 61 assert(notifications != null); | 61 assert(notifications != null); |
| 62 assert(stores != null); | 62 assert(stores != null); |
| 63 assert(instances != null); | 63 assert(objects != null); |
| 64 ObjectStoreViewElement e = document.createElement(tag.name); | 64 ObjectStoreViewElement e = document.createElement(tag.name); |
| 65 e._r = new RenderingScheduler(e, queue: queue); | 65 e._r = new RenderingScheduler(e, queue: queue); |
| 66 e._vm = vm; | 66 e._vm = vm; |
| 67 e._isolate = isolate; | 67 e._isolate = isolate; |
| 68 e._events = events; | 68 e._events = events; |
| 69 e._notifications = notifications; | 69 e._notifications = notifications; |
| 70 e._stores = stores; | 70 e._stores = stores; |
| 71 e._instances = instances; | 71 e._objects = objects; |
| 72 return e; | 72 return e; |
| 73 } | 73 } |
| 74 | 74 |
| 75 ObjectStoreViewElement.created() : super.created(); | 75 ObjectStoreViewElement.created() : super.created(); |
| 76 | 76 |
| 77 @override | 77 @override |
| 78 attached() { | 78 attached() { |
| 79 super.attached(); | 79 super.attached(); |
| 80 _r.enable(); | 80 _r.enable(); |
| 81 _refresh(); | 81 _refresh(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 ..children = fields | 114 ..children = fields |
| 115 .map((field) => new DivElement() | 115 .map((field) => new DivElement() |
| 116 ..classes = ['memberItem'] | 116 ..classes = ['memberItem'] |
| 117 ..children = [ | 117 ..children = [ |
| 118 new DivElement() | 118 new DivElement() |
| 119 ..classes = ['memberName'] | 119 ..classes = ['memberName'] |
| 120 ..text = field.name, | 120 ..text = field.name, |
| 121 new DivElement() | 121 new DivElement() |
| 122 ..classes = ['memberValue'] | 122 ..classes = ['memberValue'] |
| 123 ..children = [ | 123 ..children = [ |
| 124 anyRef(_isolate, field.value, _instances, | 124 anyRef(_isolate, field.value, _objects, |
| 125 queue: _r.queue) | 125 queue: _r.queue) |
| 126 ] | 126 ] |
| 127 ]) | 127 ]) |
| 128 .toList()), | 128 .toList()), |
| 129 new ViewFooterElement(queue: _r.queue) | 129 new ViewFooterElement(queue: _r.queue) |
| 130 ] | 130 ] |
| 131 ]; | 131 ]; |
| 132 } | 132 } |
| 133 | 133 |
| 134 Future _refresh() async { | 134 Future _refresh() async { |
| 135 _store = null; | 135 _store = null; |
| 136 _r.dirty(); | 136 _r.dirty(); |
| 137 _store = await _stores.get(_isolate); | 137 _store = await _stores.get(_isolate); |
| 138 _r.dirty(); | 138 _r.dirty(); |
| 139 } | 139 } |
| 140 } | 140 } |
| OLD | NEW |