Here’s the first stab at my experiment. I still need to audit the classes and figure out where addBeads() needs to be called. Then I need to go through some tests and check how they behave…
Once I’m there, we can discuss… > On Jul 16, 2017, at 12:35 AM, ha...@apache.org wrote: > > Repository: flex-asjs > Updated Branches: > refs/heads/refactor-strand [created] 41e30e2cf > > > Core changes to IStrand > > > Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo > Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/80580936 > Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/80580936 > Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/80580936 > > Branch: refs/heads/refactor-strand > Commit: 80580936bf28455f7c3573ca96ee14dff396936c > Parents: dd4672b > Author: Harbs <ha...@in-tools.com> > Authored: Sat Jul 15 23:57:20 2017 +0300 > Committer: Harbs <ha...@in-tools.com> > Committed: Sat Jul 15 23:57:20 2017 +0300 > > ---------------------------------------------------------------------- > .../flex/org/apache/flex/core/ElementWrapper.as | 61 ++++++++++++++++++++ > .../main/flex/org/apache/flex/core/IStrand.as | 24 ++++++++ > .../main/flex/org/apache/flex/core/Strand.as | 29 ++++++++++ > .../apache/flex/utils/MXMLDataInterpreter.as | 4 +- > 4 files changed, 116 insertions(+), 2 deletions(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80580936/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ElementWrapper.as > ---------------------------------------------------------------------- > diff --git > a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ElementWrapper.as > > b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ElementWrapper.as > index b744edb..53785ac 100644 > --- > a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ElementWrapper.as > +++ > b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ElementWrapper.as > @@ -60,11 +60,29 @@ package org.apache.flex.core > _element = value; > } > > + private var beads:Array; > + > protected var _beads:Vector.<IBead>; > > //-------------------------------------- > // Function > //-------------------------------------- > + > + /** > + * @copy org.apache.flex.core.IStrand#registerBead() > + * > + * @langversion 3.0 > + * @playerversion Flash 10.2 > + * @playerversion AIR 2.6 > + * @productversion FlexJS 0.9 > + */ > + public function registerBead(bead:IBead):void > + { > + if(beads) > + beads.push(bead); > + else > + beads = [bead]; > + } > > /** > * @param bead The new bead. > @@ -79,6 +97,19 @@ package org.apache.flex.core > _beads.push(bead); > bead.strand = this; > } > + > + /** > + * @copy org.apache.flex.core.IStrand#addBeads() > + * > + * @langversion 3.0 > + * @playerversion Flash 10.2 > + * @playerversion AIR 2.6 > + * @productversion FlexJS 0.9 > + */ > + public function addBeads():void > + { > + addBeadsToStrand(this,beads); > + } > > /** > * @param classOrInterface The requested bead type. > @@ -228,6 +259,7 @@ package org.apache.flex.core > _element = value; > } > > + private var beads:Array; > > protected var _beads:Vector.<IBead>; > > @@ -236,6 +268,22 @@ package org.apache.flex.core > //-------------------------------------- > > /** > + * @copy org.apache.flex.core.IStrand#registerBead() > + * > + * @langversion 3.0 > + * @playerversion Flash 10.2 > + * @playerversion AIR 2.6 > + * @productversion FlexJS 0.9 > + */ > + public function registerBead(bead:IBead):void > + { > + if(beads) > + beads.push(bead); > + else > + beads = [bead]; > + } > + > + /** > * @param bead The new bead. > */ > public function addBead(bead:IBead):void > @@ -250,6 +298,19 @@ package org.apache.flex.core > } > > /** > + * @copy org.apache.flex.core.IStrand#addBeads() > + * > + * @langversion 3.0 > + * @playerversion Flash 10.2 > + * @playerversion AIR 2.6 > + * @productversion FlexJS 0.9 > + */ > + public function addBeads():void > + { > + addBeadsToStrand(this,beads); > + } > + > + /** > * @param classOrInterface The requested bead type. > * @return The bead. > */ > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80580936/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IStrand.as > ---------------------------------------------------------------------- > diff --git > a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IStrand.as > b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IStrand.as > index b6e8b20..a60e340 100644 > --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IStrand.as > +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/IStrand.as > @@ -37,6 +37,18 @@ package org.apache.flex.core > public interface IStrand > { > /** > + * Registers a bead to be add to the strand. > + * > + * @param bead The bead to be added. > + * > + * @langversion 3.0 > + * @playerversion Flash 10.2 > + * @playerversion AIR 2.6 > + * @productversion FlexJS 0.9 > + */ > + function registerBead(bead:IBead):void; > + > + /** > * Add a bead to the strand. > * > * @param bead The bead to be added. > @@ -47,6 +59,18 @@ package org.apache.flex.core > * @productversion FlexJS 0.0 > */ > function addBead(bead:IBead):void; > + > + /** > + * Add the beads registered to the strand. > + * > + * @param bead The bead to be added. > + * > + * @langversion 3.0 > + * @playerversion Flash 10.2 > + * @playerversion AIR 2.6 > + * @productversion FlexJS 0.9 > + */ > + function addBeads():void; > > /** > * Find a bead on the strand. > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80580936/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Strand.as > ---------------------------------------------------------------------- > diff --git > a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Strand.as > b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Strand.as > index b0318d6..f4953fa 100644 > --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Strand.as > +++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Strand.as > @@ -120,6 +120,22 @@ package org.apache.flex.core > private var _beads:Vector.<IBead>; > > /** > + * @copy org.apache.flex.core.IStrand#registerBead() > + * > + * @langversion 3.0 > + * @playerversion Flash 10.2 > + * @playerversion AIR 2.6 > + * @productversion FlexJS 0.9 > + */ > + public function registerBead(bead:IBead):void > + { > + if(beads) > + beads.push(bead); > + else > + beads = [bead]; > + } > + > + /** > * @copy org.apache.flex.core.IStrand#addBead() > * > * @langversion 3.0 > @@ -136,6 +152,19 @@ package org.apache.flex.core > _model = bead as IBeadModel; > bead.strand = this; > } > + > + /** > + * @copy org.apache.flex.core.IStrand#addBeads() > + * > + * @langversion 3.0 > + * @playerversion Flash 10.2 > + * @playerversion AIR 2.6 > + * @productversion FlexJS 0.9 > + */ > + public function addBeads():void > + { > + addBeadsToStrand(this,beads); > + } > > /** > * @copy org.apache.flex.core.IStrand#getBeadByType() > > http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80580936/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/MXMLDataInterpreter.as > ---------------------------------------------------------------------- > diff --git > a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/MXMLDataInterpreter.as > > b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/MXMLDataInterpreter.as > index 6f24181..704503d 100644 > --- > a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/MXMLDataInterpreter.as > +++ > b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/MXMLDataInterpreter.as > @@ -191,8 +191,8 @@ public class MXMLDataInterpreter > else if (simple == false) > value = generateMXMLObject(document, value as Array); > comp[name] = value; > - if (value is IBead && comp is IStrand) > - IStrand(comp).addBead(value as IBead); > + // if (value is IBead && comp is IStrand) > + // IStrand(comp).addBead(value as IBead); > } > var beadOffset:int = i + (m - 1) * 3; > //if (beadOffset >= -1) >