| 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 /** | 5 /** |
| 6 * The top-level class for the UI state. UI state is essentially a "model" from | 6 * The top-level class for the UI state. UI state is essentially a "model" from |
| 7 * the view's perspective but whose data just describes the UI itself. It | 7 * the view's perspective but whose data just describes the UI itself. It |
| 8 * contains data like the currently selected story, etc. | 8 * contains data like the currently selected story, etc. |
| 9 */ | 9 */ |
| 10 // TODO(jimhug): Split the two classes here into framework and app-specific. | 10 // TODO(jimhug): Split the two classes here into framework and app-specific. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 /** | 252 /** |
| 253 * Set the selectedArticle as the first item in that section (UI page). | 253 * Set the selectedArticle as the first item in that section (UI page). |
| 254 */ | 254 */ |
| 255 void goToFirstArticleInSection() { | 255 void goToFirstArticleInSection() { |
| 256 selectedArticle.value = _articleIterator.current; | 256 selectedArticle.value = _articleIterator.current; |
| 257 } | 257 } |
| 258 | 258 |
| 259 /** | 259 /** |
| 260 * Returns true if the UI is currently in the Story View state. | 260 * Returns true if the UI is currently in the Story View state. |
| 261 */ | 261 */ |
| 262 bool get inMainView() => currentArticle.value == null; | 262 bool get inMainView => currentArticle.value == null; |
| 263 | 263 |
| 264 /** | 264 /** |
| 265 * Returns true if we currently have an Article selected (for keyboard | 265 * Returns true if we currently have an Article selected (for keyboard |
| 266 * shortcuts browsing). | 266 * shortcuts browsing). |
| 267 */ | 267 */ |
| 268 bool get hasArticleSelected() => selectedArticle.value != null; | 268 bool get hasArticleSelected => selectedArticle.value != null; |
| 269 | 269 |
| 270 /** | 270 /** |
| 271 * Mark the current article as read | 271 * Mark the current article as read |
| 272 */ | 272 */ |
| 273 bool markCurrentAsRead() { | 273 bool markCurrentAsRead() { |
| 274 currentArticle.value.unread.value = false; | 274 currentArticle.value.unread.value = false; |
| 275 } | 275 } |
| 276 | 276 |
| 277 /** | 277 /** |
| 278 * The user has moved to a new section (page). This can occur either | 278 * The user has moved to a new section (page). This can occur either |
| 279 * if the user clicked on a section page, or used keyboard shortcuts. | 279 * if the user clicked on a section page, or used keyboard shortcuts. |
| 280 * The default behavior is to move to the first article in the first | 280 * The default behavior is to move to the first article in the first |
| 281 * column. The location of the selected item depends on the previous | 281 * column. The location of the selected item depends on the previous |
| 282 * selected item location if the user used keyboard shortcuts. These | 282 * selected item location if the user used keyboard shortcuts. These |
| 283 * are manipulated in goToPrevious/NextSection(). | 283 * are manipulated in goToPrevious/NextSection(). |
| 284 */ | 284 */ |
| 285 void moveToNewSection(String sectionTitle) { | 285 void moveToNewSection(String sectionTitle) { |
| 286 _sectionIterator.currentIndex.value = | 286 _sectionIterator.currentIndex.value = |
| 287 _dataModel.findSectionIndex(sectionTitle); | 287 _dataModel.findSectionIndex(sectionTitle); |
| 288 _feedIterator = new BiIterator<Feed>(_sectionIterator.current.feeds, | 288 _feedIterator = new BiIterator<Feed>(_sectionIterator.current.feeds, |
| 289 _feedIterator.currentIndex.listeners); | 289 _feedIterator.currentIndex.listeners); |
| 290 _articleIterator = | 290 _articleIterator = |
| 291 new BiIterator<Article>(_feedIterator.current.articles, | 291 new BiIterator<Article>(_feedIterator.current.articles, |
| 292 _articleIterator.currentIndex.listeners); | 292 _articleIterator.currentIndex.listeners); |
| 293 } | 293 } |
| 294 | 294 |
| 295 Section get currentSection() => _sectionIterator.current; | 295 Section get currentSection => _sectionIterator.current; |
| 296 Feed get currentFeed() => _feedIterator.current; | 296 Feed get currentFeed => _feedIterator.current; |
| 297 } | 297 } |
| OLD | NEW |