| 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 part of app; | 5 part of app; |
| 6 | 6 |
| 7 /// A [Pane] controls the user interface of Observatory. At any given time | 7 /// A [Pane] controls the user interface of Observatory. At any given time |
| 8 /// one pane will be the current pane. Panes are registered at startup. | 8 /// one pane will be the current pane. Panes are registered at startup. |
| 9 /// When the user navigates within the application, each pane is asked if it | 9 /// When the user navigates within the application, each pane is asked if it |
| 10 /// can handle the current location, the first pane to say yes, wins. | 10 /// can handle the current location, the first pane to say yes, wins. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 final _paneRegistry = new List<Pane>(); | 119 final _paneRegistry = new List<Pane>(); |
| 120 ServiceObjectPane _serviceObjectPane; | 120 ServiceObjectPane _serviceObjectPane; |
| 121 Pane _currentPane; | 121 Pane _currentPane; |
| 122 @observable final LocationManager locationManager; | 122 @observable final LocationManager locationManager; |
| 123 @observable final VM vm; | 123 @observable final VM vm; |
| 124 @observable Isolate isolate; | 124 @observable Isolate isolate; |
| 125 @reflectable final ObservatoryApplicationElement rootElement; | 125 @reflectable final ObservatoryApplicationElement rootElement; |
| 126 | 126 |
| 127 @reflectable ServiceObject lastErrorOrException; | 127 @reflectable ServiceObject lastErrorOrException; |
| 128 | 128 |
| 129 /// Any client-level arguments for viewing the current response. | |
| 130 @observable String args; | |
| 131 // TODO(turnidge): Make args a Map. | |
| 132 | |
| 133 void _initOnce() { | 129 void _initOnce() { |
| 134 _registerPanes(); | 130 _registerPanes(); |
| 135 vm.errors.stream.listen(_onError); | 131 vm.errors.stream.listen(_onError); |
| 136 vm.exceptions.stream.listen(_onException); | 132 vm.exceptions.stream.listen(_onException); |
| 137 location = locationManager; | 133 location = locationManager; |
| 138 locationManager._init(this); | 134 locationManager._init(this); |
| 139 } | 135 } |
| 140 | 136 |
| 141 void _registerPanes() { | 137 void _registerPanes() { |
| 142 if (_serviceObjectPane != null) { | 138 if (_serviceObjectPane != null) { |
| 143 // Already done. | 139 // Already done. |
| 144 return; | 140 return; |
| 145 } | 141 } |
| 146 // Register ClassTreePane. | 142 // Register ClassTreePane. |
| 147 _paneRegistry.add(new ClassTreePane(this)); | 143 _paneRegistry.add(new ClassTreePane(this)); |
| 148 _paneRegistry.add(new ErrorViewPane(this)); | 144 _paneRegistry.add(new ErrorViewPane(this)); |
| 149 // Note that ServiceObjectPane must be the last entry in the list as it is | 145 // Note that ServiceObjectPane must be the last entry in the list as it is |
| 150 // the catch all. | 146 // the catch all. |
| 151 _serviceObjectPane = new ServiceObjectPane(this); | 147 _serviceObjectPane = new ServiceObjectPane(this); |
| 152 _paneRegistry.add(_serviceObjectPane); | 148 _paneRegistry.add(_serviceObjectPane); |
| 153 } | 149 } |
| 154 | 150 |
| 155 void _onError(ServiceError error) { | 151 void _onError(ServiceError error) { |
| 156 lastErrorOrException = error; | 152 lastErrorOrException = error; |
| 157 _visit('error/'); | 153 _visit('error/', null); |
| 158 } | 154 } |
| 159 | 155 |
| 160 void _onException(ServiceException exception) { | 156 void _onException(ServiceException exception) { |
| 161 lastErrorOrException = exception; | 157 lastErrorOrException = exception; |
| 162 _visit('error/'); | 158 _visit('error/', null); |
| 163 } | 159 } |
| 164 | 160 |
| 165 void _visit(String url) { | 161 void _visit(String url, String args) { |
| 162 // TODO(johnmccutchan): Pass [args] to pane. |
| 166 for (var i = 0; i < _paneRegistry.length; i++) { | 163 for (var i = 0; i < _paneRegistry.length; i++) { |
| 167 var pane = _paneRegistry[i]; | 164 var pane = _paneRegistry[i]; |
| 168 if (pane.canVisit(url)) { | 165 if (pane.canVisit(url)) { |
| 169 _installPane(pane); | 166 _installPane(pane); |
| 170 pane.visit(url); | 167 pane.visit(url); |
| 171 return; | 168 return; |
| 172 } | 169 } |
| 173 } | 170 } |
| 174 throw new FallThroughError(); | 171 throw new FallThroughError(); |
| 175 } | 172 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 201 } | 198 } |
| 202 | 199 |
| 203 ObservatoryApplication(this.rootElement) : | 200 ObservatoryApplication(this.rootElement) : |
| 204 locationManager = new HashLocationManager(), | 201 locationManager = new HashLocationManager(), |
| 205 vm = new HttpVM() { | 202 vm = new HttpVM() { |
| 206 _initOnce(); | 203 _initOnce(); |
| 207 } | 204 } |
| 208 } | 205 } |
| 209 | 206 |
| 210 LocationManager location; | 207 LocationManager location; |
| OLD | NEW |