This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new e1773f4  move model out of Strand
e1773f4 is described below

commit e1773f48fd0bd41f808b71aafcac97469be436ab
Author: Harbs <[email protected]>
AuthorDate: Fri Jan 24 14:45:10 2020 +0200

    move model out of Strand
---
 .../projects/Core/src/main/royale/CoreClasses.as   |  1 +
 .../main/royale/org/apache/royale/core/Strand.as   | 40 ---------
 .../royale/core/{Strand.as => StrandWithModel.as}  | 95 ++--------------------
 .../royale/org/apache/royale/file/FileProxy.as     |  4 +-
 4 files changed, 8 insertions(+), 132 deletions(-)

diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as 
b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index 6a6590e..a644a8f 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -162,6 +162,7 @@ internal class CoreClasses
        
        import org.apache.royale.core.CSSClassList; CSSClassList;
        import org.apache.royale.core.StyleChangeNotifier; StyleChangeNotifier;
+       import org.apache.royale.core.StrandWithModel; StrandWithModel;
        import org.apache.royale.events.CustomEvent; CustomEvent;
     import org.apache.royale.events.Event; Event;
        import org.apache.royale.events.CloseEvent; CloseEvent;
diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as
index 11ceae1..5610ccc 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as
@@ -46,43 +46,6 @@ package org.apache.royale.core
                        super();
                }
                
-               
-               private var _model:IBeadModel;
-                
-        /**
-         *  An IBeadModel that serves as the data model for the component.
-         *  Note that there is no controller or view properties since
-         *  this not a display object.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion Royale 0.9
-         *  @royaleignorecoercion org.apache.royale.core.IBead
-         */
-               public function get model():IBeadModel
-               {
-            if (_model == null)
-            {
-                // addbead will set _model
-                addBead(new (ValuesManager.valuesImpl.getValue(this, 
"iBeadModel")) as IBead);
-            }
-                       return _model;
-               }
-        
-        /**
-         *  @private
-         *  @royaleignorecoercion org.apache.royale.core.IBead
-         */
-               public function set model(value:IBeadModel):void
-               {
-                       if (_model != value)
-                       {
-                               addBead(value as IBead);
-                sendStrandEvent(this,"modelChanged")
-                       }
-               }
-               
                private var _id:String;
 
         /**
@@ -131,15 +94,12 @@ package org.apache.royale.core
          *  @playerversion Flash 10.2
          *  @playerversion AIR 2.6
          *  @productversion Royale 0.9
-         *  @royaleignorecoercion org.apache.royale.core.IBeadModel
          */
                public function addBead(bead:IBead):void
                {
                        if (!_beads)
                                _beads = new Vector.<IBead>;
                        _beads.push(bead);
-                       if (bead is IBeadModel)
-                               _model = bead as IBeadModel;
                        bead.strand = this;
                }
                
diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StrandWithModel.as
similarity index 58%
copy from 
frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as
copy to 
frameworks/projects/Core/src/main/royale/org/apache/royale/core/StrandWithModel.as
index 11ceae1..9d78d72 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as
+++ 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StrandWithModel.as
@@ -31,7 +31,7 @@ package org.apache.royale.core
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.0
      */
-       public class Strand extends EventDispatcher implements IStrand
+       public class StrandWithModel extends Strand
        {
         /**
          *  Constructor.
@@ -41,7 +41,7 @@ package org.apache.royale.core
          *  @playerversion AIR 2.6
          *  @productversion Royale 0.0
          */
-               public function Strand()
+               public function StrandWithModel()
                {
                        super();
                }
@@ -82,47 +82,6 @@ package org.apache.royale.core
                 sendStrandEvent(this,"modelChanged")
                        }
                }
-               
-               private var _id:String;
-
-        /**
-         *  An id property for MXML documents.
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion Royale 0.0
-         */
-               public function get id():String
-               {
-                       return _id;
-               }
-               public function set id(value:String):void
-               {
-                       if (_id != value)
-                       {
-                               _id = value;
-                sendStrandEvent(this,"idChanged");
-                       }
-               }
-                               
-        /**
-         *  @copy org.apache.royale.core.Application#beads
-         *  
-         *  The beads are not automatically added to the
-         *  strand.  Subclasses must decide when to
-         *  add the beads.
-         * 
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion Royale 0.0
-         * 
-         *  @royalesuppresspublicvarwarning
-         */
-               public var beads:Array;
-               
-               private var _beads:Vector.<IBead>;
 
         /**
          *  @copy org.apache.royale.core.IStrand#addBead()
@@ -133,56 +92,12 @@ package org.apache.royale.core
          *  @productversion Royale 0.9
          *  @royaleignorecoercion org.apache.royale.core.IBeadModel
          */
-               public function addBead(bead:IBead):void
+               override public function addBead(bead:IBead):void
                {
-                       if (!_beads)
-                               _beads = new Vector.<IBead>;
-                       _beads.push(bead);
+            super.addBead(bead);
                        if (bead is IBeadModel)
                                _model = bead as IBeadModel;
-                       bead.strand = this;
-               }
-               
-        /**
-         *  @copy org.apache.royale.core.IStrand#getBeadByType()
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion Royale 0.0
-         */
-               public function getBeadByType(classOrInterface:Class):IBead
-               {
-                       for each (var bead:IBead in _beads)
-                       {
-                               if (bead is classOrInterface)
-                                       return bead;
-                       }
-                       return null;
-               }
-               
-        /**
-         *  @copy org.apache.royale.core.IStrand#removeBead()
-         *  
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion Royale 0.0
-         */
-               public function removeBead(value:IBead):IBead   
-               {
-                       var n:int = _beads.length;
-                       for (var i:int = 0; i < n; i++)
-                       {
-                               var bead:IBead = _beads[i];
-                               if (bead == value)
-                               {
-                                       _beads.splice(i, 1);
-                                       return bead;
-                               }
-                       }
-                       return null;
                }
-                       
+
        }
 }
diff --git 
a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/FileProxy.as
 
b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/FileProxy.as
index e4fb53b..f7b4a5f 100644
--- 
a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/FileProxy.as
+++ 
b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/FileProxy.as
@@ -19,7 +19,7 @@ package org.apache.royale.file
 {
        import org.apache.royale.core.IBead;
        import org.apache.royale.core.IDocument;
-       import org.apache.royale.core.Strand;
+       import org.apache.royale.core.StrandWithModel;
        import org.apache.royale.utils.BinaryData;
 
        COMPILE::SWF
@@ -47,7 +47,7 @@ package org.apache.royale.file
         *  @playerversion AIR 2.6
         *  @productversion Royale 0.9
         */
-       public class FileProxy extends Strand implements IDocument, IFileModel
+       public class FileProxy extends StrandWithModel implements IDocument, 
IFileModel
        {
                private var _document:Object;
                public function FileProxy()

Reply via email to