| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 view; | 5 library view; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:math' as Math; | 9 import 'dart:math' as Math; |
| 10 | 10 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 void exitDocument() {} | 173 void exitDocument() {} |
| 174 | 174 |
| 175 /** Override this to perform behavior after the window is resized. */ | 175 /** Override this to perform behavior after the window is resized. */ |
| 176 // TODO(jmesserly): this isn't really the event we want. Ideally we want to | 176 // TODO(jmesserly): this isn't really the event we want. Ideally we want to |
| 177 // fire the event only if this particular View changed size. Also we should | 177 // fire the event only if this particular View changed size. Also we should |
| 178 // give a view the ability to measure itself when added to the document. | 178 // give a view the ability to measure itself when added to the document. |
| 179 void windowResized() {} | 179 void windowResized() {} |
| 180 | 180 |
| 181 /** | 181 /** |
| 182 * Registers the given listener callback to the given observable. Also | 182 * Registers the given listener callback to the given observable. Also |
| 183 * immedially invokes the callback once as if a change has just come in. This | 183 * immediately invokes the callback once as if a change has just come in. |
| 184 * lets you define a render() method that renders the skeleton of a view, then | 184 * This lets you define a render() method that renders the skeleton of a |
| 185 * register a bunch of listeners which all fire to populate the view with | 185 * view, then register a bunch of listeners which all fire to populate the |
| 186 * model data. | 186 * view with model data. |
| 187 */ | 187 */ |
| 188 void watch(Observable observable, void watcher(EventSummary summary)) { | 188 void watch(Observable observable, void watcher(EventSummary summary)) { |
| 189 // Make a fake summary for the initial watch. | 189 // Make a fake summary for the initial watch. |
| 190 final summary = new EventSummary(observable); | 190 final summary = new EventSummary(observable); |
| 191 watcher(summary); | 191 watcher(summary); |
| 192 | 192 |
| 193 attachWatch(observable, watcher); | 193 attachWatch(observable, watcher); |
| 194 } | 194 } |
| 195 | 195 |
| 196 /** Registers the given listener callback to the given observable. */ | 196 /** Registers the given listener callback to the given observable. */ |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 } | 374 } |
| 375 | 375 |
| 376 void _applyLayout() { | 376 void _applyLayout() { |
| 377 if (_layout != null) { | 377 if (_layout != null) { |
| 378 _layout.applyLayout(); | 378 _layout.applyLayout(); |
| 379 } | 379 } |
| 380 _applyLayoutToChildren(); | 380 _applyLayoutToChildren(); |
| 381 } | 381 } |
| 382 } | 382 } |
| OLD | NEW |