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

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

Issue 2212253002: Converted Observatory class-tree element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Removed tmp code Created 4 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 'dart:math' as Math;
7 import 'package:observatory/src/elements/containers/virtual_collection.dart'; 8 import 'package:observatory/src/elements/containers/virtual_collection.dart';
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; 9 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
9 import 'package:observatory/src/elements/helpers/tag.dart'; 10 import 'package:observatory/src/elements/helpers/tag.dart';
10 11
11 typedef HtmlElement VirtualTreeCreateCallback( 12 typedef HtmlElement VirtualTreeCreateCallback(
12 toggle({bool autoToggleSingleChildNodes, bool autoToggleWholeTree})); 13 toggle({bool autoToggleSingleChildNodes, bool autoToggleWholeTree}));
13 typedef void VirtualTreeUpdateCallback(HtmlElement el, dynamic item, int depth); 14 typedef void VirtualTreeUpdateCallback(HtmlElement el, dynamic item, int depth);
14 typedef Iterable<dynamic> VritualTreeGetChildrenCallback(dynamic value); 15 typedef Iterable<dynamic> VritualTreeGetChildrenCallback(dynamic value);
15 16
17 void virtualTreeUpdateLines(SpanElement element, int n) {
18 n = Math.max(0, n);
19 while (element.children.length > n) {
20 element.children.removeLast();
21 }
22 while (element.children.length < n) {
23 element.children.add(new SpanElement());
24 }
25 }
26
16 class VirtualTreeElement extends HtmlElement implements Renderable { 27 class VirtualTreeElement extends HtmlElement implements Renderable {
17 static const tag = 28 static const tag =
18 const Tag<VirtualTreeElement>('virtual-tree', dependencies: const [ 29 const Tag<VirtualTreeElement>('virtual-tree', dependencies: const [
19 VirtualCollectionElement.tag 30 VirtualCollectionElement.tag
20 ]); 31 ]);
21 32
22 RenderingScheduler<VirtualTreeElement> _r; 33 RenderingScheduler<VirtualTreeElement> _r;
23 34
24 Stream<RenderedEvent<VirtualTreeElement>> get onRendered => _r.onRendered; 35 Stream<RenderedEvent<VirtualTreeElement>> get onRendered => _r.onRendered;
25 36
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 depth++; 151 depth++;
141 return children.expand(_toDepth).toList() 152 return children.expand(_toDepth).toList()
142 ..insert(0, --depth); 153 ..insert(0, --depth);
143 } 154 }
144 } 155 }
145 return [depth]; 156 return [depth];
146 } 157 }
147 _depths = _items.expand(_toDepth).toList(); 158 _depths = _items.expand(_toDepth).toList();
148 } 159 }
149 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698