Chromium Code Reviews| 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 part of swarmlib; | 5 part of swarmlib; |
| 6 | 6 |
| 7 // This file contains View framework classes. | 7 // This file contains View framework classes. |
| 8 // As it grows, it may need to be split into multiple files. | 8 // As it grows, it may need to be split into multiple files. |
| 9 | 9 |
| 10 /** A factory that creates a view from a data model. */ | 10 /** A factory that creates a view from a data model. */ |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 style.height = '${height}px'; | 282 style.height = '${height}px'; |
| 283 } | 283 } |
| 284 // TODO(jacobr): this should be specified by the default CSS for a | 284 // TODO(jacobr): this should be specified by the default CSS for a |
| 285 // GenericListView. | 285 // GenericListView. |
| 286 style.overflow = 'hidden'; | 286 style.overflow = 'hidden'; |
| 287 } | 287 } |
| 288 | 288 |
| 289 | 289 |
| 290 void onResize() { | 290 void onResize() { |
| 291 int lastViewLength = _viewLength; | 291 int lastViewLength = _viewLength; |
| 292 window.setImmediate(() { | 292 window.immediate.then((_) { |
| 293 _viewLength = _vertical ? node.offsetHeight : node.offsetWidth; | 293 _viewLength = _vertical ? node.offsetHeight : node.offsetWidth; |
| 294 if (_viewLength != lastViewLength) { | 294 if (_viewLength != lastViewLength) { |
| 295 if (_scrollbar != null) { | 295 if (_scrollbar != null) { |
| 296 _scrollbar.refresh(); | 296 _scrollbar.refresh(); |
| 297 } | 297 } |
| 298 renderVisibleItems(true); | 298 renderVisibleItems(true); |
| 299 } | 299 } |
| 300 }); | 300 }); |
| 301 } | 301 } |
| 302 | 302 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 524 FxUtil.computeRelativePosition(view.node, _containerElem); | 524 FxUtil.computeRelativePosition(view.node, _containerElem); |
| 525 } | 525 } |
| 526 assert (_itemViews[index] is _PlaceholderView); | 526 assert (_itemViews[index] is _PlaceholderView); |
| 527 view.enterDocument(); | 527 view.enterDocument(); |
| 528 _itemViews[index].node.replaceWith(view.node); | 528 _itemViews[index].node.replaceWith(view.node); |
| 529 _itemViews[index] = view; | 529 _itemViews[index] = view; |
| 530 if (animate) { | 530 if (animate) { |
| 531 FxUtil.setTranslate(view.node, currentPosition.x, currentPosition.y, 0); | 531 FxUtil.setTranslate(view.node, currentPosition.x, currentPosition.y, 0); |
| 532 // The view's position is unchanged except now re-parented to | 532 // The view's position is unchanged except now re-parented to |
| 533 // the list view. | 533 // the list view. |
| 534 window.setTimeout(() { _positionSubview(view.node, index); }, 0); | 534 new Timer(const Duration(milliseconds: 0), |
|
floitsch
2013/02/13 10:03:07
Timer.run
Emily Fortuna
2013/02/13 20:19:44
Done.
| |
| 535 () { _positionSubview(view.node, index); }); | |
| 535 } else { | 536 } else { |
| 536 _positionSubview(view.node, index); | 537 _positionSubview(view.node, index); |
| 537 } | 538 } |
| 538 } | 539 } |
| 539 | 540 |
| 540 int findIndex(D targetItem) { | 541 int findIndex(D targetItem) { |
| 541 // TODO(jacobr): move this to a util library or modify this class so that | 542 // TODO(jacobr): move this to a util library or modify this class so that |
| 542 // the data is an List not a Collection. | 543 // the data is an List not a Collection. |
| 543 int i = 0; | 544 int i = 0; |
| 544 for (D item in _data) { | 545 for (D item in _data) { |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 975 | 976 |
| 976 container = node.query('.dialog-body'); | 977 container = node.query('.dialog-body'); |
| 977 container.nodes.add(_content.node); | 978 container.nodes.add(_content.node); |
| 978 | 979 |
| 979 return node; | 980 return node; |
| 980 } | 981 } |
| 981 | 982 |
| 982 /** Override to handle dialog done. */ | 983 /** Override to handle dialog done. */ |
| 983 void onDone() { } | 984 void onDone() { } |
| 984 } | 985 } |
| OLD | NEW |