| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 library nav_bar_element; | 5 library nav_bar_element; |
| 6 | 6 |
| 7 import 'dart:html' hide Notification; | |
| 8 import 'observatory_element.dart'; | 7 import 'observatory_element.dart'; |
| 9 import 'package:observatory/service.dart'; | 8 import 'package:observatory/service.dart'; |
| 10 import 'package:observatory/app.dart' show Notification; | |
| 11 import 'package:polymer/polymer.dart'; | 9 import 'package:polymer/polymer.dart'; |
| 12 | 10 |
| 13 | 11 |
| 14 @CustomTag('nav-bar') | 12 @CustomTag('nav-bar') |
| 15 class NavBarElement extends ObservatoryElement { | 13 class NavBarElement extends ObservatoryElement { |
| 16 @published bool notifyOnPause = true; | 14 @published bool notifyOnPause = true; |
| 17 @published bool pad = true; | 15 @published bool pad = true; |
| 18 | 16 |
| 19 // Desired nav var height in pixels. | 17 // Desired nav var height in pixels. |
| 20 static const height = 40; | 18 static const height = 40; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 LibraryNavMenuElement.created() : super.created(); | 59 LibraryNavMenuElement.created() : super.created(); |
| 62 } | 60 } |
| 63 | 61 |
| 64 @CustomTag('class-nav-menu') | 62 @CustomTag('class-nav-menu') |
| 65 class ClassNavMenuElement extends ObservatoryElement { | 63 class ClassNavMenuElement extends ObservatoryElement { |
| 66 @published Class cls; | 64 @published Class cls; |
| 67 @published bool last = false; | 65 @published bool last = false; |
| 68 | 66 |
| 69 ClassNavMenuElement.created() : super.created(); | 67 ClassNavMenuElement.created() : super.created(); |
| 70 } | 68 } |
| 71 | |
| 72 @CustomTag('nav-notify') | |
| 73 class NavNotifyElement extends ObservatoryElement { | |
| 74 @published ObservableList<Notification> notifications; | |
| 75 @published bool notifyOnPause = true; | |
| 76 | |
| 77 NavNotifyElement.created() : super.created(); | |
| 78 } | |
| 79 | |
| 80 @CustomTag('nav-notify-event') | |
| 81 class NavNotifyEventElement extends ObservatoryElement { | |
| 82 @published ObservableList<Notification> notifications; | |
| 83 @published Notification notification; | |
| 84 @published ServiceEvent event; | |
| 85 @published bool notifyOnPause = true; | |
| 86 | |
| 87 void closeItem(MouseEvent e, var detail, Element target) { | |
| 88 notifications.remove(notification); | |
| 89 } | |
| 90 | |
| 91 NavNotifyEventElement.created() : super.created(); | |
| 92 } | |
| 93 | |
| 94 @CustomTag('nav-notify-exception') | |
| 95 class NavNotifyExceptionElement extends ObservatoryElement { | |
| 96 @published ObservableList<Notification> notifications; | |
| 97 @published Notification notification; | |
| 98 @published var exception; | |
| 99 @published var stacktrace; | |
| 100 | |
| 101 exceptionChanged() { | |
| 102 notifyPropertyChange(#isNetworkError, true, false); | |
| 103 notifyPropertyChange(#isUnexpectedError, true, false); | |
| 104 } | |
| 105 | |
| 106 @observable get isNetworkError { | |
| 107 return (exception is NetworkRpcException); | |
| 108 } | |
| 109 | |
| 110 @observable get isUnexpectedError { | |
| 111 return (exception is! NetworkRpcException); | |
| 112 } | |
| 113 | |
| 114 void closeItem(MouseEvent e, var detail, Element target) { | |
| 115 notifications.remove(notification); | |
| 116 } | |
| 117 | |
| 118 NavNotifyExceptionElement.created() : super.created(); | |
| 119 } | |
| OLD | NEW |