| 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 // TODO(jacobr): there is a lot of dead code in this class. Checking is as is | 5 // TODO(jacobr): there is a lot of dead code in this class. Checking is as is |
| 6 // and then doing a large pass to remove functionality that doesn't make sense | 6 // and then doing a large pass to remove functionality that doesn't make sense |
| 7 // given the UI layout. | 7 // given the UI layout. |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Front page of Swarm. | 10 * Front page of Swarm. |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 : super('section-view'), | 902 : super('section-view'), |
| 903 loadingText = new View.html('<div class="loading-section"></div>'), | 903 loadingText = new View.html('<div class="loading-section"></div>'), |
| 904 pageState = new PageState() { | 904 pageState = new PageState() { |
| 905 addChild(loadingText); | 905 addChild(loadingText); |
| 906 } | 906 } |
| 907 | 907 |
| 908 /** | 908 /** |
| 909 * Hides the loading text, reloads the data sources, and shows them. | 909 * Hides the loading text, reloads the data sources, and shows them. |
| 910 */ | 910 */ |
| 911 void showSources() { | 911 void showSources() { |
| 912 Css.setDisplay(loadingText.node.style, 'none'); | 912 loadingText.node.style.display = 'none'; |
| 913 | 913 |
| 914 // Lazy initialize the data source view. | 914 // Lazy initialize the data source view. |
| 915 if (dataSourceView == null) { | 915 if (dataSourceView == null) { |
| 916 // TODO(jacobr): use named arguments when available. | 916 // TODO(jacobr): use named arguments when available. |
| 917 dataSourceView = new ListView<Feed>( | 917 dataSourceView = new ListView<Feed>( |
| 918 section.feeds, _viewFactory, | 918 section.feeds, _viewFactory, |
| 919 true /* scrollable */, | 919 true /* scrollable */, |
| 920 false /* vertical */, | 920 false /* vertical */, |
| 921 null /* selectedItem */, | 921 null /* selectedItem */, |
| 922 true /* snapToItems */, | 922 true /* snapToItems */, |
| 923 true /* paginate */, | 923 true /* paginate */, |
| 924 true /* removeClippedViews */, | 924 true /* removeClippedViews */, |
| 925 false, /* showScrollbar */ | 925 false, /* showScrollbar */ |
| 926 pageState); | 926 pageState); |
| 927 dataSourceView.addClass("data-source-view"); | 927 dataSourceView.addClass("data-source-view"); |
| 928 addChild(dataSourceView); | 928 addChild(dataSourceView); |
| 929 | 929 |
| 930 pageNumberView = addChild(new PageNumberView(pageState)); | 930 pageNumberView = addChild(new PageNumberView(pageState)); |
| 931 | 931 |
| 932 Css.setOpacity(node.style, '1'); | 932 node.style.opacity = '1'; |
| 933 } else { | 933 } else { |
| 934 addChild(dataSourceView); | 934 addChild(dataSourceView); |
| 935 addChild(pageNumberView); | 935 addChild(pageNumberView); |
| 936 Css.setOpacity(node.style, '1'); | 936 node.style.opacity = '1'; |
| 937 } | 937 } |
| 938 | 938 |
| 939 // TODO(jacobr): get rid of this call to reconfigure when it is not needed. | 939 // TODO(jacobr): get rid of this call to reconfigure when it is not needed. |
| 940 dataSourceView.scroller.reconfigure(); | 940 dataSourceView.scroller.reconfigure(); |
| 941 } | 941 } |
| 942 | 942 |
| 943 /** | 943 /** |
| 944 * Hides the data sources and shows the loading text. | 944 * Hides the data sources and shows the loading text. |
| 945 */ | 945 */ |
| 946 void hideSources() { | 946 void hideSources() { |
| 947 if (dataSourceView != null) { | 947 if (dataSourceView != null) { |
| 948 Css.setOpacity(node.style, '0.6'); | 948 node.style.opacity = '0.6'; |
| 949 removeChild(dataSourceView); | 949 removeChild(dataSourceView); |
| 950 removeChild(pageNumberView); | 950 removeChild(pageNumberView); |
| 951 } | 951 } |
| 952 | 952 |
| 953 Css.setDisplay(loadingText.node.style, 'block'); | 953 loadingText.node.style.display = 'block'; |
| 954 } | 954 } |
| 955 | 955 |
| 956 set storyMode(bool inStoryMode) { | 956 set storyMode(bool inStoryMode) { |
| 957 if (inStoryMode) { | 957 if (inStoryMode) { |
| 958 addClass('hide-all-queries'); | 958 addClass('hide-all-queries'); |
| 959 } else { | 959 } else { |
| 960 removeClass('hide-all-queries'); | 960 removeClass('hide-all-queries'); |
| 961 } | 961 } |
| 962 } | 962 } |
| 963 | 963 |
| 964 /** | 964 /** |
| 965 * Find the [DataSourceView] in this SectionView that's displaying the given | 965 * Find the [DataSourceView] in this SectionView that's displaying the given |
| 966 * [Feed]. | 966 * [Feed]. |
| 967 */ | 967 */ |
| 968 DataSourceView findView(Feed dataSource) { | 968 DataSourceView findView(Feed dataSource) { |
| 969 return dataSourceView.getSubview(dataSourceView.findIndex(dataSource)); | 969 return dataSourceView.getSubview(dataSourceView.findIndex(dataSource)); |
| 970 } | 970 } |
| 971 | 971 |
| 972 bool inCurrentView(Article article) { | 972 bool inCurrentView(Article article) { |
| 973 return dataSourceView.findIndex(article.dataSource) != null; | 973 return dataSourceView.findIndex(article.dataSource) != null; |
| 974 } | 974 } |
| 975 } | 975 } |
| OLD | NEW |