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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/elements/collapsible_content.dart

Issue 342513004: Visual refresh of allocation profile page (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 collapsible_content_element;
6
7 import 'dart:html';
8 import 'package:polymer/polymer.dart';
9 import 'observatory_element.dart';
10
11 /// An element which conditionally displays its children elements.
12 @CustomTag('collapsible-content')
13 class CollapsibleContentElement extends ObservatoryElement {
14 static const String _openIconClass = 'glyphicon glyphicon-chevron-down';
15 static const String _closeIconClass = 'glyphicon glyphicon-chevron-up';
16
17 @observable String iconClass = _openIconClass;
18 @observable String displayValue = 'none';
19
20 bool _collapsed = true;
21 bool get collapsed => _collapsed;
22 set collapsed(bool r) {
23 _collapsed = r;
24 _refresh();
25 }
26
27 CollapsibleContentElement.created() : super.created();
28
29 void enteredView() {
30 super.enteredView();
31 _refresh();
32 }
33
34 void toggleDisplay(Event e, var detail, Node target) {
35 collapsed = !collapsed;
36 _refresh();
37 }
38
39
40
41 void _refresh() {
42 if (_collapsed) {
43 iconClass = _openIconClass;
44 displayValue = 'none';
45 } else {
46 iconClass = _closeIconClass;
47 displayValue = 'block';
48 }
49 }
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698