You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Alex Harui <ah...@adobe.com.INVALID> on 2020/05/09 04:56:52 UTC

XML DataBinding

Mostly to Greg and Harbs,

Have you guys seen watcher type "xml" in the DataBinding data when setting up watchers for XML DataBinding?  I'm trying to understand if you've seen it work.  The switch statement in DataBindingBase setupWatchers doesn't have a case for it.  That seems to be Serkan's problem in https://github.com/apache/royale-asjs/issues/819 

Thoughts?
-Alex


Re: XML DataBinding

Posted by Alex Harui <ah...@adobe.com.INVALID>.
I think it is the same problem.  There is:

[Bindable]
var data:XML;

And the binding expression {data.visualParams.commandabilityParams.isDisablable == true}

I have a workaround that might work for many cases.  If we see a child watcher of type "xml" we apply the binding to the top-level watcher.  I certainly don't want to emulate XMLNotifier and we may not need to for binding because the entire expression becomes the source function.  At least in this case.  And that got the expression to evaluate, but I learned something new about the AS3 runtime:  AS3 runtimes special case "==" for XML and will correctly handle <isDisablable>false</isDisablable> and <isDisablable>true</isDisablable>.  We'd have to handle this in the compiler, but for now the workaround is to do this:

{data.visualParams.commandabilityParams.isDisablable == 'true'}  // the string true instead of Boolean true

Whereas these do not work:

{Boolean(data.visualParams.commandabilityParams.isDisablable) == true}
{Boolean(data.visualParams.commandabilityParams.isDisablable.toString()) == true}

Because Boolean("false") === true.

Fun stuff.  I'm going to stop work for tonight and ponder the consequences of the workaround.

-Alex

On 5/8/20, 11:26 PM, "Greg Dove" <gr...@gmail.com> wrote:

    I actually looked at this recently but for the complete opposite reason.
    
    I saw a problem recently with binding to an xml root (just a normal binding
    as the top level reference to the XML instance) for generated code. The
    compiler was trying to generate both the normal binding *and* the XML
    binding I think (it was the xml binding which was causing the problem). I
    only wanted the regular binding, so I coded around it, but made a note to
    come back and look at it later.
    
    I never ever used XML bindings in Flex, and even now I would probably
    choose to avoid them (by preference) if I was doing something in Flex (or
    Royale).
    I assum support for that that uses mx.binding.XMLNotifier in Flex as well
    as XMLWatcher.
    And relies on something we do not yet have (because I think it is not well
    known) :
    https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.docsultant.com%2Fsite2%2Farticles%2Fflex_internals.html%23xmlNotify&amp;data=02%7C01%7Caharui%40adobe.com%7Ca7bfcc01d166443efab408d7f3e1e071%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637246023772466676&amp;sdata=aVx1qIAQOONDZocPU7jrS2xH0Lwk7u6oU%2BoZ0sIOMXU%3D&amp;reserved=0
    
    I have not looked into what it would take to emulate this. We might want to
    consider whether Serkan's case is typical and needs supporting, or whether
    it is best to address it as a workaround.
    
    
    
    
    
    
    
    
    
    
    On Sat, May 9, 2020 at 4:57 PM Alex Harui <ah...@adobe.com.invalid> wrote:
    
    > Mostly to Greg and Harbs,
    >
    > Have you guys seen watcher type "xml" in the DataBinding data when setting
    > up watchers for XML DataBinding?  I'm trying to understand if you've seen
    > it work.  The switch statement in DataBindingBase setupWatchers doesn't
    > have a case for it.  That seems to be Serkan's problem in
    > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Fissues%2F819&amp;data=02%7C01%7Caharui%40adobe.com%7Ca7bfcc01d166443efab408d7f3e1e071%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637246023772466676&amp;sdata=tnwSVB07fjXNDgMRNGLaRiAqVqMseOQJ%2FWkzjSSxU%2FA%3D&amp;reserved=0
    >
    > Thoughts?
    > -Alex
    >
    >
    


Re: XML DataBinding

Posted by Greg Dove <gr...@gmail.com>.
I actually looked at this recently but for the complete opposite reason.

I saw a problem recently with binding to an xml root (just a normal binding
as the top level reference to the XML instance) for generated code. The
compiler was trying to generate both the normal binding *and* the XML
binding I think (it was the xml binding which was causing the problem). I
only wanted the regular binding, so I coded around it, but made a note to
come back and look at it later.

I never ever used XML bindings in Flex, and even now I would probably
choose to avoid them (by preference) if I was doing something in Flex (or
Royale).
I assum support for that that uses mx.binding.XMLNotifier in Flex as well
as XMLWatcher.
And relies on something we do not yet have (because I think it is not well
known) :
http://www.docsultant.com/site2/articles/flex_internals.html#xmlNotify

I have not looked into what it would take to emulate this. We might want to
consider whether Serkan's case is typical and needs supporting, or whether
it is best to address it as a workaround.










On Sat, May 9, 2020 at 4:57 PM Alex Harui <ah...@adobe.com.invalid> wrote:

> Mostly to Greg and Harbs,
>
> Have you guys seen watcher type "xml" in the DataBinding data when setting
> up watchers for XML DataBinding?  I'm trying to understand if you've seen
> it work.  The switch statement in DataBindingBase setupWatchers doesn't
> have a case for it.  That seems to be Serkan's problem in
> https://github.com/apache/royale-asjs/issues/819
>
> Thoughts?
> -Alex
>
>