Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: client/samples/swarm/SwarmApp.dart

Issue 9314024: Final CL to kill off client/samples . (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/samples/swarm/README ('k') | client/samples/swarm/SwarmState.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/samples/swarm/SwarmApp.dart
===================================================================
--- client/samples/swarm/SwarmApp.dart (revision 3770)
+++ client/samples/swarm/SwarmApp.dart (working copy)
@@ -1,87 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * A simple news reader in Dart.
- */
-class Swarm extends App {
- /**
- * Flag to insure the onLoad isn't called when callback from initializeFromUrl
- * could occur before the document's onload event.
- */
- bool onLoadFired;
-
- /** Collections of datafeeds to show per page. */
- Sections sections;
-
- /** The front page of the app. */
- FrontView frontView;
-
- /** Observable UI state. */
- SwarmState state;
-
- Swarm() : super(), onLoadFired = false {
- Sections.initializeFromUrl((currSections) {
- sections = currSections;
- state = new SwarmState(sections);
- setupApp();
- });
- // Catch user keypresses and decide whether to use them for the
- // Streams app or pass them on to the browser.
- document.on.keyUp.add((e) {
- if (frontView != null) {
- frontView.processKeyEvent(e);
- }
- });
- }
-
- /**
- * Tells each data source to check the server for the latest data.
- */
- void refresh() {
- sections.refresh();
-
- // Hook up listeners about any data source additions or deletions. We don't
- // differeniate additions or deletions just the fact that data feeds have
- // changed. We might want more fidelity later.
- sections.sectionTitles.forEach((title) {
- Section section = sections.findSection(title);
- // TODO(terry): addChangeListener needs to return an id so previous
- // listener can be removed, otherwise anonymous functions
- // can't easily be used. See b/5063673
- section.feeds.addChangeListener((data) {
- // TODO(jacobr): implement this.
- print("Refresh sections not impl yet.");
- });
- });
- }
-
- /** The page load event handler. */
- void onLoad() {
- onLoadFired = true;
- super.onLoad();
- setupApp();
- }
-
- /**
- * Setup the application's world.
- */
- void setupApp() {
- // TODO(terry): Should be able to spinup the app w/o waiting for data.
- // If the document is already loaded so we can setup the app anytime.
- // Otherwise, we'll wait to setup the world until the document is ready
- // to render.
- if (onLoadFired && state != null) {
- render();
- // This call loads the initial data.
- refresh();
- eraseSplashScreen();
- }
- }
-
- void render() {
- frontView = new FrontView(this);
- frontView.addToDocument(document.body);
- }
-}
« no previous file with comments | « client/samples/swarm/README ('k') | client/samples/swarm/SwarmState.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698