flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [3/3] git commit: [flex-asjs] [refs/heads/develop] - trigger catalog when it is filled. Need new event to do that
Date Fri, 23 Jan 2015 22:22:17 GMT
trigger catalog when it is filled.  Need new event to do that


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/e1f17c92
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/e1f17c92
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/e1f17c92

Branch: refs/heads/develop
Commit: e1f17c928d801de825d5f576ccddd827e4cc9d6f
Parents: f5fc038
Author: Alex Harui <aharui@apache.org>
Authored: Fri Jan 23 14:22:03 2015 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Jan 23 14:22:03 2015 -0800

----------------------------------------------------------------------
 examples/FlexJSStore/src/FlexJSStore.mxml            |  5 +++--
 .../apache/flex/net/dataConverters/LazyCollection.as | 15 +++++++++++++++
 .../apache/flex/net/dataConverters/LazyCollection.js |  9 ++++++++-
 3 files changed, 26 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e1f17c92/examples/FlexJSStore/src/FlexJSStore.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSStore/src/FlexJSStore.mxml b/examples/FlexJSStore/src/FlexJSStore.mxml
index 95bee6c..afa26f8 100755
--- a/examples/FlexJSStore/src/FlexJSStore.mxml
+++ b/examples/FlexJSStore/src/FlexJSStore.mxml
@@ -168,7 +168,7 @@ limitations under the License.
 	
     <fx:Declarations>
         <basic:HTTPService id="productService" url="data/catalog.json">
-            <basic:LazyCollection id="catalog">
+            <basic:LazyCollection id="catalog" complete="if (pView) pView.catalog = catalog">
                 <basic:inputParser>
                     <basic:JSONInputParser />
                 </basic:inputParser>
@@ -182,6 +182,7 @@ limitations under the License.
         <basic:SimpleCSSValuesImpl />
     </basic:valuesImpl>
 	<basic:beads>
+        <basic:ViewSourceContextMenuOption />
         <basic:CallLaterBead id="callLater" />
         <basic:ApplicationDataBinding />
     </basic:beads>
@@ -258,7 +259,7 @@ limitations under the License.
                 <HomeView id="homeView" width="100%" height="550" includeIn="Home"
                           />
                 <ProductsView id="pView" includeIn="Products" visible.ProductsPreBake="false"
-                              width="100%" height="550" initComplete="pView.catalog = catalog"
+                              width="100%" height="550" initComplete="if (catalog.length)
pView.catalog = catalog"
                               />
                 <SupportView id="supportView" includeIn="Support"
                              width="100%" height="550"

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e1f17c92/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/dataConverters/LazyCollection.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/dataConverters/LazyCollection.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/dataConverters/LazyCollection.as
index 572b2a0..226499f 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/dataConverters/LazyCollection.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/dataConverters/LazyCollection.as
@@ -28,6 +28,20 @@ package org.apache.flex.net.dataConverters
     import org.apache.flex.net.IInputParser;
     import org.apache.flex.net.IItemConverter;
     
+    //--------------------------------------
+    //  Events
+    //--------------------------------------
+    
+    /**
+     *  Dispatched when the collection has processed a complete event.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+    [Event(name="complete", type="org.apache.flex.events.Event")]
+    
     /**
      *  The LazyCollection class implements a collection
      *  whose items require conversion from a source data format
@@ -198,6 +212,7 @@ package org.apache.flex.net.dataConverters
         {
             rawData = inputParser.parseItems(_strand["data"]);  
             data = new Array(rawData.length);
+            dispatchEvent(event);
         }
         
         /**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/e1f17c92/frameworks/js/FlexJS/src/org/apache/flex/net/dataConverters/LazyCollection.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/net/dataConverters/LazyCollection.js
b/frameworks/js/FlexJS/src/org/apache/flex/net/dataConverters/LazyCollection.js
index cb592b7..5330ce1 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/net/dataConverters/LazyCollection.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/net/dataConverters/LazyCollection.js
@@ -14,12 +14,16 @@
 
 goog.provide('org.apache.flex.net.dataConverters.LazyCollection');
 
+goog.require('org.apache.flex.events.EventDispatcher');
+goog.require('org.apache.flex.events.IEventDispatcher');
+
 
 
 /**
  * @constructor
  */
 org.apache.flex.net.dataConverters.LazyCollection = function() {
+  org.apache.flex.net.dataConverters.LazyCollection.base(this, 'constructor');
   /**
    * @private
    * @type {Object}
@@ -51,6 +55,7 @@ org.apache.flex.net.dataConverters.LazyCollection = function() {
    */
   this.strand_ = null;
 };
+goog.inherits(org.apache.flex.net.dataConverters.LazyCollection, org.apache.flex.events.EventDispatcher);
 
 
 /**
@@ -60,7 +65,8 @@ org.apache.flex.net.dataConverters.LazyCollection = function() {
  */
 org.apache.flex.net.dataConverters.LazyCollection.prototype.FLEXJS_CLASS_INFO =
     { names: [{ name: 'LazyCollection',
-                qName: 'org.apache.flex.net.dataConverters.LazyCollection'}] };
+                qName: 'org.apache.flex.net.dataConverters.LazyCollection'}],
+      interfaces: [org.apache.flex.events.IEventDispatcher]};
 
 
 /**
@@ -155,6 +161,7 @@ org.apache.flex.net.dataConverters.LazyCollection.prototype.completeHandler
=
   var results = this.strand_.get_data();
   this.rawData_ = this.inputParser_.parseItems(results);
   this.data_ = [];
+  this.dispatchEvent('complete');
 };
 
 


Mime
View raw message