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

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

Issue 837723004: Build Observatory as part of runtime (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 nav_bar_element;
6
7 import 'dart:async';
8 import 'dart:html';
9 import 'observatory_element.dart';
10 import 'package:observatory/service.dart';
11 import 'package:polymer/polymer.dart';
12
13
14 @CustomTag('nav-bar')
15 class NavBarElement extends ObservatoryElement {
16 @published bool pad = true;
17
18 NavBarElement.created() : super.created();
19 }
20
21 @CustomTag('nav-menu')
22 class NavMenuElement extends ObservatoryElement {
23 @published String link = '#';
24 @published String anchor = '---';
25 @published bool last = false;
26
27 NavMenuElement.created() : super.created();
28 }
29
30 @CustomTag('nav-menu-item')
31 class NavMenuItemElement extends ObservatoryElement {
32 @published String link = '#';
33 @published String anchor = '---';
34
35 NavMenuItemElement.created() : super.created();
36 }
37
38 @CustomTag('nav-refresh')
39 class NavRefreshElement extends ObservatoryElement {
40 @published var callback;
41 @published bool active = false;
42 @published String label = 'Refresh';
43
44 NavRefreshElement.created() : super.created();
45
46 void buttonClick(Event e, var detail, Node target) {
47 if (active) {
48 return;
49 }
50 active = true;
51 if (callback != null) {
52 callback(refreshDone);
53 }
54 }
55
56 void refreshDone() {
57 active = false;
58 }
59 }
60
61 @CustomTag('nav-control')
62 class NavControlElement extends ObservatoryElement {
63 NavControlElement.created() : super.created();
64
65 void forward(Event e, var detail, Element target) {
66 app.locationManager.forward();
67 }
68
69 void back(Event e, var detail, Element target) {
70 app.locationManager.back();
71 }
72 }
73
74 @CustomTag('top-nav-menu')
75 class TopNavMenuElement extends ObservatoryElement {
76 @published bool last = false;
77
78 TopNavMenuElement.created() : super.created();
79 }
80
81 @CustomTag('isolate-nav-menu')
82 class IsolateNavMenuElement extends ObservatoryElement {
83 @published bool last = false;
84 @published Isolate isolate;
85
86 void isolateChanged(oldValue) {
87 notifyPropertyChange(#hashLinkWorkaround, 0, 1);
88 }
89
90 // TODO(turnidge): Figure out why polymer needs this function.
91 @reflectable
92 String get hashLinkWorkaround {
93 if (isolate != null) {
94 return isolate.link;
95 } else {
96 return '';
97 }
98 }
99 @reflectable set hashLinkWorkaround(var x) { /* silence polymer */ }
100
101 IsolateNavMenuElement.created() : super.created();
102 }
103
104 @CustomTag('library-nav-menu')
105 class LibraryNavMenuElement extends ObservatoryElement {
106 @published Library library;
107 @published bool last = false;
108
109 LibraryNavMenuElement.created() : super.created();
110 }
111
112 @CustomTag('class-nav-menu')
113 class ClassNavMenuElement extends ObservatoryElement {
114 @published Class cls;
115 @published bool last = false;
116
117 ClassNavMenuElement.created() : super.created();
118 }
119
120 @CustomTag('nav-notify')
121 class NavNotifyElement extends ObservatoryElement {
122 @published ObservableList<ServiceEvent> events;
123
124 NavNotifyElement.created() : super.created();
125 }
126
127 @CustomTag('nav-notify-item')
128 class NavNotifyItemElement extends ObservatoryElement {
129 @published ObservableList<ServiceEvent> events;
130 @published ServiceEvent event;
131
132 Future resume(_) {
133 app.removePauseEvents(event.isolate);
134 return event.isolate.resume();
135 }
136 Future stepInto(_) {
137 app.removePauseEvents(event.isolate);
138 return event.isolate.stepInto();
139 }
140 Future stepOver(_) {
141 app.removePauseEvents(event.isolate);
142 return event.isolate.stepOver();
143 }
144 Future stepOut(_) {
145 app.removePauseEvents(event.isolate);
146 return event.isolate.stepOut();
147 }
148
149 void closeItem(MouseEvent e, var detail, Element target) {
150 events.remove(event);
151 }
152
153 NavNotifyItemElement.created() : super.created();
154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698