royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject Re: [royale-asjs] 01/01: First (non-working) version
Date Mon, 13 Nov 2017 18:29:06 GMT
That’s what I was looking for.

Thanks!

> On Nov 13, 2017, at 6:42 PM, Alex Harui <aharui@adobe.com.INVALID> wrote:
> 
> You might be better off using childrenAdded.  It should fire once for the
> entire set of children specified in MXML, and once for each child added
> via AS, which you might need if a child is added "later".
> 
> My 2 cents,
> -Alex
> 
> On 11/13/17, 7:09 AM, "Piotr Zarzycki" <piotrzarzycki21@gmail.com <mailto:piotrzarzycki21@gmail.com>>
wrote:
> 
>> Yishay,
>> 
>> Thanks for the info! Precious! :)
>> 
>> Piotr
>> 
>> 
>> 2017-11-13 16:03 GMT+01:00 Yishay Weiss <yishayjobs@hotmail.com>:
>> 
>>> It looks like initComplete is called after children are initialized [1]
>>> 
>>> 
>>> 
>>> I would add the focus disable behavior as a separate bead as Piotr
>>> suggested (similar to DisabledAlphaBead).
>>> 
>>> 
>>> 
>>> [1] 
>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.c <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.c>
>>> om%2Fyishayw%2FExamples%2Ftree%2FinitComplete&data=02%7C01%7C%7Ca9d54724b
>>> c9443dcb42d08d52aa88b95%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6364
>>> 61825737445515&sdata=gYDEhA2WwBvRPPQ6aOgyz5Cp4fIn3iluQhq9YbFtIdQ%3D&reser
>>> ved=0
>>> 
>>> 
>>> 
>>> ________________________________
>>> From: Harbs <harbs.lists@gmail.com <mailto:harbs.lists@gmail.com>>
>>> Sent: Monday, November 13, 2017 3:26:58 PM
>>> To: dev@royale.apache.org <mailto:dev@royale.apache.org>
>>> Subject: Re: [royale-asjs] 01/01: First (non-working) version
>>> 
>>> Is initComplete fired after all the children are added?
>>> 
>>>> Also, doesn’t DisableBead work for containers as is?
>>> 
>>> No. DisableBead helps in so far as you can’t select using the mouse, but
>>> you can still select using the keyboard by tabbing though controls. For
>>> that to work, you need to disable tabbing on all the descendants.
>>> 
>>>> On Nov 13, 2017, at 3:20 PM, Yishay Weiss <yishayjobs@hotmail.com <mailto:yishayjobs@hotmail.com>>
>>> wrote:
>>>> 
>>>> Why not listen to the container’s ‘initComplete’? Also, doesn’t
>>> DisableBead work for containers as is?
>>>> 
>>>> 
>>>> 
>>>> ________________________________
>>>> From: Piotr Zarzycki <piotrzarzycki21@gmail.com <mailto:piotrzarzycki21@gmail.com>>
>>>> Sent: Monday, November 13, 2017 3:15:54 PM
>>>> To: dev@royale.apache.org <mailto:dev@royale.apache.org>
>>>> Subject: Re: [royale-asjs] 01/01: First (non-working) version
>>>> 
>>>> Harbs,
>>>> 
>>>> First thought is register to "initComplete" for each children ? But
>>> does
>>>> each of our children emit such event ?
>>>> 
>>>> Piotr
>>>> 
>>>> 
>>>> 2017-11-13 14:01 GMT+01:00 Harbs <harbs.lists@gmail.com <mailto:harbs.lists@gmail.com>>:
>>>> 
>>>>> I need some help here.
>>>>> 
>>>>> The code should be working, but the bead is added before the children
>>> are
>>>>> added, so the styles and attributes are not applied.
>>>>> 
>>>>> Any ideas on how to delay the execution until after the full tree of
>>>>> children are added?
>>>>> 
>>>>> Thanks,
>>>>> Harbs
>>>>> 
>>>>>> On Nov 13, 2017, at 2:57 PM, harbs@apache.org <mailto:harbs@apache.org>
wrote:
>>>>>> 
>>>>>> This is an automated email from the ASF dual-hosted git repository.
>>>>>> 
>>>>>> harbs pushed a commit to branch feature/disable-children-bead
>>>>>> in repository
>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.a <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.a>
>>> pache.org <http://pache.org/>%2Frepos%2Fasf%2Froyale-asjs.git&data=02%7C01%7C%7Ca9d54724bc944
>>> 3dcb42d08d52aa88b95%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63646182
>>> 5737445515&sdata=KWwzVziEug3oAjzc2payBE947JUEv4GSWWPeoOtHd6w%3D&reserved=
>>> 0
>>>>>> 
>>>>>> commit c1cc651a6f03cbcdb6792eed367140404adf7863
>>>>>> Author: Harbs <harbs@in-tools.com <mailto:harbs@in-tools.com>>
>>>>>> AuthorDate: Mon Nov 13 14:57:34 2017 +0200
>>>>>> 
>>>>>>  First (non-working) version
>>>>>> ---
>>>>>> .../Basic/src/main/resources/basic-manifest.xml    |   1 +
>>>>>> .../royale/html/beads/DisableChildrenBead.as       | 152
>>>>> +++++++++++++++++++++
>>>>>> 2 files changed, 153 insertions(+)
>>>>>> 
>>>>>> diff --git a/frameworks/projects/Basic/src/main/resources/basic-
>>> manifest.xml
>>>>> b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
>>>>>> index 90b72b3..02a8579 100644
>>>>>> --- 
>>> a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
>>>>>> +++ 
>>> b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
>>>>>> @@ -113,6 +113,7 @@
>>>>>>   <component id="UnselectableElementBead"
>>>>> class="org.apache.royale.html.beads.UnselectableElementBead"/>
>>>>>>   <component id="DisableBead" class="org.apache.royale.html.
>>> beads.DisableBead"
>>>>> />
>>>>>>   <component id="DisabledAlphaBead" class="org.apache.royale.html.
>>> beads.DisabledAlphaBead"
>>>>> />
>>>>>> +    <component id="DisableChildrenBead"
>>> class="org.apache.royale.html.
>>> beads.DisableChildrenBead"
>>>>> />
>>>>>>   <component id="NumericOnlyTextInputBead"
>>>>> class="org.apache.royale.html.accessories.NumericOnlyTextInputBead"
>>> />
>>>>>>   <component id="PasswordInputBead" class="org.apache.royale.html.
>>> accessories.PasswordInputBead"
>>>>> />
>>>>>>   <component id="PasswordInputRemovableBead"
>>>>> class="org.apache.royale.html.accessories.PasswordInputRemovableBead"
>>> />
>>>>>> diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/
>>>>> royale/html/beads/DisableChildrenBead.as b/frameworks/projects/Basic/
>>>>> src/main/royale/org/apache/royale/html/beads/DisableChildrenBead.as
>>>>>> new file mode 100644
>>>>>> index 0000000..ca4ffa1
>>>>>> --- /dev/null
>>>>>> +++ b/frameworks/projects/Basic/src/main/royale/org/apache/
>>>>> royale/html/beads/DisableChildrenBead.as
>>>>>> @@ -0,0 +1,152 @@
>>>>>> +///////////////////////////////////////////////////////////
>>>>> /////////////////////
>>>>>> +//
>>>>>> +//  Licensed to the Apache Software Foundation (ASF) under one or
>>> more
>>>>>> +//  contributor license agreements.  See the NOTICE file
>>> distributed
>>>>> with
>>>>>> +//  this work for additional information regarding copyright
>>> ownership.
>>>>>> +//  The ASF licenses this file to You under the Apache License,
>>> Version
>>>>> 2.0
>>>>>> +//  (the "License"); you may not use this file except in compliance
>>> with
>>>>>> +//  the License.  You may obtain a copy of the License at
>>>>>> +//
>>>>>> +//      
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach>
>>> e.org <http://e.org/>%2Flicenses%2FLICENSE-2.0&data=02%7C01%7C%7Ca9d54724bc9443dcb42d08d5
>>> 2aa88b95%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636461825737445515&
>>> sdata=X4LDergCv4sdMdUIj%2FWVxaN5m3Jz0hX4lMmnrVES4mE%3D&reserved=0
>>>>>> +//
>>>>>> +//  Unless required by applicable law or agreed to in writing,
>>> software
>>>>>> +//  distributed under the License is distributed on an "AS IS"
>>> BASIS,
>>>>>> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or
>>>>> implied.
>>>>>> +//  See the License for the specific language governing permissions
>>> and
>>>>>> +//  limitations under the License.
>>>>>> +//
>>>>>> +///////////////////////////////////////////////////////////
>>>>> /////////////////////
>>>>>> +package org.apache.royale.html.beads
>>>>>> +{
>>>>>> +     COMPILE::SWF {
>>>>>> +     import flash.display.DisplayObjectContainer;
>>>>>> +     }
>>>>>> +
>>>>>> +     import org.apache.royale.core.IBead;
>>>>>> +     import org.apache.royale.core.IStrand;
>>>>>> +     import org.apache.royale.core.IUIBase;
>>>>>> +     import org.apache.royale.core.UIHTMLElementWrapper;
>>>>>> +     import org.apache.royale.events.Event;
>>>>>> +     import org.apache.royale.events.IEventDispatcher;
>>>>>> +     import org.apache.royale.events.ValueEvent;
>>>>>> +
>>>>>> +     COMPILE::JS{
>>>>>> +             import org.apache.royale.core.WrappedHTMLElement;
>>>>>> +             import org.apache.royale.core.HTMLElementWrapper;
>>>>>> +     }
>>>>>> +     /**
>>>>>> +      *  The DisableBead class is a specialty bead that can be used
>>> with
>>>>>> +      *  any UIBase. When disabled is true, the bead prevents
>>>>> interaction with the component.
>>>>>> +      *  The appearance of the component when disabled is
>>> controlled
>>> by
>>>>> a separate bead.
>>>>>> +      *
>>>>>> +      *  @langversion 3.0
>>>>>> +      *  @playerversion Flash 10.2
>>>>>> +      *  @playerversion AIR 2.6
>>>>>> +      *  @productversion Royale 0.0
>>>>>> +      */
>>>>>> +     public class DisableChildrenBead implements IBead
>>>>>> +     {
>>>>>> +             /**
>>>>>> +              *  constructor.
>>>>>> +              *
>>>>>> +              *  @langversion 3.0
>>>>>> +              *  @playerversion Flash 10.2
>>>>>> +              *  @playerversion AIR 2.6
>>>>>> +              *  @productversion Royale 0.0
>>>>>> +              */
>>>>>> +             public function DisableChildrenBead()
>>>>>> +             {
>>>>>> +             }
>>>>>> +
>>>>>> +             private var _strand:IStrand;
>>>>>> +             private var _disabled:Boolean;
>>>>>> +
>>>>>> +             /**
>>>>>> +              *  @copy org.apache.royale.core.IBead#strand
>>>>>> +              *
>>>>>> +              *  @langversion 3.0
>>>>>> +              *  @playerversion Flash 10.2
>>>>>> +              *  @playerversion AIR 2.6
>>>>>> +              *  @productversion Royale 0.0
>>>>>> +              *  @royaleignorecoercion HTMLInputElement
>>>>>> +              *  @royaleignorecoercion
>>> org.apache.royale.core.UIBase;
>>>>>> +              */
>>>>>> +             public function set strand(value:IStrand):void
>>>>>> +             {
>>>>>> +                     _strand = value;
>>>>>> +                     updateHost();
>>>>>> +             }
>>>>>> +
>>>>>> +             public function get disabled():Boolean
>>>>>> +             {
>>>>>> +                     return _disabled;
>>>>>> +             }
>>>>>> +
>>>>>> +             /**
>>>>>> +              *  @private
>>>>>> +              *  @royaleignorecoercion org.apache.royale.core.
>>>>> HTMLElementWrapper
>>>>>> +              */
>>>>>> +             public function set disabled(value:Boolean):void
>>>>>> +             {
>>>>>> +                     if (value != _disabled)
>>>>>> +                     {
>>>>>> +                             _disabled = value;
>>>>>> +                             updateHost();
>>>>>> +                             throwChangeEvent();
>>>>>> +                     }
>>>>>> +             }
>>>>>> +
>>>>>> +             private function disabledChangeHandler(e:Event):void
>>>>>> +             {
>>>>>> +                     updateHost();
>>>>>> +             }
>>>>>> +
>>>>>> +             private function get host():IUIBase
>>>>>> +             {
>>>>>> +                     return _strand as IUIBase;
>>>>>> +             }
>>>>>> +
>>>>>> +             COMPILE::JS
>>>>>> +             private var _lastTabVal:String;
>>>>>> +
>>>>>> +             /**
>>>>>> +              * @royaleignorecoercion org.apache.royale.core.
>>>>> HTMLElementWrapper
>>>>>> +              */
>>>>>> +             private function updateHost():void
>>>>>> +             {
>>>>>> +                     if(!_strand)//bail out
>>>>>> +                             return;
>>>>>> +                     COMPILE::SWF {
>>>>>> +                             var interactiveObject:
>>> DisplayObjectContainer
>>>>> = _strand as DisplayObjectContainer;
>>>>>> +                             interactiveObject.mouseChildren =
>>>>> !disabled;
>>>>>> +                     }
>>>>>> +
>>>>>> +                     COMPILE::JS {
>>>>>> +                             setDecendants((_strand as
>>>>> HTMLElementWrapper).element);
>>>>>> +                     }
>>>>>> +
>>>>>> +             }
>>>>>> +
>>>>>> +             COMPILE::JS
>>>>>> +             private function setDecendants(elem:HTMLElement):void
>>>>>> +             {
>>>>>> +                     elem.style["pointerEvents"] = _disabled ?
>>> "none"
>>> :
>>>>> "";
>>>>>> +                     _disabled ? elem.setAttribute("tabindex",
>>> "-1") :
>>>>> elem.removeAttribute("tabindex");
>>>>>> +                     elem = elem.firstChild as HTMLElement;
>>>>>> +                     while (elem) {
>>>>>> +                             setDecendants(elem);
>>>>>> +                             elem = elem.nextSibling as
>>> HTMLElement;
>>>>>> +                     }
>>>>>> +             }
>>>>>> +
>>>>>> +             private function throwChangeEvent():void
>>>>>> +             {
>>>>>> +                     if (_strand)
>>>>>> +                     {
>>>>>> +                             IEventDispatcher(_strand).
>>> dispatchEvent(new
>>>>> ValueEvent("disabledChange", disabled));
>>>>>> +                     }
>>>>>> +             }
>>>>>> +
>>>>>> +
>>>>>> +     }
>>>>>> +}
>>>>>> 
>>>>>> --
>>>>>> To stop receiving notification emails like this one, please contact
>>>>>> "commits@royale.apache.org <mailto:commits@royale.apache.org>"
<commits@royale.apache.org <mailto:commits@royale.apache.org>>.
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> 
>>>> Piotr Zarzycki
>>>> 
>>>> Patreon: 
>>> *https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat>
>>> reon.com <http://reon.com/>%2Fpiotrzarzycki&data=02%7C01%7C%7Ca9d54724bc9443dcb42d08d52aa88b
>>> 95%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636461825737445515&sdata=
>>> WcTFjtNvzTnBh%2FDCDvxlUey80nWBGCjgjb6R76tbmQM%3D&reserved=0
>>>> 
>>> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat>
>>> reon.com <http://reon.com/>%2Fpiotrzarzycki&data=02%7C01%7C%7Ca9d54724bc9443dcb42d08d52aa88b
>>> 95%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636461825737445515&sdata=
>>> WcTFjtNvzTnBh%2FDCDvxlUey80nWBGCjgjb6R76tbmQM%3D&reserved=0>*
>>> 
>>> 
>> 
>> 
>> -- 
>> 
>> Piotr Zarzycki
>> 
>> Patreon: 
>> *https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr>
>> eon.com <http://eon.com/>%2Fpiotrzarzycki&data=02%7C01%7C%7Ca9d54724bc9443dcb42d08d52aa88b95
>> %7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636461825737445515&sdata=WcT
>> FjtNvzTnBh%2FDCDvxlUey80nWBGCjgjb6R76tbmQM%3D&reserved=0
>> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr>
>> eon.com <http://eon.com/>%2Fpiotrzarzycki&data=02%7C01%7C%7Ca9d54724bc9443dcb42d08d52aa88b95
>> %7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636461825737445515&sdata=WcT
>> FjtNvzTnBh%2FDCDvxlUey80nWBGCjgjb6R76tbmQM%3D&reserved=0>*


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message