flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Modified ItemRendererClassFactory to use new mx.core.ClassFactory to generate instances of itemRenderers.
Date Thu, 09 Jan 2014 20:55:46 GMT
Updated Branches:
  refs/heads/develop bbf1b0f4e -> c5e5724e2


Modified ItemRendererClassFactory to use new mx.core.ClassFactory to generate instances of
itemRenderers.


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

Branch: refs/heads/develop
Commit: c5e5724e27769b606c5edd6415deb4f59f11a313
Parents: bbf1b0f
Author: Peter Ent <pent@apache.org>
Authored: Thu Jan 9 15:55:26 2014 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Thu Jan 9 15:55:26 2014 -0500

----------------------------------------------------------------------
 frameworks/js/FlexJS/src/mx/core/ClassFactory.js      |  3 +++
 .../org/apache/flex/core/ItemRendererClassFactory.js  | 14 +++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c5e5724e/frameworks/js/FlexJS/src/mx/core/ClassFactory.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/mx/core/ClassFactory.js b/frameworks/js/FlexJS/src/mx/core/ClassFactory.js
index 46b94d3..d240d0e 100644
--- a/frameworks/js/FlexJS/src/mx/core/ClassFactory.js
+++ b/frameworks/js/FlexJS/src/mx/core/ClassFactory.js
@@ -21,12 +21,14 @@ goog.require('mx.core.IFactory');
 /**
  * @constructor
  * @implements {mx.core.IFactory}
+ * @param {Object} generator The class definition to use for newInstance.
  */
 mx.core.ClassFactory = function(generator) {
   this.generator = generator;
   this.properties = null;
 };
 
+
 /**
  * Metadata
  *
@@ -38,6 +40,7 @@ mx.core.ClassFactory.prototype.
            qName: 'mx.core.ClassFactory' }],
     interfaces: [mx.core.IFactory] };
 
+
 /**
  * @expose
  * @return {Object} The new instance of the class described by generator.

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c5e5724e/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js b/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js
index 2491fc3..24f425e 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/ItemRendererClassFactory.js
@@ -14,6 +14,7 @@
 
 goog.provide('org.apache.flex.core.ItemRendererClassFactory');
 
+goog.require('mx.core.ClassFactory');
 goog.require('org.apache.flex.core.IItemRendererClassFactory');
 goog.require('org.apache.flex.core.ValuesManager');
 
@@ -48,10 +49,21 @@ org.apache.flex.core.ItemRendererClassFactory.
     prototype.set_strand = function(value) {
   this.strand_ = value;
 
+  // see if the _strand has an itemRenderer property that isn't empty. if that's
+  // true, use that value instead of pulling it from the the style
+  if (this.strand_.hasOwnProperty('itemRenderer')) {
+    this.itemRendererClassFactory = this.strand_['itemRenderer'];
+    if (this.itemRendererClassFactory) {
+        this.createFunction = this.createFromClass;
+        return;
+    }
+  }
+
   if (org.apache.flex.core.ValuesManager.valuesImpl.getValue) {
     this.itemRendererClass = org.apache.flex.core.ValuesManager.valuesImpl.
         getValue(this.strand_, 'iItemRenderer');
     if (this.itemRendererClass) {
+      this.itemRendererClassFactory = new mx.core.ClassFactory(this.itemRendererClass);
       this.createFunction = this.createFromClass;
     }
   }
@@ -76,7 +88,7 @@ org.apache.flex.core.ItemRendererClassFactory.
  */
 org.apache.flex.core.ItemRendererClassFactory.
     prototype.createFromClass = function(parent) {
-  var renderer = new this.itemRendererClass();
+  var renderer = this.itemRendererClassFactory.newInstance();
   parent.addElement(renderer);
   return renderer;
 };


Mime
View raw message