I'd suggest you raise an issue for that if you think it's important. You
can even assign it to me if you want. But I don't personally consider it as
very important.
I can see that it has been there in some form ever since the migration away
from handwritten js classes - approaching 4 years ago, so seems really low
priority imo otherwise I am sure it would have been addressed already by
now. But I am happy to come back to it at some point.

On Thu, May 23, 2019 at 7:44 PM Alex Harui <[email protected]> wrote:

> Ideally, there wouldn't be an HTMLElementWrapper at all on the SWF side
> since there is no HTMLElement to wrap.
>
> I would rather we find a way to get rid of HTMLElementWrapper on the SWF
> side in order to prove that we don't need the same set of base classes on
> each platform.  In fact, there might be a way to put the "override" in a
> "COMPILE::JS" block in UIBase.
>
> My 2 cents,
> -Alex
>
> On 5/23/19, 12:05 AM, "[email protected]" <[email protected]> wrote:
>
>     This is an automated email from the ASF dual-hosted git repository.
>
>     gregdove pushed a commit to branch improvements/Language
>     in repository
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs.git&amp;data=02%7C01%7Caharui%40adobe.com%7Cfab4455dfe08412f9edd08d6df4d0f98%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636941919434601918&amp;sdata=Vn82YDCwic7rTP%2BXXAq8IxK9%2Fi%2FGAmEuldRkVLr0gXs%3D&amp;reserved=0
>
>     commit bce6ba5a778372f10f60ba4f7af872da56740a39
>     Author: greg-dove <[email protected]>
>     AuthorDate: Thu May 23 18:30:06 2019 +1200
>
>         refactor private beads to correspond to different requirements
> between targets
>     ---
>      .../main/royale/org/apache/royale/core/UIBase.as   |  99
> ++----------------
>      .../org/apache/royale/core/HTMLElementWrapper.as   | 112
> +++++++++++++++++++--
>      2 files changed, 109 insertions(+), 102 deletions(-)
>
>     diff --git
> a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
> b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
>     index 613c940..a9f9f52 100644
>     ---
> a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
>     +++
> b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/UIBase.as
>     @@ -904,43 +904,6 @@ package org.apache.royale.core
>              {
>                  return element.childNodes as Array;
>              }
>     -
>     -        COMPILE::SWF
>     -           private var _model:IBeadModel;
>     -
>     -        /**
>     -         *  An IBeadModel that serves as the data model for the
> component.
>     -         *
>     -         *  @langversion 3.0
>     -         *  @playerversion Flash 10.2
>     -         *  @playerversion AIR 2.6
>     -         *  @productversion Royale 0.0
>     -         */
>     -        COMPILE::SWF
>     -        public function get model():Object
>     -           {
>     -            if (_model == null)
>     -            {
>     -                // addbead will set _model
>     -                addBead(new (ValuesManager.valuesImpl.getValue(this,
> "iBeadModel")) as IBead);
>     -            }
>     -                   return _model;
>     -           }
>     -
>     -        COMPILE::SWF
>     -        /**
>     -         * @private
>     -         * @royaleignorecoercion org.apache.royale.core.IBead
>     -         */
>     -        [Bindable("modelChanged")]
>     -           public function set model(value:Object):void
>     -           {
>     -                   if (_model != value)
>     -                   {
>     -                           addBead(value as IBead);
>     -                           dispatchEvent(new Event("modelChanged"));
>     -                   }
>     -           }
>
>              private var _view:IBeadView;
>
>     @@ -1157,8 +1120,6 @@ package org.apache.royale.core
>               */
>                 public var beads:Array;
>
>     -        COMPILE::SWF
>     -           private var _beads:Vector.<IBead>;
>
>              /**
>               *  @copy org.apache.royale.core.IStrand#addBead()
>     @@ -1173,17 +1134,12 @@ package org.apache.royale.core
>                 override public function addBead(bead:IBead):void
>                 {
>                  var isView:Boolean;
>     -                   if (!_beads)
>     -                           _beads = new Vector.<IBead>;
>     -                   _beads.push(bead);
>     -                   if (bead is IBeadModel)
>     -                           _model = bead as IBeadModel;
>     -            else if (bead is IBeadView)
>     -            {
>     -                _view = bead as IBeadView;
>     -                isView = true
>     -            }
>     -                   bead.strand = this;
>     +
>     +                   super.addBead(bead);
>     +                   if (this._model !== bead && bead is IBeadView) {
>     +                           _view = bead as IBeadView;
>     +                           isView = true
>     +                   }
>
>                         if (isView) {
>                                 dispatchEvent(new Event("viewChanged"));
>     @@ -1191,49 +1147,6 @@ package org.apache.royale.core
>                 }
>
>              /**
>     -         *  @copy org.apache.royale.core.IStrand#getBeadByType()
>     -         *
>     -         *  @langversion 3.0
>     -         *  @playerversion Flash 10.2
>     -         *  @playerversion AIR 2.6
>     -         *  @productversion Royale 0.0
>     -         */
>     -        COMPILE::SWF
>     -           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
>     -         */
>     -        COMPILE::SWF
>     -           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;
>     -           }
>     -
>     -        /**
>               *  @copy org.apache.royale.core.IParent#addElement()
>               *
>               *  @langversion 3.0
>     diff --git
> a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
> b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
>     index 4ebff5a..85e5597 100644
>     ---
> a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
>     +++
> b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
>     @@ -23,6 +23,7 @@ package org.apache.royale.core
>          COMPILE::SWF
>          {
>              import flash.display.Sprite;
>     +        import org.apache.royale.events.Event;
>          }
>
>          COMPILE::JS
>     @@ -35,18 +36,110 @@ package org.apache.royale.core
>              import goog.events;
>              import goog.events.BrowserEvent;
>              import goog.events.EventTarget;
>     +        import goog.DEBUG;
>              import org.apache.royale.events.utils.EventUtils;
>          }
>
>          COMPILE::SWF
>     -    public class HTMLElementWrapper extends Sprite
>     +    public class HTMLElementWrapper extends Sprite implements
> IStrand, IEventDispatcher
>          {
>     +
>     +        private var _beads:Vector.<IBead>;
>     +
>              /**
>     -         * "abstract" method so we can override in JS
>               * @param bead The new bead.
>               */
>              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;
>     +        }
>     +
>     +        /**
>     +         *  @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;
>     +        }
>     +
>     +
>     +
>     +        /**
>     +         * allow access from overrides
>     +         */
>     +        protected var _model:IBeadModel;
>     +
>     +        /**
>     +         * @royaleignorecoercion Class
>     +         * @royaleignorecoercion org.apache.royale.core.IBeadModel
>     +         */
>     +        public function get model():Object
>     +        {
>     +            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
>     +         */
>     +        [Bindable("modelChanged")]
>     +        public function set model(value:Object):void
>     +        {
>     +            if (_model != value)
>     +            {
>     +                addBead(value as IBead);
>     +                dispatchEvent(new Event("modelChanged"));
>     +            }
>              }
>          }
>
>     @@ -132,7 +225,7 @@ package org.apache.royale.core
>              /**
>               * allow access from overrides
>               */
>     -           protected var _model:Object;
>     +           protected var _model:IBeadModel;
>
>              /**
>               * @royaleignorecoercion Class
>     @@ -153,6 +246,7 @@ package org.apache.royale.core
>
>              /**
>               * @royaleignorecoercion org.apache.royale.core.IBead
>     +         * @royaleignorecoercion org.apache.royale.core.IBeadModel
>               */
>              [Bindable("modelChanged")]
>              public function set model(value:Object):void
>     @@ -162,12 +256,12 @@ package org.apache.royale.core
>                      if (value is IBead)
>                          addBead(value as IBead);
>                      else
>     -                    _model = value;
>     +                    _model = IBeadModel(value);
>                      dispatchEvent(new
> org.apache.royale.events.Event("modelChanged"));
>                  }
>              }
>     -
>     -           protected var _beads:Vector.<IBead>;
>     +
>     +           private var _beads:Array;
>
>                 //--------------------------------------
>                 //   Function
>     @@ -181,9 +275,9 @@ package org.apache.royale.core
>                 {
>                         if (!_beads)
>                         {
>     -                           _beads = new Vector.<IBead>();
>     +                           _beads = [];
>                         }
>     -
>     +            if (goog.DEBUG && !(bead is IBead)) throw new
> TypeError('Cannot convert '+bead+' to IBead')
>                         _beads.push(bead);
>
>                         if (bead is IBeadModel)
>
>
>
>

Reply via email to