| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // This file contains View framework classes. | 5 // This file contains View framework classes. |
| 6 // As it grows, it may need to be split into multiple files. | 6 // As it grows, it may need to be split into multiple files. |
| 7 | 7 |
| 8 /** A factory that creates a view from a data model. */ | 8 /** A factory that creates a view from a data model. */ |
| 9 interface ViewFactory<D> { | 9 interface ViewFactory<D> { |
| 10 View newView(D item); | 10 View newView(D item); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 void onDataChange() { | 267 void onDataChange() { |
| 268 _layout.onDataChange(); | 268 _layout.onDataChange(); |
| 269 _renderItems(); | 269 _renderItems(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void _reserveArea() { | 272 void _reserveArea() { |
| 273 final style = _containerElem.style; | 273 final style = _containerElem.style; |
| 274 int width = _layout.getWidth(_viewLength); | 274 int width = _layout.getWidth(_viewLength); |
| 275 int height = _layout.getHeight(_viewLength); | 275 int height = _layout.getHeight(_viewLength); |
| 276 if (width != null) { | 276 if (width != null) { |
| 277 Css.setWidth(style, '${width}px'); | 277 style.width = '${width}px'; |
| 278 } | 278 } |
| 279 if (height != null) { | 279 if (height != null) { |
| 280 Css.setHeight(style, '${height}px'); | 280 style.height = '${height}px'; |
| 281 } | 281 } |
| 282 // TODO(jacobr): this should be specified by the default CSS for a | 282 // TODO(jacobr): this should be specified by the default CSS for a |
| 283 // GenericListView. | 283 // GenericListView. |
| 284 Css.setOverflow(style, 'hidden'); | 284 style.overflow = 'hidden'; |
| 285 } | 285 } |
| 286 | 286 |
| 287 | 287 |
| 288 void onResize() { | 288 void onResize() { |
| 289 int lastViewLength = _viewLength; | 289 int lastViewLength = _viewLength; |
| 290 calculateViewLength(); | 290 calculateViewLength(); |
| 291 if (_viewLength != lastViewLength) { | 291 if (_viewLength != lastViewLength) { |
| 292 if (_scrollbar != null) { | 292 if (_scrollbar != null) { |
| 293 _scrollbar.refresh(); | 293 _scrollbar.refresh(); |
| 294 } | 294 } |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 } | 553 } |
| 554 return null; | 554 return null; |
| 555 } | 555 } |
| 556 | 556 |
| 557 void _positionSubview(Element node, int index) { | 557 void _positionSubview(Element node, int index) { |
| 558 if (_vertical) { | 558 if (_vertical) { |
| 559 FxUtil.setTranslate(node, 0, _layout.getOffset(index), 0); | 559 FxUtil.setTranslate(node, 0, _layout.getOffset(index), 0); |
| 560 } else { | 560 } else { |
| 561 FxUtil.setTranslate(node, _layout.getOffset(index), 0, 0); | 561 FxUtil.setTranslate(node, _layout.getOffset(index), 0, 0); |
| 562 } | 562 } |
| 563 Css.setZIndex(node.style, index.toString()); | 563 node.style.zIndex = index.toString(); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void _select(int index, bool selected) { | 566 void _select(int index, bool selected) { |
| 567 if (index != null) { | 567 if (index != null) { |
| 568 final subview = getSubview(index); | 568 final subview = getSubview(index); |
| 569 if (subview != null) { | 569 if (subview != null) { |
| 570 _selectHelper(subview, selected); | 570 _selectHelper(subview, selected); |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 } | 573 } |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 | 980 |
| 981 container = node.query('.dialog-body'); | 981 container = node.query('.dialog-body'); |
| 982 container.nodes.add(_content.node); | 982 container.nodes.add(_content.node); |
| 983 | 983 |
| 984 return node; | 984 return node; |
| 985 } | 985 } |
| 986 | 986 |
| 987 /** Override to handle dialog done. */ | 987 /** Override to handle dialog done. */ |
| 988 void onDone() { } | 988 void onDone() { } |
| 989 } | 989 } |
| OLD | NEW |