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

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

Issue 2119733003: Wrapping leaf nodes in non polymer elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted vm-connect Created 4 years, 5 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
(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 nav_bar_element;
6
7 import 'dart:async';
8 import 'dart:html' hide Notification;
9 import 'observatory_element.dart';
10 import 'package:observatory/service.dart';
11 import 'package:observatory/app.dart' show Notification;
12 import 'package:polymer/polymer.dart';
13
14
15 @CustomTag('nav-bar')
16 class NavBarElement extends ObservatoryElement {
17 @published bool notifyOnPause = true;
18 @published bool pad = true;
19
20 // Desired nav var height in pixels.
21 static const height = 40;
22
23 NavBarElement.created() : super.created();
24 }
25
26 @CustomTag('nav-menu')
27 class NavMenuElement extends ObservatoryElement {
28 @published String link = '#';
29 @published String anchor = '---';
30 @published bool last = false;
31
32 NavMenuElement.created() : super.created();
33 }
34
35 @CustomTag('nav-menu-item')
36 class NavMenuItemElement extends ObservatoryElement {
37 @published String link = '#';
38 @published String anchor = '---';
39
40 NavMenuItemElement.created() : super.created();
41 }
42
43 typedef Future RefreshCallback();
44
45 @CustomTag('nav-refresh')
46 class NavRefreshElement extends ObservatoryElement {
47 @published RefreshCallback callback;
48 @published bool active = false;
49 @published String label = 'Refresh';
50
51 NavRefreshElement.created() : super.created();
52
53 void buttonClick(Event e, var detail, Node target) {
54 if (active) {
55 return;
56 }
57 active = true;
58 if (callback != null) {
59 callback()
60 .catchError(app.handleException)
61 .whenComplete(refreshDone);
62 }
63 }
64
65 void refreshDone() {
66 active = false;
67 }
68 }
69
70 @CustomTag('top-nav-menu')
71 class TopNavMenuElement extends ObservatoryElement {
72 @published bool last = false;
73
74 TopNavMenuElement.created() : super.created();
75 }
76
77 @CustomTag('vm-nav-menu')
78 class VMNavMenuElement extends ObservatoryElement {
79 @published bool last = false;
80 @published VM vm;
81
82 String nameAndAddress(name, target) {
83 if (name != null && target != null) {
84 return '${name}@${target.networkAddress}';
85 } else {
86 return '<initializing>';
87 }
88 }
89
90 VMNavMenuElement.created() : super.created();
91 }
92
93 @CustomTag('isolate-nav-menu')
94 class IsolateNavMenuElement extends ObservatoryElement {
95 @published bool last = false;
96 @published Isolate isolate;
97
98 IsolateNavMenuElement.created() : super.created();
99 }
100
101 @CustomTag('library-nav-menu')
102 class LibraryNavMenuElement extends ObservatoryElement {
103 @published Library library;
104 @published bool last = false;
105
106 LibraryNavMenuElement.created() : super.created();
107 }
108
109 @CustomTag('class-nav-menu')
110 class ClassNavMenuElement extends ObservatoryElement {
111 @published Class cls;
112 @published bool last = false;
113
114 ClassNavMenuElement.created() : super.created();
115 }
116
117 @CustomTag('nav-notify')
118 class NavNotifyElement extends ObservatoryElement {
119 @published ObservableList<Notification> notifications;
120 @published bool notifyOnPause = true;
121
122 NavNotifyElement.created() : super.created();
123 }
124
125 @CustomTag('nav-notify-event')
126 class NavNotifyEventElement extends ObservatoryElement {
127 @published ObservableList<Notification> notifications;
128 @published Notification notification;
129 @published ServiceEvent event;
130 @published bool notifyOnPause = true;
131
132 void closeItem(MouseEvent e, var detail, Element target) {
133 notifications.remove(notification);
134 }
135
136 NavNotifyEventElement.created() : super.created();
137 }
138
139 @CustomTag('nav-notify-exception')
140 class NavNotifyExceptionElement extends ObservatoryElement {
141 @published ObservableList<Notification> notifications;
142 @published Notification notification;
143 @published var exception;
144 @published var stacktrace;
145
146 exceptionChanged() {
147 notifyPropertyChange(#isNetworkError, true, false);
148 notifyPropertyChange(#isUnexpectedError, true, false);
149 }
150
151 @observable get isNetworkError {
152 return (exception is NetworkRpcException);
153 }
154
155 @observable get isUnexpectedError {
156 return (exception is! NetworkRpcException);
157 }
158
159 void closeItem(MouseEvent e, var detail, Element target) {
160 notifications.remove(notification);
161 }
162
163 NavNotifyExceptionElement.created() : super.created();
164 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/vm_menu_wrapper.dart ('k') | runtime/observatory/lib/src/elements/nav_bar.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698