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

Unified Diff: runtime/bin/vmservice/client/packages/observatory/src/observatory_elements/collapsible_content.dart

Issue 24844002: Initial GUI for VM service (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/vmservice/client/packages/observatory/src/observatory_elements/collapsible_content.dart
diff --git a/runtime/bin/vmservice/client/packages/observatory/src/observatory_elements/collapsible_content.dart b/runtime/bin/vmservice/client/packages/observatory/src/observatory_elements/collapsible_content.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5422447ff5e8ae0aa936fec356ca625b97a3befe
--- /dev/null
+++ b/runtime/bin/vmservice/client/packages/observatory/src/observatory_elements/collapsible_content.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library collapsible_content_element;
+
+import 'dart:html';
+import 'package:polymer/polymer.dart';
+import 'observatory_element.dart';
+
+/// An element which conditionally displays its children elements.
+@CustomTag('collapsible-content')
+class CollapsibleContentElement extends ObservatoryElement {
+ static const String _openIconClass = 'glyphicon glyphicon-chevron-down';
+ static const String _closeIconClass = 'glyphicon glyphicon-chevron-up';
+
+ @observable String get iconClass => __$iconClass; String __$iconClass = _openIconClass; set iconClass(String value) { __$iconClass = notifyPropertyChange(#iconClass, __$iconClass, value); }
+ @observable String get displayValue => __$displayValue; String __$displayValue = 'none'; set displayValue(String value) { __$displayValue = notifyPropertyChange(#displayValue, __$displayValue, value); }
+
+ bool _collapsed = true;
+ bool get collapsed => _collapsed;
+ set collapsed(bool r) {
+ _collapsed = r;
+ _refresh();
+ }
+
+ void toggleDisplay(Event e, var detail, Node target) {
+ collapsed = !collapsed;
+ _refresh();
+ }
+
+ void inserted() {
+ super.inserted();
+ _refresh();
+ }
+
+ void _refresh() {
+ if (_collapsed) {
+ iconClass = _openIconClass;
+ displayValue = 'none';
+ } else {
+ iconClass = _closeIconClass;
+ displayValue = 'block';
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698