You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Carlos Rovira <ca...@apache.org> on 2016/12/09 13:35:34 UTC

[FlexJS] How Binding works?

Hi

I need to know how to deal with data binding in different situations,
ItemRenderer, View, Container, Component, Bead,...

I saw various classes ConstantBinding, ViewBeadBinding...

Hope someone could share the main principles of Binding in FlexJS

Thanks

-- 
Carlos Rovira
http://about.me/carlosrovira

Re: [FlexJS] How Binding works?

Posted by piotrz <pi...@gmail.com>.
Just found this thread. I see that for Carlos binding was also didn't work in
item renderer. I did deeper investigation and look into List and ComboBox
html package. I think for those components there is a bug or something is
not implemented yet.

Let's take look in ComboBox where I have simple code:
https://paste.apache.org/TYEr - It's not working my property selectedItem
won't fill when I change items in ComboBox.

ComboBox class has for "selectedItem":

[Bindable("change")]
public function get selectedItem():Object { } - It's ok, but it isn't
dispatched anywhere - Should it be dispatched from ComboBoxView or Model ? I
think from Model.

Same situation is for List - it doesn't even have this Bindable("change") -
I think we should agree on one direction - what should be exposed to the
user.

Models can expose different events (selectedIndexChanged etc.) - cause In
most cases Model notify -> ComboBoxView, ListView.

Example of solution:

ArraySelectionModel dispatch -> dispatchEvent(new
Event("selectedIndexChanged"));
ComboBoxView listen to this and do some UI changes

Case 1) ComboBox, List listen to this event dispatched from Model
[Bindable("selectedIndexChanged")
public function get selectedItem():Object
		{
			return IComboBoxModel(model).selectedItem;
		}

Case 2) ComboBox, List listen to "change" dispatched by ArraySelectionModel
dispatchEvent(new Event("selectedIndexChanged")); - View is doing something 
dispatchEvent(new Event("change")); - ComboBox, List class is doing
something - event exposed to the end user

[Bindable("change")
public function get selectedItem():Object
		{
			return IComboBoxModel(model).selectedItem;
		}


If we agree on this and I'm not wrong with my assumption and this is a bug I
can provide fix for both components.

Piotr





-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-How-Binding-works-tp57096p57777.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com>.

On 12/9/16, 2:45 PM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:
>
>@Alex, as you mentioned the current IR is not working. So I think, I'll
>continue with the raw version as I understand you need to fix some
>internals. Thanks

This appears to be working now.

-Alex


Re: [FlexJS] How Binding works?

Posted by Christofer Dutz <ch...@c-ware.de>.
Ah oh ... then I mixed up two things ;-)

The way I changed the maven plugin to allow setting of failure on warning is deffinitely the way to go, but there are other problems causing the warning to appear in the first place. 

So I’ll leave things the way they are now.

Chris


Am 10.12.16, 11:11 schrieb "carlos.rovira@gmail.com im Auftrag von Carlos Rovira" <carlos.rovira@gmail.com im Auftrag von carlos.rovira@codeoscopic.com>:

    Hi Chris, VO = ValueObject a simple class to carry data.
    I tried to say that the fix is needed since we want sometimes to quick
    prototype and we can't always introducing ValueObjects. But I`ll introduced
    that VOs for my example in MDL since I'm trying to create components that
    adhiere to best practices.
    
    
    2016-12-10 9:18 GMT+01:00 Christofer Dutz <ch...@c-ware.de>:
    
    > hi Carlos,
    >
    > What  do you mean with VO? What does that abbreviation stand for?
    >
    > Chris
    >
    >
    >
    > Von meinem Samsung Galaxy Smartphone gesendet.
    >
    >
    > -------- Ursprüngliche Nachricht --------
    > Von: Carlos Rovira <ca...@codeoscopic.com>
    > Datum: 09.12.16 23:46 (GMT+01:00)
    > An: dev@flex.apache.org
    > Betreff: Re: [FlexJS] How Binding works?
    >
    > Hi,
    >
    > @Chris, Thanks for the quick fix, I tested it and it works now without.
    > Although I think as Alex that a VO is better, I think that is not related
    > to get the build working although there's a warning. Thanks! :)
    >
    > @Alex, as you mentioned the current IR is not working. So I think, I'll
    > continue with the raw version as I understand you need to fix some
    > internals. Thanks
    >
    >
    >
    >
    > 2016-12-09 23:06 GMT+01:00 Christofer Dutz <ch...@c-ware.de>:
    >
    > > So I just pushed a new version which allows configuring if the build
    > > should fail on warnings (default is false)
    > >
    > > Chris
    > >
    > > Am 09.12.16, 22:40 schrieb "Christofer Dutz" <christofer.dutz@c-ware.de
    > >:
    > >
    > >     Ok ... for now 2 is ok ... I’ll probably just add a config option to
    > > allow „fail on warnings“ which defaults to false and can be turned on if
    > > required.
    > >
    > >     Chris
    > >
    > >     Am 09.12.16, 22:31 schrieb "Alex Harui" <ah...@adobe.com>:
    > >
    > >
    > >
    > >         On 12/9/16, 1:08 PM, "Christofer Dutz" <
    > christofer.dutz@c-ware.de>
    > > wrote:
    > >
    > >         >I just comitted a fix that doesn’t make the build fail on a
    > > return code
    > >         >of 2 (Didn’t know that 2 was also ok)
    > >
    > >         I think 2 means that there were warnings but no errors.  That
    > > gives folks
    > >         the option of failing on warnings if they do have a "no warnings"
    > > policy.
    > >         In Ant, I use a Fail ant task to check for and allow both values.
    > > Someone
    > >         can not do that and just fail on any non-zero which would fail if
    > > there
    > >         were warnings.
    > >
    > >         I don't know why the compilers do that.  Maybe they should have
    > an
    > > option
    > >         instead.  I think Java compiler has it as an option.
    > >
    > >         Thanks,
    > >         -Alex
    > >
    > >
    > >
    > >
    > >
    > >
    >
    >
    > --
    >
    > Carlos Rovira
    > Director General
    > M: +34 607 22 60 05
    > http://www.codeoscopic.com
    > http://www.avant2.es
    >
    > Este mensaje se dirige exclusivamente a su destinatario y puede contener
    > información privilegiada o confidencial. Si ha recibido este mensaje por
    > error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
    > proceda a su destrucción.
    >
    > De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
    > que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
    > S.A. La finalidad de dicho tratamiento es facilitar la prestación del
    > servicio o información solicitados, teniendo usted derecho de acceso,
    > rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
    > oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
    > necesaria.
    >
    
    
    
    -- 
    
    Carlos Rovira
    Director General
    M: +34 607 22 60 05
    http://www.codeoscopic.com
    http://www.avant2.es
    
    Este mensaje se dirige exclusivamente a su destinatario y puede contener
    información privilegiada o confidencial. Si ha recibido este mensaje por
    error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
    proceda a su destrucción.
    
    De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
    que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
    S.A. La finalidad de dicho tratamiento es facilitar la prestación del
    servicio o información solicitados, teniendo usted derecho de acceso,
    rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
    oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
    necesaria.
    


Re: [FlexJS] How Binding works?

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Hi Chris, VO = ValueObject a simple class to carry data.
I tried to say that the fix is needed since we want sometimes to quick
prototype and we can't always introducing ValueObjects. But I`ll introduced
that VOs for my example in MDL since I'm trying to create components that
adhiere to best practices.


2016-12-10 9:18 GMT+01:00 Christofer Dutz <ch...@c-ware.de>:

> hi Carlos,
>
> What  do you mean with VO? What does that abbreviation stand for?
>
> Chris
>
>
>
> Von meinem Samsung Galaxy Smartphone gesendet.
>
>
> -------- Ursprüngliche Nachricht --------
> Von: Carlos Rovira <ca...@codeoscopic.com>
> Datum: 09.12.16 23:46 (GMT+01:00)
> An: dev@flex.apache.org
> Betreff: Re: [FlexJS] How Binding works?
>
> Hi,
>
> @Chris, Thanks for the quick fix, I tested it and it works now without.
> Although I think as Alex that a VO is better, I think that is not related
> to get the build working although there's a warning. Thanks! :)
>
> @Alex, as you mentioned the current IR is not working. So I think, I'll
> continue with the raw version as I understand you need to fix some
> internals. Thanks
>
>
>
>
> 2016-12-09 23:06 GMT+01:00 Christofer Dutz <ch...@c-ware.de>:
>
> > So I just pushed a new version which allows configuring if the build
> > should fail on warnings (default is false)
> >
> > Chris
> >
> > Am 09.12.16, 22:40 schrieb "Christofer Dutz" <christofer.dutz@c-ware.de
> >:
> >
> >     Ok ... for now 2 is ok ... I’ll probably just add a config option to
> > allow „fail on warnings“ which defaults to false and can be turned on if
> > required.
> >
> >     Chris
> >
> >     Am 09.12.16, 22:31 schrieb "Alex Harui" <ah...@adobe.com>:
> >
> >
> >
> >         On 12/9/16, 1:08 PM, "Christofer Dutz" <
> christofer.dutz@c-ware.de>
> > wrote:
> >
> >         >I just comitted a fix that doesn’t make the build fail on a
> > return code
> >         >of 2 (Didn’t know that 2 was also ok)
> >
> >         I think 2 means that there were warnings but no errors.  That
> > gives folks
> >         the option of failing on warnings if they do have a "no warnings"
> > policy.
> >         In Ant, I use a Fail ant task to check for and allow both values.
> > Someone
> >         can not do that and just fail on any non-zero which would fail if
> > there
> >         were warnings.
> >
> >         I don't know why the compilers do that.  Maybe they should have
> an
> > option
> >         instead.  I think Java compiler has it as an option.
> >
> >         Thanks,
> >         -Alex
> >
> >
> >
> >
> >
> >
>
>
> --
>
> Carlos Rovira
> Director General
> M: +34 607 22 60 05
> http://www.codeoscopic.com
> http://www.avant2.es
>
> Este mensaje se dirige exclusivamente a su destinatario y puede contener
> información privilegiada o confidencial. Si ha recibido este mensaje por
> error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> proceda a su destrucción.
>
> De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
> que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> servicio o información solicitados, teniendo usted derecho de acceso,
> rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
> oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> necesaria.
>



-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

AW: [FlexJS] How Binding works?

Posted by Christofer Dutz <ch...@c-ware.de>.
hi Carlos,

What  do you mean with VO? What does that abbreviation stand for?

Chris



Von meinem Samsung Galaxy Smartphone gesendet.


-------- Ursprüngliche Nachricht --------
Von: Carlos Rovira <ca...@codeoscopic.com>
Datum: 09.12.16 23:46 (GMT+01:00)
An: dev@flex.apache.org
Betreff: Re: [FlexJS] How Binding works?

Hi,

@Chris, Thanks for the quick fix, I tested it and it works now without.
Although I think as Alex that a VO is better, I think that is not related
to get the build working although there's a warning. Thanks! :)

@Alex, as you mentioned the current IR is not working. So I think, I'll
continue with the raw version as I understand you need to fix some
internals. Thanks




2016-12-09 23:06 GMT+01:00 Christofer Dutz <ch...@c-ware.de>:

> So I just pushed a new version which allows configuring if the build
> should fail on warnings (default is false)
>
> Chris
>
> Am 09.12.16, 22:40 schrieb "Christofer Dutz" <ch...@c-ware.de>:
>
>     Ok ... for now 2 is ok ... I’ll probably just add a config option to
> allow „fail on warnings“ which defaults to false and can be turned on if
> required.
>
>     Chris
>
>     Am 09.12.16, 22:31 schrieb "Alex Harui" <ah...@adobe.com>:
>
>
>
>         On 12/9/16, 1:08 PM, "Christofer Dutz" <ch...@c-ware.de>
> wrote:
>
>         >I just comitted a fix that doesn’t make the build fail on a
> return code
>         >of 2 (Didn’t know that 2 was also ok)
>
>         I think 2 means that there were warnings but no errors.  That
> gives folks
>         the option of failing on warnings if they do have a "no warnings"
> policy.
>         In Ant, I use a Fail ant task to check for and allow both values.
> Someone
>         can not do that and just fail on any non-zero which would fail if
> there
>         were warnings.
>
>         I don't know why the compilers do that.  Maybe they should have an
> option
>         instead.  I think Java compiler has it as an option.
>
>         Thanks,
>         -Alex
>
>
>
>
>
>


--

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Re: [FlexJS] How Binding works?

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Hi,

@Chris, Thanks for the quick fix, I tested it and it works now without.
Although I think as Alex that a VO is better, I think that is not related
to get the build working although there's a warning. Thanks! :)

@Alex, as you mentioned the current IR is not working. So I think, I'll
continue with the raw version as I understand you need to fix some
internals. Thanks




2016-12-09 23:06 GMT+01:00 Christofer Dutz <ch...@c-ware.de>:

> So I just pushed a new version which allows configuring if the build
> should fail on warnings (default is false)
>
> Chris
>
> Am 09.12.16, 22:40 schrieb "Christofer Dutz" <ch...@c-ware.de>:
>
>     Ok ... for now 2 is ok ... I’ll probably just add a config option to
> allow „fail on warnings“ which defaults to false and can be turned on if
> required.
>
>     Chris
>
>     Am 09.12.16, 22:31 schrieb "Alex Harui" <ah...@adobe.com>:
>
>
>
>         On 12/9/16, 1:08 PM, "Christofer Dutz" <ch...@c-ware.de>
> wrote:
>
>         >I just comitted a fix that doesn’t make the build fail on a
> return code
>         >of 2 (Didn’t know that 2 was also ok)
>
>         I think 2 means that there were warnings but no errors.  That
> gives folks
>         the option of failing on warnings if they do have a "no warnings"
> policy.
>         In Ant, I use a Fail ant task to check for and allow both values.
> Someone
>         can not do that and just fail on any non-zero which would fail if
> there
>         were warnings.
>
>         I don't know why the compilers do that.  Maybe they should have an
> option
>         instead.  I think Java compiler has it as an option.
>
>         Thanks,
>         -Alex
>
>
>
>
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Re: [FlexJS] How Binding works?

Posted by Christofer Dutz <ch...@c-ware.de>.
So I just pushed a new version which allows configuring if the build should fail on warnings (default is false)

Chris

Am 09.12.16, 22:40 schrieb "Christofer Dutz" <ch...@c-ware.de>:

    Ok ... for now 2 is ok ... I’ll probably just add a config option to allow „fail on warnings“ which defaults to false and can be turned on if required.
    
    Chris
    
    Am 09.12.16, 22:31 schrieb "Alex Harui" <ah...@adobe.com>:
    
        
        
        On 12/9/16, 1:08 PM, "Christofer Dutz" <ch...@c-ware.de> wrote:
        
        >I just comitted a fix that doesn’t make the build fail on a return code
        >of 2 (Didn’t know that 2 was also ok)
        
        I think 2 means that there were warnings but no errors.  That gives folks
        the option of failing on warnings if they do have a "no warnings" policy.
        In Ant, I use a Fail ant task to check for and allow both values.  Someone
        can not do that and just fail on any non-zero which would fail if there
        were warnings.
        
        I don't know why the compilers do that.  Maybe they should have an option
        instead.  I think Java compiler has it as an option.
        
        Thanks,
        -Alex
        
        
    
    


Re: [FlexJS] How Binding works?

Posted by Christofer Dutz <ch...@c-ware.de>.
Ok ... for now 2 is ok ... I’ll probably just add a config option to allow „fail on warnings“ which defaults to false and can be turned on if required.

Chris

Am 09.12.16, 22:31 schrieb "Alex Harui" <ah...@adobe.com>:

    
    
    On 12/9/16, 1:08 PM, "Christofer Dutz" <ch...@c-ware.de> wrote:
    
    >I just comitted a fix that doesn’t make the build fail on a return code
    >of 2 (Didn’t know that 2 was also ok)
    
    I think 2 means that there were warnings but no errors.  That gives folks
    the option of failing on warnings if they do have a "no warnings" policy.
    In Ant, I use a Fail ant task to check for and allow both values.  Someone
    can not do that and just fail on any non-zero which would fail if there
    were warnings.
    
    I don't know why the compilers do that.  Maybe they should have an option
    instead.  I think Java compiler has it as an option.
    
    Thanks,
    -Alex
    
    


Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com>.

On 12/9/16, 1:08 PM, "Christofer Dutz" <ch...@c-ware.de> wrote:

>I just comitted a fix that doesn’t make the build fail on a return code
>of 2 (Didn’t know that 2 was also ok)

I think 2 means that there were warnings but no errors.  That gives folks
the option of failing on warnings if they do have a "no warnings" policy.
In Ant, I use a Fail ant task to check for and allow both values.  Someone
can not do that and just fail on any non-zero which would fail if there
were warnings.

I don't know why the compilers do that.  Maybe they should have an option
instead.  I think Java compiler has it as an option.

Thanks,
-Alex


Re: [FlexJS] How Binding works?

Posted by Christofer Dutz <ch...@c-ware.de>.
I just comitted a fix that doesn’t make the build fail on a return code of 2 (Didn’t know that 2 was also ok)

Should work now without modifying anything.

Chris

Am 09.12.16, 22:06 schrieb "Alex Harui" <ah...@adobe.com>:

    The configs are the same regarding warnings.  The warnings are output in
    both Ant and Maven.  Let's use the other thread to try to work through
    this.
    
    -Alex
    
    On 12/9/16, 12:55 PM, "Christofer Dutz" <ch...@c-ware.de> wrote:
    
    >Hi Carlos,
    >
    >they are all in:
    >flexjs-compiler/flexjs-maven-plugin/src/main/resources/config
    >
    >Depending on the type of compilation different templates are used.
    >
    >Chris
    >
    >
    >Am 09.12.16, 21:05 schrieb "carlos.rovira@gmail.com im Auftrag von Carlos
    >Rovira" <carlos.rovira@gmail.com im Auftrag von
    >carlos.rovira@codeoscopic.com>:
    >
    >    Thanks Chris, I'm searching for config, but still don't know what
    >file I
    >    should look. Could you share a path and concrete file to look for?
    >thanks
    >    
    >    2016-12-09 20:56 GMT+01:00 Christofer Dutz
    ><ch...@c-ware.de>:
    >    
    >    > In general you could tweak the config-xml templates which are part
    >of the
    >    > flexjs-maven-plugin.
    >    > After all probably the Ant version simply has different defaults
    >here. I
    >    > think they should be reported as warnings, but not break the build.
    >(In
    >    > that particular type of problem).
    >    >
    >    > Chris
    >    >
    >    >
    >    >
    >    > Am 09.12.16, 17:48 schrieb "Alex Harui" <ah...@adobe.com>:
    >    >
    >    >     Well, that is a legitimate warning, but is innocuous.  I'm
    >tempted to
    >    > try
    >    >     to figure out how to tell Maven to accept these warnings, but I
    >don't
    >    > know
    >    >     how to do that.  That's why the Ant builds work.  Or get the
    >compiler
    >    > to
    >    >     suppress the warning.
    >    >
    >    >     The other answer is to switch to ValueObjects if you are just
    >using
    >    > plain
    >    >     Object.  Then your binding expression would look like
    >    >     "{MyValueObject(data).label}.  MyValueObject would have to have
    >the
    >    >     appropriate [Bindable] metadata.
    >    >
    >    >     -Alex
    >    >
    >    >     On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of
    >Carlos
    >    > Rovira"
    >    >     <carlos.rovira@gmail.com on behalf of
    >carlos.rovira@codeoscopic.com>
    >    > wrote:
    >    >
    >    >     >Hi Alex,
    >    >     >
    >    >     >just updated all commits and test your ItemRenderer and is not
    >    > working, do
    >    >     >you know what could be?
    >    >     >
    >    >     >The project 'App' has been successfully compiled and optimized.
    >    >     >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/
    >    > examples/flexjs/MDLEx
    >    >     
    >>ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
    >    >     >col: 12 Data binding will not be able to detect assignments to
    >    > 'label'.
    >    >     >text="{data.label}" >
    >    >     >           ^
    >    >     >[INFO]
    >    >     >-----------------------------------------------------------
    >    > -------------
    >    >     >[INFO] BUILD FAILURE
    >    >     >
    >    >     >
    >    >     >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
    >    >     >
    >    >     >>
    >    >     >>
    >    >     >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of
    >Carlos
    >    >     >>Rovira"
    >    >     >> <carlos.rovira@gmail.com on behalf of
    >carlosrovira@apache.org>
    >    > wrote:
    >    >     >>
    >    >     >> >Hi
    >    >     >> >
    >    >     >> >I need to know how to deal with data binding in different
    >    > situations,
    >    >     >> >ItemRenderer, View, Container, Component, Bead,...
    >    >     >> >
    >    >     >> >I saw various classes ConstantBinding, ViewBeadBinding...
    >    >     >> >
    >    >     >> >Hope someone could share the main principles of Binding in
    >FlexJS
    >    >     >>
    >    >     >> Binding in the regular Flex SDK is extremely wasteful.
    >That's why
    >    > we
    >    >     >> often see folks recommend that you start taking out data
    >bindings
    >    > when
    >    >     >>you
    >    >     >> have performance issues.  Flex Mobile default item renderers
    >are
    >    > written
    >    >     >> in AS instead of MXML for that reason. Binding in general
    >has to
    >    >     >> "highly-sensitive".  It needs to look for all kinds of
    >possible
    >    > change
    >    >     >> conditions, such as the source or destination being changed
    >as well
    >    > as
    >    >     >>the
    >    >     >> property on the source being changed.  In the regular Flex
    >SDK, this
    >    >     >> highly-sensitive detection mechanism is used everywhere you
    >use
    >    > binding
    >    >     >> expressions.
    >    >     >>
    >    >     >> in FlexJS, we want to have different implementations based on
    >    > certain
    >    >     >> scenarios.  There are classes named XXXDataBinding (vs
    >YYYBinding)
    >    > that
    >    >     >> implement a change detection mechanism specific to that
    >scenario.
    >    > So
    >    >     >> ViewDataBinding knows that most data bindings will probably
    >be from
    >    > the
    >    >     >> applicationModel property to various controls.  The various
    >    >     >>XXXDataBinding
    >    >     >> implementations use the YYYBinding classes like
    >ConstantBinding and
    >    >     >> SimpleBinding to optimize for certain patterns that don't
    >require as
    >    >     >>much
    >    >     >> overhead to set up.  There is a GenericBinding for
    >everything else.
    >    >     >>Also,
    >    >     >> having a choice of YYYBinding classes allows the developer
    >to not
    >    > use {}
    >    >     >> expressions and simply add a YYYBindingClass as a bead and
    >get
    >    > binding
    >    >     >>to
    >    >     >> work without the overhead of the compiler setting up a data
    >    > structure
    >    >     >>for
    >    >     >> the XXXDataBindingClass to interpret at instantiation time.
    >So,
    >    > this is
    >    >     >> another example of PAYG.  You can be lazy and have the
    >compiler and
    >    >     >> framework figure out what to do with a {} expression, or you
    >can
    >    > save
    >    >     >>code
    >    >     >> by manually implementing it, or you can save even more by
    >writing
    >    > AS to
    >    >     >> addEventListener for the right thing at the right time.
    >    >     >>
    >    >     >> Anyway, you mentioned ItemRenderer above, and I found out
    >yesterday
    >    > that
    >    >     >> ItemRenderer binding needed its own implementation.  It can
    >take
    >    >     >>advantage
    >    >     >> of knowing that if you bind to data.something, that there is
    >no
    >    > need to
    >    >     >> set change detection for the source or destination objects.
    >It
    >    > knows
    >    >     >>that
    >    >     >> the only trigger is when in the item renderer lifecycle, the
    >data
    >    >     >>property
    >    >     >> is set.  I just pushed that change.  Now my renderer looks
    >like:
    >    >     >>
    >    >     >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
    >    >     >>      
    >xmlns:js="library://ns.apache.org/flexjs/basic
    >    > "
    >    >     >>                      width="100%">
    >    >     >> <js:beads>
    >    >     >>         <js:VerticalLayout />
    >    >     >>         <js:ItemRendererDataBinding />
    >    >     >>     </js:beads>
    >    >     >>     <js:Label width="100%" height="30"
    >style="fontWeight:bold"
    >    >     >> text="{data.qname}" >
    >    >     >>     </js:Label>
    >    >     >>     <js:MultilineLabel id="description" width="100%"
    >    >     >> text="{data.description}" />
    >    >     >> </js:MXMLItemRenderer>
    >    >     >>
    >    >     >>
    >    >     >>
    >    >     >> HTH,
    >    >     >> -Alex
    >    >     >>
    >    >     >>
    >    >     >
    >    >     >
    >    >     >--
    >    >     >
    >    >     >Carlos Rovira
    >    >     >Director General
    >    >     >M: +34 607 22 60 05
    >    >     >http://www.codeoscopic.com
    >    >     >http://www.avant2.es
    >    >     >
    >    >     >Este mensaje se dirige exclusivamente a su destinatario y puede
    >    > contener
    >    >     >información privilegiada o confidencial. Si ha recibido este
    >mensaje
    >    > por
    >    >     >error, le rogamos que nos lo comunique inmediatamente por esta
    >misma
    >    > vía y
    >    >     >proceda a su destrucción.
    >    >     >
    >    >     >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
    >    >     >comunicamos
    >    >     >que sus datos forman parte de un fichero cuyo responsable es
    >    > CODEOSCOPIC
    >    >     >S.A. La finalidad de dicho tratamiento es facilitar la
    >prestación del
    >    >     >servicio o información solicitados, teniendo usted derecho de
    >acceso,
    >    >     >rectificación, cancelación y oposición de sus datos
    >dirigiéndose a
    >    >     >nuestras
    >    >     >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la
    >    > documentación
    >    >     >necesaria.
    >    >
    >    >
    >    >
    >    >
    >    
    >    
    >    -- 
    >    
    >    Carlos Rovira
    >    Director General
    >    M: +34 607 22 60 05
    >    http://www.codeoscopic.com
    >    http://www.avant2.es
    >    
    >    Este mensaje se dirige exclusivamente a su destinatario y puede
    >contener
    >    información privilegiada o confidencial. Si ha recibido este mensaje
    >por
    >    error, le rogamos que nos lo comunique inmediatamente por esta misma
    >vía y
    >    proceda a su destrucción.
    >    
    >    De la vigente Ley Orgánica de Protección de Datos (15/1999), le
    >comunicamos
    >    que sus datos forman parte de un fichero cuyo responsable es
    >CODEOSCOPIC
    >    S.A. La finalidad de dicho tratamiento es facilitar la prestación del
    >    servicio o información solicitados, teniendo usted derecho de acceso,
    >    rectificación, cancelación y oposición de sus datos dirigiéndose a
    >nuestras
    >    oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la
    >documentación
    >    necesaria.
    >    
    >
    
    


Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com>.
The configs are the same regarding warnings.  The warnings are output in
both Ant and Maven.  Let's use the other thread to try to work through
this.

-Alex

On 12/9/16, 12:55 PM, "Christofer Dutz" <ch...@c-ware.de> wrote:

>Hi Carlos,
>
>they are all in:
>flexjs-compiler/flexjs-maven-plugin/src/main/resources/config
>
>Depending on the type of compilation different templates are used.
>
>Chris
>
>
>Am 09.12.16, 21:05 schrieb "carlos.rovira@gmail.com im Auftrag von Carlos
>Rovira" <carlos.rovira@gmail.com im Auftrag von
>carlos.rovira@codeoscopic.com>:
>
>    Thanks Chris, I'm searching for config, but still don't know what
>file I
>    should look. Could you share a path and concrete file to look for?
>thanks
>    
>    2016-12-09 20:56 GMT+01:00 Christofer Dutz
><ch...@c-ware.de>:
>    
>    > In general you could tweak the config-xml templates which are part
>of the
>    > flexjs-maven-plugin.
>    > After all probably the Ant version simply has different defaults
>here. I
>    > think they should be reported as warnings, but not break the build.
>(In
>    > that particular type of problem).
>    >
>    > Chris
>    >
>    >
>    >
>    > Am 09.12.16, 17:48 schrieb "Alex Harui" <ah...@adobe.com>:
>    >
>    >     Well, that is a legitimate warning, but is innocuous.  I'm
>tempted to
>    > try
>    >     to figure out how to tell Maven to accept these warnings, but I
>don't
>    > know
>    >     how to do that.  That's why the Ant builds work.  Or get the
>compiler
>    > to
>    >     suppress the warning.
>    >
>    >     The other answer is to switch to ValueObjects if you are just
>using
>    > plain
>    >     Object.  Then your binding expression would look like
>    >     "{MyValueObject(data).label}.  MyValueObject would have to have
>the
>    >     appropriate [Bindable] metadata.
>    >
>    >     -Alex
>    >
>    >     On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of
>Carlos
>    > Rovira"
>    >     <carlos.rovira@gmail.com on behalf of
>carlos.rovira@codeoscopic.com>
>    > wrote:
>    >
>    >     >Hi Alex,
>    >     >
>    >     >just updated all commits and test your ItemRenderer and is not
>    > working, do
>    >     >you know what could be?
>    >     >
>    >     >The project 'App' has been successfully compiled and optimized.
>    >     >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/
>    > examples/flexjs/MDLEx
>    >     
>>ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
>    >     >col: 12 Data binding will not be able to detect assignments to
>    > 'label'.
>    >     >text="{data.label}" >
>    >     >           ^
>    >     >[INFO]
>    >     >-----------------------------------------------------------
>    > -------------
>    >     >[INFO] BUILD FAILURE
>    >     >
>    >     >
>    >     >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
>    >     >
>    >     >>
>    >     >>
>    >     >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of
>Carlos
>    >     >>Rovira"
>    >     >> <carlos.rovira@gmail.com on behalf of
>carlosrovira@apache.org>
>    > wrote:
>    >     >>
>    >     >> >Hi
>    >     >> >
>    >     >> >I need to know how to deal with data binding in different
>    > situations,
>    >     >> >ItemRenderer, View, Container, Component, Bead,...
>    >     >> >
>    >     >> >I saw various classes ConstantBinding, ViewBeadBinding...
>    >     >> >
>    >     >> >Hope someone could share the main principles of Binding in
>FlexJS
>    >     >>
>    >     >> Binding in the regular Flex SDK is extremely wasteful.
>That's why
>    > we
>    >     >> often see folks recommend that you start taking out data
>bindings
>    > when
>    >     >>you
>    >     >> have performance issues.  Flex Mobile default item renderers
>are
>    > written
>    >     >> in AS instead of MXML for that reason. Binding in general
>has to
>    >     >> "highly-sensitive".  It needs to look for all kinds of
>possible
>    > change
>    >     >> conditions, such as the source or destination being changed
>as well
>    > as
>    >     >>the
>    >     >> property on the source being changed.  In the regular Flex
>SDK, this
>    >     >> highly-sensitive detection mechanism is used everywhere you
>use
>    > binding
>    >     >> expressions.
>    >     >>
>    >     >> in FlexJS, we want to have different implementations based on
>    > certain
>    >     >> scenarios.  There are classes named XXXDataBinding (vs
>YYYBinding)
>    > that
>    >     >> implement a change detection mechanism specific to that
>scenario.
>    > So
>    >     >> ViewDataBinding knows that most data bindings will probably
>be from
>    > the
>    >     >> applicationModel property to various controls.  The various
>    >     >>XXXDataBinding
>    >     >> implementations use the YYYBinding classes like
>ConstantBinding and
>    >     >> SimpleBinding to optimize for certain patterns that don't
>require as
>    >     >>much
>    >     >> overhead to set up.  There is a GenericBinding for
>everything else.
>    >     >>Also,
>    >     >> having a choice of YYYBinding classes allows the developer
>to not
>    > use {}
>    >     >> expressions and simply add a YYYBindingClass as a bead and
>get
>    > binding
>    >     >>to
>    >     >> work without the overhead of the compiler setting up a data
>    > structure
>    >     >>for
>    >     >> the XXXDataBindingClass to interpret at instantiation time.
>So,
>    > this is
>    >     >> another example of PAYG.  You can be lazy and have the
>compiler and
>    >     >> framework figure out what to do with a {} expression, or you
>can
>    > save
>    >     >>code
>    >     >> by manually implementing it, or you can save even more by
>writing
>    > AS to
>    >     >> addEventListener for the right thing at the right time.
>    >     >>
>    >     >> Anyway, you mentioned ItemRenderer above, and I found out
>yesterday
>    > that
>    >     >> ItemRenderer binding needed its own implementation.  It can
>take
>    >     >>advantage
>    >     >> of knowing that if you bind to data.something, that there is
>no
>    > need to
>    >     >> set change detection for the source or destination objects.
>It
>    > knows
>    >     >>that
>    >     >> the only trigger is when in the item renderer lifecycle, the
>data
>    >     >>property
>    >     >> is set.  I just pushed that change.  Now my renderer looks
>like:
>    >     >>
>    >     >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>    >     >>      
>xmlns:js="library://ns.apache.org/flexjs/basic
>    > "
>    >     >>                      width="100%">
>    >     >> <js:beads>
>    >     >>         <js:VerticalLayout />
>    >     >>         <js:ItemRendererDataBinding />
>    >     >>     </js:beads>
>    >     >>     <js:Label width="100%" height="30"
>style="fontWeight:bold"
>    >     >> text="{data.qname}" >
>    >     >>     </js:Label>
>    >     >>     <js:MultilineLabel id="description" width="100%"
>    >     >> text="{data.description}" />
>    >     >> </js:MXMLItemRenderer>
>    >     >>
>    >     >>
>    >     >>
>    >     >> HTH,
>    >     >> -Alex
>    >     >>
>    >     >>
>    >     >
>    >     >
>    >     >--
>    >     >
>    >     >Carlos Rovira
>    >     >Director General
>    >     >M: +34 607 22 60 05
>    >     >http://www.codeoscopic.com
>    >     >http://www.avant2.es
>    >     >
>    >     >Este mensaje se dirige exclusivamente a su destinatario y puede
>    > contener
>    >     >información privilegiada o confidencial. Si ha recibido este
>mensaje
>    > por
>    >     >error, le rogamos que nos lo comunique inmediatamente por esta
>misma
>    > vía y
>    >     >proceda a su destrucción.
>    >     >
>    >     >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>    >     >comunicamos
>    >     >que sus datos forman parte de un fichero cuyo responsable es
>    > CODEOSCOPIC
>    >     >S.A. La finalidad de dicho tratamiento es facilitar la
>prestación del
>    >     >servicio o información solicitados, teniendo usted derecho de
>acceso,
>    >     >rectificación, cancelación y oposición de sus datos
>dirigiéndose a
>    >     >nuestras
>    >     >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la
>    > documentación
>    >     >necesaria.
>    >
>    >
>    >
>    >
>    
>    
>    -- 
>    
>    Carlos Rovira
>    Director General
>    M: +34 607 22 60 05
>    http://www.codeoscopic.com
>    http://www.avant2.es
>    
>    Este mensaje se dirige exclusivamente a su destinatario y puede
>contener
>    información privilegiada o confidencial. Si ha recibido este mensaje
>por
>    error, le rogamos que nos lo comunique inmediatamente por esta misma
>vía y
>    proceda a su destrucción.
>    
>    De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>comunicamos
>    que sus datos forman parte de un fichero cuyo responsable es
>CODEOSCOPIC
>    S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>    servicio o información solicitados, teniendo usted derecho de acceso,
>    rectificación, cancelación y oposición de sus datos dirigiéndose a
>nuestras
>    oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la
>documentación
>    necesaria.
>    
>


Re: [FlexJS] How Binding works?

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Carlos,

they are all in:
flexjs-compiler/flexjs-maven-plugin/src/main/resources/config

Depending on the type of compilation different templates are used.

Chris


Am 09.12.16, 21:05 schrieb "carlos.rovira@gmail.com im Auftrag von Carlos Rovira" <carlos.rovira@gmail.com im Auftrag von carlos.rovira@codeoscopic.com>:

    Thanks Chris, I'm searching for config, but still don't know what file I
    should look. Could you share a path and concrete file to look for? thanks
    
    2016-12-09 20:56 GMT+01:00 Christofer Dutz <ch...@c-ware.de>:
    
    > In general you could tweak the config-xml templates which are part of the
    > flexjs-maven-plugin.
    > After all probably the Ant version simply has different defaults here. I
    > think they should be reported as warnings, but not break the build. (In
    > that particular type of problem).
    >
    > Chris
    >
    >
    >
    > Am 09.12.16, 17:48 schrieb "Alex Harui" <ah...@adobe.com>:
    >
    >     Well, that is a legitimate warning, but is innocuous.  I'm tempted to
    > try
    >     to figure out how to tell Maven to accept these warnings, but I don't
    > know
    >     how to do that.  That's why the Ant builds work.  Or get the compiler
    > to
    >     suppress the warning.
    >
    >     The other answer is to switch to ValueObjects if you are just using
    > plain
    >     Object.  Then your binding expression would look like
    >     "{MyValueObject(data).label}.  MyValueObject would have to have the
    >     appropriate [Bindable] metadata.
    >
    >     -Alex
    >
    >     On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of Carlos
    > Rovira"
    >     <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
    > wrote:
    >
    >     >Hi Alex,
    >     >
    >     >just updated all commits and test your ItemRenderer and is not
    > working, do
    >     >you know what could be?
    >     >
    >     >The project 'App' has been successfully compiled and optimized.
    >     >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/
    > examples/flexjs/MDLEx
    >     >ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
    >     >col: 12 Data binding will not be able to detect assignments to
    > 'label'.
    >     >text="{data.label}" >
    >     >           ^
    >     >[INFO]
    >     >-----------------------------------------------------------
    > -------------
    >     >[INFO] BUILD FAILURE
    >     >
    >     >
    >     >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
    >     >
    >     >>
    >     >>
    >     >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos
    >     >>Rovira"
    >     >> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org>
    > wrote:
    >     >>
    >     >> >Hi
    >     >> >
    >     >> >I need to know how to deal with data binding in different
    > situations,
    >     >> >ItemRenderer, View, Container, Component, Bead,...
    >     >> >
    >     >> >I saw various classes ConstantBinding, ViewBeadBinding...
    >     >> >
    >     >> >Hope someone could share the main principles of Binding in FlexJS
    >     >>
    >     >> Binding in the regular Flex SDK is extremely wasteful.  That's why
    > we
    >     >> often see folks recommend that you start taking out data bindings
    > when
    >     >>you
    >     >> have performance issues.  Flex Mobile default item renderers are
    > written
    >     >> in AS instead of MXML for that reason. Binding in general has to
    >     >> "highly-sensitive".  It needs to look for all kinds of possible
    > change
    >     >> conditions, such as the source or destination being changed as well
    > as
    >     >>the
    >     >> property on the source being changed.  In the regular Flex SDK, this
    >     >> highly-sensitive detection mechanism is used everywhere you use
    > binding
    >     >> expressions.
    >     >>
    >     >> in FlexJS, we want to have different implementations based on
    > certain
    >     >> scenarios.  There are classes named XXXDataBinding (vs YYYBinding)
    > that
    >     >> implement a change detection mechanism specific to that scenario.
    > So
    >     >> ViewDataBinding knows that most data bindings will probably be from
    > the
    >     >> applicationModel property to various controls.  The various
    >     >>XXXDataBinding
    >     >> implementations use the YYYBinding classes like ConstantBinding and
    >     >> SimpleBinding to optimize for certain patterns that don't require as
    >     >>much
    >     >> overhead to set up.  There is a GenericBinding for everything else.
    >     >>Also,
    >     >> having a choice of YYYBinding classes allows the developer to not
    > use {}
    >     >> expressions and simply add a YYYBindingClass as a bead and get
    > binding
    >     >>to
    >     >> work without the overhead of the compiler setting up a data
    > structure
    >     >>for
    >     >> the XXXDataBindingClass to interpret at instantiation time.  So,
    > this is
    >     >> another example of PAYG.  You can be lazy and have the compiler and
    >     >> framework figure out what to do with a {} expression, or you can
    > save
    >     >>code
    >     >> by manually implementing it, or you can save even more by writing
    > AS to
    >     >> addEventListener for the right thing at the right time.
    >     >>
    >     >> Anyway, you mentioned ItemRenderer above, and I found out yesterday
    > that
    >     >> ItemRenderer binding needed its own implementation.  It can take
    >     >>advantage
    >     >> of knowing that if you bind to data.something, that there is no
    > need to
    >     >> set change detection for the source or destination objects.  It
    > knows
    >     >>that
    >     >> the only trigger is when in the item renderer lifecycle, the data
    >     >>property
    >     >> is set.  I just pushed that change.  Now my renderer looks like:
    >     >>
    >     >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
    >     >>                      xmlns:js="library://ns.apache.org/flexjs/basic
    > "
    >     >>                      width="100%">
    >     >> <js:beads>
    >     >>         <js:VerticalLayout />
    >     >>         <js:ItemRendererDataBinding />
    >     >>     </js:beads>
    >     >>     <js:Label width="100%" height="30" style="fontWeight:bold"
    >     >> text="{data.qname}" >
    >     >>     </js:Label>
    >     >>     <js:MultilineLabel id="description" width="100%"
    >     >> text="{data.description}" />
    >     >> </js:MXMLItemRenderer>
    >     >>
    >     >>
    >     >>
    >     >> HTH,
    >     >> -Alex
    >     >>
    >     >>
    >     >
    >     >
    >     >--
    >     >
    >     >Carlos Rovira
    >     >Director General
    >     >M: +34 607 22 60 05
    >     >http://www.codeoscopic.com
    >     >http://www.avant2.es
    >     >
    >     >Este mensaje se dirige exclusivamente a su destinatario y puede
    > contener
    >     >información privilegiada o confidencial. Si ha recibido este mensaje
    > por
    >     >error, le rogamos que nos lo comunique inmediatamente por esta misma
    > vía y
    >     >proceda a su destrucción.
    >     >
    >     >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
    >     >comunicamos
    >     >que sus datos forman parte de un fichero cuyo responsable es
    > CODEOSCOPIC
    >     >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
    >     >servicio o información solicitados, teniendo usted derecho de acceso,
    >     >rectificación, cancelación y oposición de sus datos dirigiéndose a
    >     >nuestras
    >     >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la
    > documentación
    >     >necesaria.
    >
    >
    >
    >
    
    
    -- 
    
    Carlos Rovira
    Director General
    M: +34 607 22 60 05
    http://www.codeoscopic.com
    http://www.avant2.es
    
    Este mensaje se dirige exclusivamente a su destinatario y puede contener
    información privilegiada o confidencial. Si ha recibido este mensaje por
    error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
    proceda a su destrucción.
    
    De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
    que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
    S.A. La finalidad de dicho tratamiento es facilitar la prestación del
    servicio o información solicitados, teniendo usted derecho de acceso,
    rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
    oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
    necesaria.
    


Re: [FlexJS] How Binding works?

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Thanks Chris, I'm searching for config, but still don't know what file I
should look. Could you share a path and concrete file to look for? thanks

2016-12-09 20:56 GMT+01:00 Christofer Dutz <ch...@c-ware.de>:

> In general you could tweak the config-xml templates which are part of the
> flexjs-maven-plugin.
> After all probably the Ant version simply has different defaults here. I
> think they should be reported as warnings, but not break the build. (In
> that particular type of problem).
>
> Chris
>
>
>
> Am 09.12.16, 17:48 schrieb "Alex Harui" <ah...@adobe.com>:
>
>     Well, that is a legitimate warning, but is innocuous.  I'm tempted to
> try
>     to figure out how to tell Maven to accept these warnings, but I don't
> know
>     how to do that.  That's why the Ant builds work.  Or get the compiler
> to
>     suppress the warning.
>
>     The other answer is to switch to ValueObjects if you are just using
> plain
>     Object.  Then your binding expression would look like
>     "{MyValueObject(data).label}.  MyValueObject would have to have the
>     appropriate [Bindable] metadata.
>
>     -Alex
>
>     On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of Carlos
> Rovira"
>     <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
> wrote:
>
>     >Hi Alex,
>     >
>     >just updated all commits and test your ItemRenderer and is not
> working, do
>     >you know what could be?
>     >
>     >The project 'App' has been successfully compiled and optimized.
>     >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/
> examples/flexjs/MDLEx
>     >ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
>     >col: 12 Data binding will not be able to detect assignments to
> 'label'.
>     >text="{data.label}" >
>     >           ^
>     >[INFO]
>     >-----------------------------------------------------------
> -------------
>     >[INFO] BUILD FAILURE
>     >
>     >
>     >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
>     >
>     >>
>     >>
>     >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos
>     >>Rovira"
>     >> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org>
> wrote:
>     >>
>     >> >Hi
>     >> >
>     >> >I need to know how to deal with data binding in different
> situations,
>     >> >ItemRenderer, View, Container, Component, Bead,...
>     >> >
>     >> >I saw various classes ConstantBinding, ViewBeadBinding...
>     >> >
>     >> >Hope someone could share the main principles of Binding in FlexJS
>     >>
>     >> Binding in the regular Flex SDK is extremely wasteful.  That's why
> we
>     >> often see folks recommend that you start taking out data bindings
> when
>     >>you
>     >> have performance issues.  Flex Mobile default item renderers are
> written
>     >> in AS instead of MXML for that reason. Binding in general has to
>     >> "highly-sensitive".  It needs to look for all kinds of possible
> change
>     >> conditions, such as the source or destination being changed as well
> as
>     >>the
>     >> property on the source being changed.  In the regular Flex SDK, this
>     >> highly-sensitive detection mechanism is used everywhere you use
> binding
>     >> expressions.
>     >>
>     >> in FlexJS, we want to have different implementations based on
> certain
>     >> scenarios.  There are classes named XXXDataBinding (vs YYYBinding)
> that
>     >> implement a change detection mechanism specific to that scenario.
> So
>     >> ViewDataBinding knows that most data bindings will probably be from
> the
>     >> applicationModel property to various controls.  The various
>     >>XXXDataBinding
>     >> implementations use the YYYBinding classes like ConstantBinding and
>     >> SimpleBinding to optimize for certain patterns that don't require as
>     >>much
>     >> overhead to set up.  There is a GenericBinding for everything else.
>     >>Also,
>     >> having a choice of YYYBinding classes allows the developer to not
> use {}
>     >> expressions and simply add a YYYBindingClass as a bead and get
> binding
>     >>to
>     >> work without the overhead of the compiler setting up a data
> structure
>     >>for
>     >> the XXXDataBindingClass to interpret at instantiation time.  So,
> this is
>     >> another example of PAYG.  You can be lazy and have the compiler and
>     >> framework figure out what to do with a {} expression, or you can
> save
>     >>code
>     >> by manually implementing it, or you can save even more by writing
> AS to
>     >> addEventListener for the right thing at the right time.
>     >>
>     >> Anyway, you mentioned ItemRenderer above, and I found out yesterday
> that
>     >> ItemRenderer binding needed its own implementation.  It can take
>     >>advantage
>     >> of knowing that if you bind to data.something, that there is no
> need to
>     >> set change detection for the source or destination objects.  It
> knows
>     >>that
>     >> the only trigger is when in the item renderer lifecycle, the data
>     >>property
>     >> is set.  I just pushed that change.  Now my renderer looks like:
>     >>
>     >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>     >>                      xmlns:js="library://ns.apache.org/flexjs/basic
> "
>     >>                      width="100%">
>     >> <js:beads>
>     >>         <js:VerticalLayout />
>     >>         <js:ItemRendererDataBinding />
>     >>     </js:beads>
>     >>     <js:Label width="100%" height="30" style="fontWeight:bold"
>     >> text="{data.qname}" >
>     >>     </js:Label>
>     >>     <js:MultilineLabel id="description" width="100%"
>     >> text="{data.description}" />
>     >> </js:MXMLItemRenderer>
>     >>
>     >>
>     >>
>     >> HTH,
>     >> -Alex
>     >>
>     >>
>     >
>     >
>     >--
>     >
>     >Carlos Rovira
>     >Director General
>     >M: +34 607 22 60 05
>     >http://www.codeoscopic.com
>     >http://www.avant2.es
>     >
>     >Este mensaje se dirige exclusivamente a su destinatario y puede
> contener
>     >información privilegiada o confidencial. Si ha recibido este mensaje
> por
>     >error, le rogamos que nos lo comunique inmediatamente por esta misma
> vía y
>     >proceda a su destrucción.
>     >
>     >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>     >comunicamos
>     >que sus datos forman parte de un fichero cuyo responsable es
> CODEOSCOPIC
>     >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>     >servicio o información solicitados, teniendo usted derecho de acceso,
>     >rectificación, cancelación y oposición de sus datos dirigiéndose a
>     >nuestras
>     >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la
> documentación
>     >necesaria.
>
>
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Re: [FlexJS] How Binding works?

Posted by Christofer Dutz <ch...@c-ware.de>.
In general you could tweak the config-xml templates which are part of the flexjs-maven-plugin.
After all probably the Ant version simply has different defaults here. I think they should be reported as warnings, but not break the build. (In that particular type of problem).

Chris



Am 09.12.16, 17:48 schrieb "Alex Harui" <ah...@adobe.com>:

    Well, that is a legitimate warning, but is innocuous.  I'm tempted to try
    to figure out how to tell Maven to accept these warnings, but I don't know
    how to do that.  That's why the Ant builds work.  Or get the compiler to
    suppress the warning.
    
    The other answer is to switch to ValueObjects if you are just using plain
    Object.  Then your binding expression would look like
    "{MyValueObject(data).label}.  MyValueObject would have to have the
    appropriate [Bindable] metadata.
    
    -Alex
    
    On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
    <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:
    
    >Hi Alex,
    >
    >just updated all commits and test your ItemRenderer and is not working, do
    >you know what could be?
    >
    >The project 'App' has been successfully compiled and optimized.
    >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/examples/flexjs/MDLEx
    >ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
    >col: 12 Data binding will not be able to detect assignments to 'label'.
    >text="{data.label}" >
    >           ^
    >[INFO]
    >------------------------------------------------------------------------
    >[INFO] BUILD FAILURE
    >
    >
    >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
    >
    >>
    >>
    >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos
    >>Rovira"
    >> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org> wrote:
    >>
    >> >Hi
    >> >
    >> >I need to know how to deal with data binding in different situations,
    >> >ItemRenderer, View, Container, Component, Bead,...
    >> >
    >> >I saw various classes ConstantBinding, ViewBeadBinding...
    >> >
    >> >Hope someone could share the main principles of Binding in FlexJS
    >>
    >> Binding in the regular Flex SDK is extremely wasteful.  That's why we
    >> often see folks recommend that you start taking out data bindings when
    >>you
    >> have performance issues.  Flex Mobile default item renderers are written
    >> in AS instead of MXML for that reason. Binding in general has to
    >> "highly-sensitive".  It needs to look for all kinds of possible change
    >> conditions, such as the source or destination being changed as well as
    >>the
    >> property on the source being changed.  In the regular Flex SDK, this
    >> highly-sensitive detection mechanism is used everywhere you use binding
    >> expressions.
    >>
    >> in FlexJS, we want to have different implementations based on certain
    >> scenarios.  There are classes named XXXDataBinding (vs YYYBinding) that
    >> implement a change detection mechanism specific to that scenario.  So
    >> ViewDataBinding knows that most data bindings will probably be from the
    >> applicationModel property to various controls.  The various
    >>XXXDataBinding
    >> implementations use the YYYBinding classes like ConstantBinding and
    >> SimpleBinding to optimize for certain patterns that don't require as
    >>much
    >> overhead to set up.  There is a GenericBinding for everything else.
    >>Also,
    >> having a choice of YYYBinding classes allows the developer to not use {}
    >> expressions and simply add a YYYBindingClass as a bead and get binding
    >>to
    >> work without the overhead of the compiler setting up a data structure
    >>for
    >> the XXXDataBindingClass to interpret at instantiation time.  So, this is
    >> another example of PAYG.  You can be lazy and have the compiler and
    >> framework figure out what to do with a {} expression, or you can save
    >>code
    >> by manually implementing it, or you can save even more by writing AS to
    >> addEventListener for the right thing at the right time.
    >>
    >> Anyway, you mentioned ItemRenderer above, and I found out yesterday that
    >> ItemRenderer binding needed its own implementation.  It can take
    >>advantage
    >> of knowing that if you bind to data.something, that there is no need to
    >> set change detection for the source or destination objects.  It knows
    >>that
    >> the only trigger is when in the item renderer lifecycle, the data
    >>property
    >> is set.  I just pushed that change.  Now my renderer looks like:
    >>
    >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
    >>                      xmlns:js="library://ns.apache.org/flexjs/basic"
    >>                      width="100%">
    >> <js:beads>
    >>         <js:VerticalLayout />
    >>         <js:ItemRendererDataBinding />
    >>     </js:beads>
    >>     <js:Label width="100%" height="30" style="fontWeight:bold"
    >> text="{data.qname}" >
    >>     </js:Label>
    >>     <js:MultilineLabel id="description" width="100%"
    >> text="{data.description}" />
    >> </js:MXMLItemRenderer>
    >>
    >>
    >>
    >> HTH,
    >> -Alex
    >>
    >>
    >
    >
    >-- 
    >
    >Carlos Rovira
    >Director General
    >M: +34 607 22 60 05
    >http://www.codeoscopic.com
    >http://www.avant2.es
    >
    >Este mensaje se dirige exclusivamente a su destinatario y puede contener
    >información privilegiada o confidencial. Si ha recibido este mensaje por
    >error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
    >proceda a su destrucción.
    >
    >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
    >comunicamos
    >que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
    >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
    >servicio o información solicitados, teniendo usted derecho de acceso,
    >rectificación, cancelación y oposición de sus datos dirigiéndose a
    >nuestras
    >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
    >necesaria.
    
    


Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com>.

On 12/9/16, 12:02 PM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:

>Hi Alex, I think I don't need to dispatch a "dataChange" event, I only
>want
>to ease writing.

If you use [Bindable("dataChange")] the code must call dispatchEvent
itself.  The compiler does not generate any code for that.  If you just
use [Bindable] then the compiler will generate the dispatchEvent.

>
>I think this should work:
>
>            [Bindable]
>            public function get product():ProductVO
>            {
>                return data as ProductVO;
>            }

As written above it can't work because there is no setter to call
dispatchEvent.

IMO, the best you can do is:

  [Bindable("dataChange")]
  public function get product():ProductVO
  {
    return data as ProductVO;
  }

By not overriding the data setter, when the data is set, a dataChange will
fire and the binding subsystem will think product changed as well.  It
might not work today.  I will try it out and get it to work.


Thanks,
-Alex


Re: [FlexJS] How Binding works?

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Hi Alex, I think I don't need to dispatch a "dataChange" event, I only want
to ease writing.
In old Flex I use to do something similar as we did here and it works.

Is there an easy way to do this? I only want to avoid the cumbersome ...
"ValueObject(data)" everywhere and substitute for something more easier.

I think this should work:

<mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:js="library://ns.apache.org/flexjs/basic"
                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
                      xmlns="http://www.w3.org/1999/xhtml">

    <fx:Script>
<![CDATA[
import vos.ProductVO;

            [Bindable]
            public function get product():ProductVO
            {
                return data as ProductVO;
            }
]]>
  </fx:Script>

    <js:beads>
        <js:ItemRendererDataBinding />
    </js:beads>

    <js:Span text="{product.label}"/>

</mdl:ListItemRenderer>


And I think it looks more elegant, and if you have a huge IR, the dev will
be more grateful.

Note;
/if I use return ProductVO(data); it throws a coercion error in browser.

2016-12-09 20:18 GMT+01:00 Alex Harui <ah...@adobe.com>:

> If you don't dispatch "dataChange" it has no chance of working.  There
> still might be other issues.
>
> -Alex
>
> On 12/9/16, 11:08 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
> wrote:
>
> >I tried this, but with no luck, still doesn't output nothing:
> >
> ><mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
> >                      xmlns:js="library://ns.apache.org/flexjs/basic"
> >                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
> >                      xmlns="http://www.w3.org/1999/xhtml">
> >
> >    <fx:Script>
> ><![CDATA[
> >import vos.ProductVO;
> >
> >            [Bindable]
> >            private var _product:ProductVO;
> >
> >            [Bindable("dataChange")]
> >            public function get product():ProductVO
> >            {
> >                return data as ProductVO;
> >            }
> >]]>
> >  </fx:Script>
> >
> >    <js:beads>
> >        <js:ItemRendererDataBinding />
> >    </js:beads>
> >
> >    <js:Span text="{product.label}"/>
> >
> ></mdl:ListItemRenderer>
> >
> >
> >
> >2016-12-09 19:59 GMT+01:00 Alex Harui <ah...@adobe.com>:
> >
> >> Well, there isn't any dataChange property being dispatched, but the
> >> ItemRendererDataBinding may need to be upgraded to handle doing that.
> >>
> >> FWIW, I would probably not override data and just do:
> >>
> >> [Bindable("dataChange")]
> >> bublic function get product():ProductVO
> >> {
> >>     return data as ProductVO;
> >> }
> >>
> >> -Alex
> >>
> >> On 12/9/16, 10:50 AM, "carlos.rovira@gmail.com on behalf of Carlos
> >>Rovira"
> >> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
> >> wrote:
> >>
> >> >Hi Alex,
> >> >
> >> >I get to work as you said, but trying to make a bindable var to reduce
> >> >verbosity like this:
> >> >
> >> ><mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
> >> >                      xmlns:js="library://ns.apache.org/flexjs/basic"
> >> >                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
> >> >                      xmlns="http://www.w3.org/1999/xhtml">
> >> >
> >> >    <fx:Script>
> >> ><![CDATA[
> >> >import vos.ProductVO;
> >> >
> >> >            [Bindable]
> >> >            public var product:ProductVO;
> >> >
> >> >            [Bindable("dataChange")]
> >> >            override public function set data(value:Object):void
> >> >            {
> >> >                if (value != data)
> >> >                {
> >> >                    super.data = value;
> >> >                    product = data as ProductVO; // I tried as well
> >>with
> >> >ProductVO(data)
> >> >                }
> >> >            }
> >> >]]>
> >> ></fx:Script>
> >> >
> >> >    <js:beads>
> >> >        <js:ItemRendererDataBinding />
> >> >    </js:beads>
> >> >
> >> >    <js:Span text="{product.label}"/>
> >> >
> >> ></mdl:ListItemRenderer>
> >> >
> >> >
> >> >makes product.label doesn't output nothing, do you know what can be
> >> >happen?
> >> >
> >> >Thanks
> >> >
> >> >
> >> >
> >> >2016-12-09 17:48 GMT+01:00 Alex Harui <ah...@adobe.com>:
> >> >
> >> >> Well, that is a legitimate warning, but is innocuous.  I'm tempted to
> >> >>try
> >> >> to figure out how to tell Maven to accept these warnings, but I don't
> >> >>know
> >> >> how to do that.  That's why the Ant builds work.  Or get the
> >>compiler to
> >> >> suppress the warning.
> >> >>
> >> >> The other answer is to switch to ValueObjects if you are just using
> >> >>plain
> >> >> Object.  Then your binding expression would look like
> >> >> "{MyValueObject(data).label}.  MyValueObject would have to have the
> >> >> appropriate [Bindable] metadata.
> >> >>
> >> >> -Alex
> >> >>
> >> >> On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of Carlos
> >> >>Rovira"
> >> >> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
> >> >> wrote:
> >> >>
> >> >> >Hi Alex,
> >> >> >
> >> >> >just updated all commits and test your ItemRenderer and is not
> >> >>working, do
> >> >> >you know what could be?
> >> >> >
> >> >> >The project 'App' has been successfully compiled and optimized.
> >> >> >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/
> >> >> examples/flexjs/MDLEx
> >> >> >ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
> >> >> >col: 12 Data binding will not be able to detect assignments to
> >>'label'.
> >> >> >text="{data.label}" >
> >> >> >           ^
> >> >> >[INFO]
> >> >>
> >> >>>---------------------------------------------------------
> >> ---------------
> >> >> >[INFO] BUILD FAILURE
> >> >> >
> >> >> >
> >> >> >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
> >> >> >
> >> >> >>
> >> >> >>
> >> >> >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos
> >> >> >>Rovira"
> >> >> >> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org>
> >> wrote:
> >> >> >>
> >> >> >> >Hi
> >> >> >> >
> >> >> >> >I need to know how to deal with data binding in different
> >> >>situations,
> >> >> >> >ItemRenderer, View, Container, Component, Bead,...
> >> >> >> >
> >> >> >> >I saw various classes ConstantBinding, ViewBeadBinding...
> >> >> >> >
> >> >> >> >Hope someone could share the main principles of Binding in FlexJS
> >> >> >>
> >> >> >> Binding in the regular Flex SDK is extremely wasteful.  That's
> >>why we
> >> >> >> often see folks recommend that you start taking out data bindings
> >> >>when
> >> >> >>you
> >> >> >> have performance issues.  Flex Mobile default item renderers are
> >> >>written
> >> >> >> in AS instead of MXML for that reason. Binding in general has to
> >> >> >> "highly-sensitive".  It needs to look for all kinds of possible
> >> >>change
> >> >> >> conditions, such as the source or destination being changed as
> >>well
> >> >>as
> >> >> >>the
> >> >> >> property on the source being changed.  In the regular Flex SDK,
> >>this
> >> >> >> highly-sensitive detection mechanism is used everywhere you use
> >> >>binding
> >> >> >> expressions.
> >> >> >>
> >> >> >> in FlexJS, we want to have different implementations based on
> >>certain
> >> >> >> scenarios.  There are classes named XXXDataBinding (vs YYYBinding)
> >> >>that
> >> >> >> implement a change detection mechanism specific to that scenario.
> >> So
> >> >> >> ViewDataBinding knows that most data bindings will probably be
> >>from
> >> >>the
> >> >> >> applicationModel property to various controls.  The various
> >> >> >>XXXDataBinding
> >> >> >> implementations use the YYYBinding classes like ConstantBinding
> >>and
> >> >> >> SimpleBinding to optimize for certain patterns that don't require
> >>as
> >> >> >>much
> >> >> >> overhead to set up.  There is a GenericBinding for everything
> >>else.
> >> >> >>Also,
> >> >> >> having a choice of YYYBinding classes allows the developer to not
> >> >>use {}
> >> >> >> expressions and simply add a YYYBindingClass as a bead and get
> >> >>binding
> >> >> >>to
> >> >> >> work without the overhead of the compiler setting up a data
> >>structure
> >> >> >>for
> >> >> >> the XXXDataBindingClass to interpret at instantiation time.  So,
> >> >>this is
> >> >> >> another example of PAYG.  You can be lazy and have the compiler
> >>and
> >> >> >> framework figure out what to do with a {} expression, or you can
> >>save
> >> >> >>code
> >> >> >> by manually implementing it, or you can save even more by writing
> >>AS
> >> >>to
> >> >> >> addEventListener for the right thing at the right time.
> >> >> >>
> >> >> >> Anyway, you mentioned ItemRenderer above, and I found out
> >>yesterday
> >> >>that
> >> >> >> ItemRenderer binding needed its own implementation.  It can take
> >> >> >>advantage
> >> >> >> of knowing that if you bind to data.something, that there is no
> >>need
> >> >>to
> >> >> >> set change detection for the source or destination objects.  It
> >>knows
> >> >> >>that
> >> >> >> the only trigger is when in the item renderer lifecycle, the data
> >> >> >>property
> >> >> >> is set.  I just pushed that change.  Now my renderer looks like:
> >> >> >>
> >> >> >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
> >> >> >>
> >>xmlns:js="library://ns.apache.org/flexjs/basic"
> >> >> >>                      width="100%">
> >> >> >> <js:beads>
> >> >> >>         <js:VerticalLayout />
> >> >> >>         <js:ItemRendererDataBinding />
> >> >> >>     </js:beads>
> >> >> >>     <js:Label width="100%" height="30" style="fontWeight:bold"
> >> >> >> text="{data.qname}" >
> >> >> >>     </js:Label>
> >> >> >>     <js:MultilineLabel id="description" width="100%"
> >> >> >> text="{data.description}" />
> >> >> >> </js:MXMLItemRenderer>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> HTH,
> >> >> >> -Alex
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> >--
> >> >> >
> >> >> >Carlos Rovira
> >> >> >Director General
> >> >> >M: +34 607 22 60 05
> >> >> >http://www.codeoscopic.com
> >> >> >http://www.avant2.es
> >> >> >
> >> >> >Este mensaje se dirige exclusivamente a su destinatario y puede
> >> >>contener
> >> >> >información privilegiada o confidencial. Si ha recibido este mensaje
> >> >>por
> >> >> >error, le rogamos que nos lo comunique inmediatamente por esta misma
> >> >>vía y
> >> >> >proceda a su destrucción.
> >> >> >
> >> >> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> >> >> >comunicamos
> >> >> >que sus datos forman parte de un fichero cuyo responsable es
> >> >>CODEOSCOPIC
> >> >> >S.A. La finalidad de dicho tratamiento es facilitar la prestación
> >>del
> >> >> >servicio o información solicitados, teniendo usted derecho de
> >>acceso,
> >> >> >rectificación, cancelación y oposición de sus datos dirigiéndose a
> >> >> >nuestras
> >> >> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la
> >>documentación
> >> >> >necesaria.
> >> >>
> >> >>
> >> >
> >> >
> >> >--
> >> >
> >> >Carlos Rovira
> >> >Director General
> >> >M: +34 607 22 60 05
> >> >http://www.codeoscopic.com
> >> >http://www.avant2.es
> >> >
> >> >Este mensaje se dirige exclusivamente a su destinatario y puede
> >>contener
> >> >información privilegiada o confidencial. Si ha recibido este mensaje
> >>por
> >> >error, le rogamos que nos lo comunique inmediatamente por esta misma
> >>vía y
> >> >proceda a su destrucción.
> >> >
> >> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> >> >comunicamos
> >> >que sus datos forman parte de un fichero cuyo responsable es
> >>CODEOSCOPIC
> >> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> >> >servicio o información solicitados, teniendo usted derecho de acceso,
> >> >rectificación, cancelación y oposición de sus datos dirigiéndose a
> >> >nuestras
> >> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> >> >necesaria.
> >>
> >>
> >
> >
> >--
> >
> >Carlos Rovira
> >Director General
> >M: +34 607 22 60 05
> >http://www.codeoscopic.com
> >http://www.avant2.es
> >
> >Este mensaje se dirige exclusivamente a su destinatario y puede contener
> >información privilegiada o confidencial. Si ha recibido este mensaje por
> >error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> >proceda a su destrucción.
> >
> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> >comunicamos
> >que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> >servicio o información solicitados, teniendo usted derecho de acceso,
> >rectificación, cancelación y oposición de sus datos dirigiéndose a
> >nuestras
> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> >necesaria.
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com>.
If you don't dispatch "dataChange" it has no chance of working.  There
still might be other issues.

-Alex

On 12/9/16, 11:08 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:

>I tried this, but with no luck, still doesn't output nothing:
>
><mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>                      xmlns:js="library://ns.apache.org/flexjs/basic"
>                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
>                      xmlns="http://www.w3.org/1999/xhtml">
>
>    <fx:Script>
><![CDATA[
>import vos.ProductVO;
>
>            [Bindable]
>            private var _product:ProductVO;
>
>            [Bindable("dataChange")]
>            public function get product():ProductVO
>            {
>                return data as ProductVO;
>            }
>]]>
>  </fx:Script>
>
>    <js:beads>
>        <js:ItemRendererDataBinding />
>    </js:beads>
>
>    <js:Span text="{product.label}"/>
>
></mdl:ListItemRenderer>
>
>
>
>2016-12-09 19:59 GMT+01:00 Alex Harui <ah...@adobe.com>:
>
>> Well, there isn't any dataChange property being dispatched, but the
>> ItemRendererDataBinding may need to be upgraded to handle doing that.
>>
>> FWIW, I would probably not override data and just do:
>>
>> [Bindable("dataChange")]
>> bublic function get product():ProductVO
>> {
>>     return data as ProductVO;
>> }
>>
>> -Alex
>>
>> On 12/9/16, 10:50 AM, "carlos.rovira@gmail.com on behalf of Carlos
>>Rovira"
>> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
>> wrote:
>>
>> >Hi Alex,
>> >
>> >I get to work as you said, but trying to make a bindable var to reduce
>> >verbosity like this:
>> >
>> ><mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>> >                      xmlns:js="library://ns.apache.org/flexjs/basic"
>> >                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
>> >                      xmlns="http://www.w3.org/1999/xhtml">
>> >
>> >    <fx:Script>
>> ><![CDATA[
>> >import vos.ProductVO;
>> >
>> >            [Bindable]
>> >            public var product:ProductVO;
>> >
>> >            [Bindable("dataChange")]
>> >            override public function set data(value:Object):void
>> >            {
>> >                if (value != data)
>> >                {
>> >                    super.data = value;
>> >                    product = data as ProductVO; // I tried as well
>>with
>> >ProductVO(data)
>> >                }
>> >            }
>> >]]>
>> ></fx:Script>
>> >
>> >    <js:beads>
>> >        <js:ItemRendererDataBinding />
>> >    </js:beads>
>> >
>> >    <js:Span text="{product.label}"/>
>> >
>> ></mdl:ListItemRenderer>
>> >
>> >
>> >makes product.label doesn't output nothing, do you know what can be
>> >happen?
>> >
>> >Thanks
>> >
>> >
>> >
>> >2016-12-09 17:48 GMT+01:00 Alex Harui <ah...@adobe.com>:
>> >
>> >> Well, that is a legitimate warning, but is innocuous.  I'm tempted to
>> >>try
>> >> to figure out how to tell Maven to accept these warnings, but I don't
>> >>know
>> >> how to do that.  That's why the Ant builds work.  Or get the
>>compiler to
>> >> suppress the warning.
>> >>
>> >> The other answer is to switch to ValueObjects if you are just using
>> >>plain
>> >> Object.  Then your binding expression would look like
>> >> "{MyValueObject(data).label}.  MyValueObject would have to have the
>> >> appropriate [Bindable] metadata.
>> >>
>> >> -Alex
>> >>
>> >> On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of Carlos
>> >>Rovira"
>> >> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
>> >> wrote:
>> >>
>> >> >Hi Alex,
>> >> >
>> >> >just updated all commits and test your ItemRenderer and is not
>> >>working, do
>> >> >you know what could be?
>> >> >
>> >> >The project 'App' has been successfully compiled and optimized.
>> >> >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/
>> >> examples/flexjs/MDLEx
>> >> >ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
>> >> >col: 12 Data binding will not be able to detect assignments to
>>'label'.
>> >> >text="{data.label}" >
>> >> >           ^
>> >> >[INFO]
>> >>
>> >>>---------------------------------------------------------
>> ---------------
>> >> >[INFO] BUILD FAILURE
>> >> >
>> >> >
>> >> >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
>> >> >
>> >> >>
>> >> >>
>> >> >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos
>> >> >>Rovira"
>> >> >> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org>
>> wrote:
>> >> >>
>> >> >> >Hi
>> >> >> >
>> >> >> >I need to know how to deal with data binding in different
>> >>situations,
>> >> >> >ItemRenderer, View, Container, Component, Bead,...
>> >> >> >
>> >> >> >I saw various classes ConstantBinding, ViewBeadBinding...
>> >> >> >
>> >> >> >Hope someone could share the main principles of Binding in FlexJS
>> >> >>
>> >> >> Binding in the regular Flex SDK is extremely wasteful.  That's
>>why we
>> >> >> often see folks recommend that you start taking out data bindings
>> >>when
>> >> >>you
>> >> >> have performance issues.  Flex Mobile default item renderers are
>> >>written
>> >> >> in AS instead of MXML for that reason. Binding in general has to
>> >> >> "highly-sensitive".  It needs to look for all kinds of possible
>> >>change
>> >> >> conditions, such as the source or destination being changed as
>>well
>> >>as
>> >> >>the
>> >> >> property on the source being changed.  In the regular Flex SDK,
>>this
>> >> >> highly-sensitive detection mechanism is used everywhere you use
>> >>binding
>> >> >> expressions.
>> >> >>
>> >> >> in FlexJS, we want to have different implementations based on
>>certain
>> >> >> scenarios.  There are classes named XXXDataBinding (vs YYYBinding)
>> >>that
>> >> >> implement a change detection mechanism specific to that scenario.
>> So
>> >> >> ViewDataBinding knows that most data bindings will probably be
>>from
>> >>the
>> >> >> applicationModel property to various controls.  The various
>> >> >>XXXDataBinding
>> >> >> implementations use the YYYBinding classes like ConstantBinding
>>and
>> >> >> SimpleBinding to optimize for certain patterns that don't require
>>as
>> >> >>much
>> >> >> overhead to set up.  There is a GenericBinding for everything
>>else.
>> >> >>Also,
>> >> >> having a choice of YYYBinding classes allows the developer to not
>> >>use {}
>> >> >> expressions and simply add a YYYBindingClass as a bead and get
>> >>binding
>> >> >>to
>> >> >> work without the overhead of the compiler setting up a data
>>structure
>> >> >>for
>> >> >> the XXXDataBindingClass to interpret at instantiation time.  So,
>> >>this is
>> >> >> another example of PAYG.  You can be lazy and have the compiler
>>and
>> >> >> framework figure out what to do with a {} expression, or you can
>>save
>> >> >>code
>> >> >> by manually implementing it, or you can save even more by writing
>>AS
>> >>to
>> >> >> addEventListener for the right thing at the right time.
>> >> >>
>> >> >> Anyway, you mentioned ItemRenderer above, and I found out
>>yesterday
>> >>that
>> >> >> ItemRenderer binding needed its own implementation.  It can take
>> >> >>advantage
>> >> >> of knowing that if you bind to data.something, that there is no
>>need
>> >>to
>> >> >> set change detection for the source or destination objects.  It
>>knows
>> >> >>that
>> >> >> the only trigger is when in the item renderer lifecycle, the data
>> >> >>property
>> >> >> is set.  I just pushed that change.  Now my renderer looks like:
>> >> >>
>> >> >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>> >> >>           
>>xmlns:js="library://ns.apache.org/flexjs/basic"
>> >> >>                      width="100%">
>> >> >> <js:beads>
>> >> >>         <js:VerticalLayout />
>> >> >>         <js:ItemRendererDataBinding />
>> >> >>     </js:beads>
>> >> >>     <js:Label width="100%" height="30" style="fontWeight:bold"
>> >> >> text="{data.qname}" >
>> >> >>     </js:Label>
>> >> >>     <js:MultilineLabel id="description" width="100%"
>> >> >> text="{data.description}" />
>> >> >> </js:MXMLItemRenderer>
>> >> >>
>> >> >>
>> >> >>
>> >> >> HTH,
>> >> >> -Alex
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> >--
>> >> >
>> >> >Carlos Rovira
>> >> >Director General
>> >> >M: +34 607 22 60 05
>> >> >http://www.codeoscopic.com
>> >> >http://www.avant2.es
>> >> >
>> >> >Este mensaje se dirige exclusivamente a su destinatario y puede
>> >>contener
>> >> >información privilegiada o confidencial. Si ha recibido este mensaje
>> >>por
>> >> >error, le rogamos que nos lo comunique inmediatamente por esta misma
>> >>vía y
>> >> >proceda a su destrucción.
>> >> >
>> >> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>> >> >comunicamos
>> >> >que sus datos forman parte de un fichero cuyo responsable es
>> >>CODEOSCOPIC
>> >> >S.A. La finalidad de dicho tratamiento es facilitar la prestación
>>del
>> >> >servicio o información solicitados, teniendo usted derecho de
>>acceso,
>> >> >rectificación, cancelación y oposición de sus datos dirigiéndose a
>> >> >nuestras
>> >> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la
>>documentación
>> >> >necesaria.
>> >>
>> >>
>> >
>> >
>> >--
>> >
>> >Carlos Rovira
>> >Director General
>> >M: +34 607 22 60 05
>> >http://www.codeoscopic.com
>> >http://www.avant2.es
>> >
>> >Este mensaje se dirige exclusivamente a su destinatario y puede
>>contener
>> >información privilegiada o confidencial. Si ha recibido este mensaje
>>por
>> >error, le rogamos que nos lo comunique inmediatamente por esta misma
>>vía y
>> >proceda a su destrucción.
>> >
>> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>> >comunicamos
>> >que sus datos forman parte de un fichero cuyo responsable es
>>CODEOSCOPIC
>> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>> >servicio o información solicitados, teniendo usted derecho de acceso,
>> >rectificación, cancelación y oposición de sus datos dirigiéndose a
>> >nuestras
>> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
>> >necesaria.
>>
>>
>
>
>-- 
>
>Carlos Rovira
>Director General
>M: +34 607 22 60 05
>http://www.codeoscopic.com
>http://www.avant2.es
>
>Este mensaje se dirige exclusivamente a su destinatario y puede contener
>información privilegiada o confidencial. Si ha recibido este mensaje por
>error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
>proceda a su destrucción.
>
>De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>comunicamos
>que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
>S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>servicio o información solicitados, teniendo usted derecho de acceso,
>rectificación, cancelación y oposición de sus datos dirigiéndose a
>nuestras
>oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
>necesaria.


Re: [FlexJS] How Binding works?

Posted by Carlos Rovira <ca...@codeoscopic.com>.
I tried this, but with no luck, still doesn't output nothing:

<mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:js="library://ns.apache.org/flexjs/basic"
                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
                      xmlns="http://www.w3.org/1999/xhtml">

    <fx:Script>
<![CDATA[
import vos.ProductVO;

            [Bindable]
            private var _product:ProductVO;

            [Bindable("dataChange")]
            public function get product():ProductVO
            {
                return data as ProductVO;
            }
]]>
  </fx:Script>

    <js:beads>
        <js:ItemRendererDataBinding />
    </js:beads>

    <js:Span text="{product.label}"/>

</mdl:ListItemRenderer>



2016-12-09 19:59 GMT+01:00 Alex Harui <ah...@adobe.com>:

> Well, there isn't any dataChange property being dispatched, but the
> ItemRendererDataBinding may need to be upgraded to handle doing that.
>
> FWIW, I would probably not override data and just do:
>
> [Bindable("dataChange")]
> bublic function get product():ProductVO
> {
>     return data as ProductVO;
> }
>
> -Alex
>
> On 12/9/16, 10:50 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
> wrote:
>
> >Hi Alex,
> >
> >I get to work as you said, but trying to make a bindable var to reduce
> >verbosity like this:
> >
> ><mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
> >                      xmlns:js="library://ns.apache.org/flexjs/basic"
> >                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
> >                      xmlns="http://www.w3.org/1999/xhtml">
> >
> >    <fx:Script>
> ><![CDATA[
> >import vos.ProductVO;
> >
> >            [Bindable]
> >            public var product:ProductVO;
> >
> >            [Bindable("dataChange")]
> >            override public function set data(value:Object):void
> >            {
> >                if (value != data)
> >                {
> >                    super.data = value;
> >                    product = data as ProductVO; // I tried as well with
> >ProductVO(data)
> >                }
> >            }
> >]]>
> ></fx:Script>
> >
> >    <js:beads>
> >        <js:ItemRendererDataBinding />
> >    </js:beads>
> >
> >    <js:Span text="{product.label}"/>
> >
> ></mdl:ListItemRenderer>
> >
> >
> >makes product.label doesn't output nothing, do you know what can be
> >happen?
> >
> >Thanks
> >
> >
> >
> >2016-12-09 17:48 GMT+01:00 Alex Harui <ah...@adobe.com>:
> >
> >> Well, that is a legitimate warning, but is innocuous.  I'm tempted to
> >>try
> >> to figure out how to tell Maven to accept these warnings, but I don't
> >>know
> >> how to do that.  That's why the Ant builds work.  Or get the compiler to
> >> suppress the warning.
> >>
> >> The other answer is to switch to ValueObjects if you are just using
> >>plain
> >> Object.  Then your binding expression would look like
> >> "{MyValueObject(data).label}.  MyValueObject would have to have the
> >> appropriate [Bindable] metadata.
> >>
> >> -Alex
> >>
> >> On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of Carlos
> >>Rovira"
> >> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
> >> wrote:
> >>
> >> >Hi Alex,
> >> >
> >> >just updated all commits and test your ItemRenderer and is not
> >>working, do
> >> >you know what could be?
> >> >
> >> >The project 'App' has been successfully compiled and optimized.
> >> >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/
> >> examples/flexjs/MDLEx
> >> >ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
> >> >col: 12 Data binding will not be able to detect assignments to 'label'.
> >> >text="{data.label}" >
> >> >           ^
> >> >[INFO]
> >>
> >>>---------------------------------------------------------
> ---------------
> >> >[INFO] BUILD FAILURE
> >> >
> >> >
> >> >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
> >> >
> >> >>
> >> >>
> >> >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos
> >> >>Rovira"
> >> >> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org>
> wrote:
> >> >>
> >> >> >Hi
> >> >> >
> >> >> >I need to know how to deal with data binding in different
> >>situations,
> >> >> >ItemRenderer, View, Container, Component, Bead,...
> >> >> >
> >> >> >I saw various classes ConstantBinding, ViewBeadBinding...
> >> >> >
> >> >> >Hope someone could share the main principles of Binding in FlexJS
> >> >>
> >> >> Binding in the regular Flex SDK is extremely wasteful.  That's why we
> >> >> often see folks recommend that you start taking out data bindings
> >>when
> >> >>you
> >> >> have performance issues.  Flex Mobile default item renderers are
> >>written
> >> >> in AS instead of MXML for that reason. Binding in general has to
> >> >> "highly-sensitive".  It needs to look for all kinds of possible
> >>change
> >> >> conditions, such as the source or destination being changed as well
> >>as
> >> >>the
> >> >> property on the source being changed.  In the regular Flex SDK, this
> >> >> highly-sensitive detection mechanism is used everywhere you use
> >>binding
> >> >> expressions.
> >> >>
> >> >> in FlexJS, we want to have different implementations based on certain
> >> >> scenarios.  There are classes named XXXDataBinding (vs YYYBinding)
> >>that
> >> >> implement a change detection mechanism specific to that scenario.  So
> >> >> ViewDataBinding knows that most data bindings will probably be from
> >>the
> >> >> applicationModel property to various controls.  The various
> >> >>XXXDataBinding
> >> >> implementations use the YYYBinding classes like ConstantBinding and
> >> >> SimpleBinding to optimize for certain patterns that don't require as
> >> >>much
> >> >> overhead to set up.  There is a GenericBinding for everything else.
> >> >>Also,
> >> >> having a choice of YYYBinding classes allows the developer to not
> >>use {}
> >> >> expressions and simply add a YYYBindingClass as a bead and get
> >>binding
> >> >>to
> >> >> work without the overhead of the compiler setting up a data structure
> >> >>for
> >> >> the XXXDataBindingClass to interpret at instantiation time.  So,
> >>this is
> >> >> another example of PAYG.  You can be lazy and have the compiler and
> >> >> framework figure out what to do with a {} expression, or you can save
> >> >>code
> >> >> by manually implementing it, or you can save even more by writing AS
> >>to
> >> >> addEventListener for the right thing at the right time.
> >> >>
> >> >> Anyway, you mentioned ItemRenderer above, and I found out yesterday
> >>that
> >> >> ItemRenderer binding needed its own implementation.  It can take
> >> >>advantage
> >> >> of knowing that if you bind to data.something, that there is no need
> >>to
> >> >> set change detection for the source or destination objects.  It knows
> >> >>that
> >> >> the only trigger is when in the item renderer lifecycle, the data
> >> >>property
> >> >> is set.  I just pushed that change.  Now my renderer looks like:
> >> >>
> >> >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
> >> >>                      xmlns:js="library://ns.apache.org/flexjs/basic"
> >> >>                      width="100%">
> >> >> <js:beads>
> >> >>         <js:VerticalLayout />
> >> >>         <js:ItemRendererDataBinding />
> >> >>     </js:beads>
> >> >>     <js:Label width="100%" height="30" style="fontWeight:bold"
> >> >> text="{data.qname}" >
> >> >>     </js:Label>
> >> >>     <js:MultilineLabel id="description" width="100%"
> >> >> text="{data.description}" />
> >> >> </js:MXMLItemRenderer>
> >> >>
> >> >>
> >> >>
> >> >> HTH,
> >> >> -Alex
> >> >>
> >> >>
> >> >
> >> >
> >> >--
> >> >
> >> >Carlos Rovira
> >> >Director General
> >> >M: +34 607 22 60 05
> >> >http://www.codeoscopic.com
> >> >http://www.avant2.es
> >> >
> >> >Este mensaje se dirige exclusivamente a su destinatario y puede
> >>contener
> >> >información privilegiada o confidencial. Si ha recibido este mensaje
> >>por
> >> >error, le rogamos que nos lo comunique inmediatamente por esta misma
> >>vía y
> >> >proceda a su destrucción.
> >> >
> >> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> >> >comunicamos
> >> >que sus datos forman parte de un fichero cuyo responsable es
> >>CODEOSCOPIC
> >> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> >> >servicio o información solicitados, teniendo usted derecho de acceso,
> >> >rectificación, cancelación y oposición de sus datos dirigiéndose a
> >> >nuestras
> >> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> >> >necesaria.
> >>
> >>
> >
> >
> >--
> >
> >Carlos Rovira
> >Director General
> >M: +34 607 22 60 05
> >http://www.codeoscopic.com
> >http://www.avant2.es
> >
> >Este mensaje se dirige exclusivamente a su destinatario y puede contener
> >información privilegiada o confidencial. Si ha recibido este mensaje por
> >error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> >proceda a su destrucción.
> >
> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> >comunicamos
> >que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> >servicio o información solicitados, teniendo usted derecho de acceso,
> >rectificación, cancelación y oposición de sus datos dirigiéndose a
> >nuestras
> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> >necesaria.
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com>.
Well, there isn't any dataChange property being dispatched, but the
ItemRendererDataBinding may need to be upgraded to handle doing that.

FWIW, I would probably not override data and just do:

[Bindable("dataChange")]
bublic function get product():ProductVO
{
    return data as ProductVO;
}

-Alex

On 12/9/16, 10:50 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:

>Hi Alex,
>
>I get to work as you said, but trying to make a bindable var to reduce
>verbosity like this:
>
><mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>                      xmlns:js="library://ns.apache.org/flexjs/basic"
>                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
>                      xmlns="http://www.w3.org/1999/xhtml">
>
>    <fx:Script>
><![CDATA[
>import vos.ProductVO;
>
>            [Bindable]
>            public var product:ProductVO;
>
>            [Bindable("dataChange")]
>            override public function set data(value:Object):void
>            {
>                if (value != data)
>                {
>                    super.data = value;
>                    product = data as ProductVO; // I tried as well with
>ProductVO(data)
>                }
>            }
>]]>
></fx:Script>
>
>    <js:beads>
>        <js:ItemRendererDataBinding />
>    </js:beads>
>
>    <js:Span text="{product.label}"/>
>
></mdl:ListItemRenderer>
>
>
>makes product.label doesn't output nothing, do you know what can be
>happen?
>
>Thanks
>
>
>
>2016-12-09 17:48 GMT+01:00 Alex Harui <ah...@adobe.com>:
>
>> Well, that is a legitimate warning, but is innocuous.  I'm tempted to
>>try
>> to figure out how to tell Maven to accept these warnings, but I don't
>>know
>> how to do that.  That's why the Ant builds work.  Or get the compiler to
>> suppress the warning.
>>
>> The other answer is to switch to ValueObjects if you are just using
>>plain
>> Object.  Then your binding expression would look like
>> "{MyValueObject(data).label}.  MyValueObject would have to have the
>> appropriate [Bindable] metadata.
>>
>> -Alex
>>
>> On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of Carlos
>>Rovira"
>> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
>> wrote:
>>
>> >Hi Alex,
>> >
>> >just updated all commits and test your ItemRenderer and is not
>>working, do
>> >you know what could be?
>> >
>> >The project 'App' has been successfully compiled and optimized.
>> >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/
>> examples/flexjs/MDLEx
>> >ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
>> >col: 12 Data binding will not be able to detect assignments to 'label'.
>> >text="{data.label}" >
>> >           ^
>> >[INFO]
>> 
>>>------------------------------------------------------------------------
>> >[INFO] BUILD FAILURE
>> >
>> >
>> >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
>> >
>> >>
>> >>
>> >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos
>> >>Rovira"
>> >> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org> wrote:
>> >>
>> >> >Hi
>> >> >
>> >> >I need to know how to deal with data binding in different
>>situations,
>> >> >ItemRenderer, View, Container, Component, Bead,...
>> >> >
>> >> >I saw various classes ConstantBinding, ViewBeadBinding...
>> >> >
>> >> >Hope someone could share the main principles of Binding in FlexJS
>> >>
>> >> Binding in the regular Flex SDK is extremely wasteful.  That's why we
>> >> often see folks recommend that you start taking out data bindings
>>when
>> >>you
>> >> have performance issues.  Flex Mobile default item renderers are
>>written
>> >> in AS instead of MXML for that reason. Binding in general has to
>> >> "highly-sensitive".  It needs to look for all kinds of possible
>>change
>> >> conditions, such as the source or destination being changed as well
>>as
>> >>the
>> >> property on the source being changed.  In the regular Flex SDK, this
>> >> highly-sensitive detection mechanism is used everywhere you use
>>binding
>> >> expressions.
>> >>
>> >> in FlexJS, we want to have different implementations based on certain
>> >> scenarios.  There are classes named XXXDataBinding (vs YYYBinding)
>>that
>> >> implement a change detection mechanism specific to that scenario.  So
>> >> ViewDataBinding knows that most data bindings will probably be from
>>the
>> >> applicationModel property to various controls.  The various
>> >>XXXDataBinding
>> >> implementations use the YYYBinding classes like ConstantBinding and
>> >> SimpleBinding to optimize for certain patterns that don't require as
>> >>much
>> >> overhead to set up.  There is a GenericBinding for everything else.
>> >>Also,
>> >> having a choice of YYYBinding classes allows the developer to not
>>use {}
>> >> expressions and simply add a YYYBindingClass as a bead and get
>>binding
>> >>to
>> >> work without the overhead of the compiler setting up a data structure
>> >>for
>> >> the XXXDataBindingClass to interpret at instantiation time.  So,
>>this is
>> >> another example of PAYG.  You can be lazy and have the compiler and
>> >> framework figure out what to do with a {} expression, or you can save
>> >>code
>> >> by manually implementing it, or you can save even more by writing AS
>>to
>> >> addEventListener for the right thing at the right time.
>> >>
>> >> Anyway, you mentioned ItemRenderer above, and I found out yesterday
>>that
>> >> ItemRenderer binding needed its own implementation.  It can take
>> >>advantage
>> >> of knowing that if you bind to data.something, that there is no need
>>to
>> >> set change detection for the source or destination objects.  It knows
>> >>that
>> >> the only trigger is when in the item renderer lifecycle, the data
>> >>property
>> >> is set.  I just pushed that change.  Now my renderer looks like:
>> >>
>> >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>> >>                      xmlns:js="library://ns.apache.org/flexjs/basic"
>> >>                      width="100%">
>> >> <js:beads>
>> >>         <js:VerticalLayout />
>> >>         <js:ItemRendererDataBinding />
>> >>     </js:beads>
>> >>     <js:Label width="100%" height="30" style="fontWeight:bold"
>> >> text="{data.qname}" >
>> >>     </js:Label>
>> >>     <js:MultilineLabel id="description" width="100%"
>> >> text="{data.description}" />
>> >> </js:MXMLItemRenderer>
>> >>
>> >>
>> >>
>> >> HTH,
>> >> -Alex
>> >>
>> >>
>> >
>> >
>> >--
>> >
>> >Carlos Rovira
>> >Director General
>> >M: +34 607 22 60 05
>> >http://www.codeoscopic.com
>> >http://www.avant2.es
>> >
>> >Este mensaje se dirige exclusivamente a su destinatario y puede
>>contener
>> >información privilegiada o confidencial. Si ha recibido este mensaje
>>por
>> >error, le rogamos que nos lo comunique inmediatamente por esta misma
>>vía y
>> >proceda a su destrucción.
>> >
>> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>> >comunicamos
>> >que sus datos forman parte de un fichero cuyo responsable es
>>CODEOSCOPIC
>> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>> >servicio o información solicitados, teniendo usted derecho de acceso,
>> >rectificación, cancelación y oposición de sus datos dirigiéndose a
>> >nuestras
>> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
>> >necesaria.
>>
>>
>
>
>-- 
>
>Carlos Rovira
>Director General
>M: +34 607 22 60 05
>http://www.codeoscopic.com
>http://www.avant2.es
>
>Este mensaje se dirige exclusivamente a su destinatario y puede contener
>información privilegiada o confidencial. Si ha recibido este mensaje por
>error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
>proceda a su destrucción.
>
>De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>comunicamos
>que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
>S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>servicio o información solicitados, teniendo usted derecho de acceso,
>rectificación, cancelación y oposición de sus datos dirigiéndose a
>nuestras
>oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
>necesaria.


Re: [FlexJS] How Binding works?

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Hi Alex,

I get to work as you said, but trying to make a bindable var to reduce
verbosity like this:

<mdl:ListItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:js="library://ns.apache.org/flexjs/basic"
                      xmlns:mdl="library://ns.apache.org/flexjs/mdl"
                      xmlns="http://www.w3.org/1999/xhtml">

    <fx:Script>
<![CDATA[
import vos.ProductVO;

            [Bindable]
            public var product:ProductVO;

            [Bindable("dataChange")]
            override public function set data(value:Object):void
            {
                if (value != data)
                {
                    super.data = value;
                    product = data as ProductVO; // I tried as well with
ProductVO(data)
                }
            }
]]>
</fx:Script>

    <js:beads>
        <js:ItemRendererDataBinding />
    </js:beads>

    <js:Span text="{product.label}"/>

</mdl:ListItemRenderer>


makes product.label doesn't output nothing, do you know what can be happen?

Thanks



2016-12-09 17:48 GMT+01:00 Alex Harui <ah...@adobe.com>:

> Well, that is a legitimate warning, but is innocuous.  I'm tempted to try
> to figure out how to tell Maven to accept these warnings, but I don't know
> how to do that.  That's why the Ant builds work.  Or get the compiler to
> suppress the warning.
>
> The other answer is to switch to ValueObjects if you are just using plain
> Object.  Then your binding expression would look like
> "{MyValueObject(data).label}.  MyValueObject would have to have the
> appropriate [Bindable] metadata.
>
> -Alex
>
> On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
> wrote:
>
> >Hi Alex,
> >
> >just updated all commits and test your ItemRenderer and is not working, do
> >you know what could be?
> >
> >The project 'App' has been successfully compiled and optimized.
> >/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/
> examples/flexjs/MDLEx
> >ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
> >col: 12 Data binding will not be able to detect assignments to 'label'.
> >text="{data.label}" >
> >           ^
> >[INFO]
> >------------------------------------------------------------------------
> >[INFO] BUILD FAILURE
> >
> >
> >2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
> >
> >>
> >>
> >> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos
> >>Rovira"
> >> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org> wrote:
> >>
> >> >Hi
> >> >
> >> >I need to know how to deal with data binding in different situations,
> >> >ItemRenderer, View, Container, Component, Bead,...
> >> >
> >> >I saw various classes ConstantBinding, ViewBeadBinding...
> >> >
> >> >Hope someone could share the main principles of Binding in FlexJS
> >>
> >> Binding in the regular Flex SDK is extremely wasteful.  That's why we
> >> often see folks recommend that you start taking out data bindings when
> >>you
> >> have performance issues.  Flex Mobile default item renderers are written
> >> in AS instead of MXML for that reason. Binding in general has to
> >> "highly-sensitive".  It needs to look for all kinds of possible change
> >> conditions, such as the source or destination being changed as well as
> >>the
> >> property on the source being changed.  In the regular Flex SDK, this
> >> highly-sensitive detection mechanism is used everywhere you use binding
> >> expressions.
> >>
> >> in FlexJS, we want to have different implementations based on certain
> >> scenarios.  There are classes named XXXDataBinding (vs YYYBinding) that
> >> implement a change detection mechanism specific to that scenario.  So
> >> ViewDataBinding knows that most data bindings will probably be from the
> >> applicationModel property to various controls.  The various
> >>XXXDataBinding
> >> implementations use the YYYBinding classes like ConstantBinding and
> >> SimpleBinding to optimize for certain patterns that don't require as
> >>much
> >> overhead to set up.  There is a GenericBinding for everything else.
> >>Also,
> >> having a choice of YYYBinding classes allows the developer to not use {}
> >> expressions and simply add a YYYBindingClass as a bead and get binding
> >>to
> >> work without the overhead of the compiler setting up a data structure
> >>for
> >> the XXXDataBindingClass to interpret at instantiation time.  So, this is
> >> another example of PAYG.  You can be lazy and have the compiler and
> >> framework figure out what to do with a {} expression, or you can save
> >>code
> >> by manually implementing it, or you can save even more by writing AS to
> >> addEventListener for the right thing at the right time.
> >>
> >> Anyway, you mentioned ItemRenderer above, and I found out yesterday that
> >> ItemRenderer binding needed its own implementation.  It can take
> >>advantage
> >> of knowing that if you bind to data.something, that there is no need to
> >> set change detection for the source or destination objects.  It knows
> >>that
> >> the only trigger is when in the item renderer lifecycle, the data
> >>property
> >> is set.  I just pushed that change.  Now my renderer looks like:
> >>
> >> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
> >>                      xmlns:js="library://ns.apache.org/flexjs/basic"
> >>                      width="100%">
> >> <js:beads>
> >>         <js:VerticalLayout />
> >>         <js:ItemRendererDataBinding />
> >>     </js:beads>
> >>     <js:Label width="100%" height="30" style="fontWeight:bold"
> >> text="{data.qname}" >
> >>     </js:Label>
> >>     <js:MultilineLabel id="description" width="100%"
> >> text="{data.description}" />
> >> </js:MXMLItemRenderer>
> >>
> >>
> >>
> >> HTH,
> >> -Alex
> >>
> >>
> >
> >
> >--
> >
> >Carlos Rovira
> >Director General
> >M: +34 607 22 60 05
> >http://www.codeoscopic.com
> >http://www.avant2.es
> >
> >Este mensaje se dirige exclusivamente a su destinatario y puede contener
> >información privilegiada o confidencial. Si ha recibido este mensaje por
> >error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> >proceda a su destrucción.
> >
> >De la vigente Ley Orgánica de Protección de Datos (15/1999), le
> >comunicamos
> >que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> >S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> >servicio o información solicitados, teniendo usted derecho de acceso,
> >rectificación, cancelación y oposición de sus datos dirigiéndose a
> >nuestras
> >oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> >necesaria.
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

RE: [FlexJS] How Binding works?

Posted by Yishay Weiss <yi...@hotmail.com>.
It’s more to let the compiler know the implementations are bindable. I don’t expect them to automatically become bindable.

From: piotrz<ma...@gmail.com>
Sent: Tuesday, June 20, 2017 9:52 AM
To: dev@flex.apache.org<ma...@flex.apache.org>
Subject: RE: [FlexJS] How Binding works?

Hi Yishay,

Actaully what is the purpose to have Bindable in the interface ? I have
never seen such things in old Flex.

You are expecting that once you implement such interface you will have
[Bindable] inherited ?

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-How-Binding-works-tp57096p62486.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.


RE: [FlexJS] How Binding works?

Posted by piotrz <pi...@gmail.com>.
Hi Yishay,

Actaully what is the purpose to have Bindable in the interface ? I have
never seen such things in old Flex.

You are expecting that once you implement such interface you will have
[Bindable] inherited ?

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-How-Binding-works-tp57096p62486.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] How Binding works?

Posted by yishayw <yi...@hotmail.com>.
In this [1] app, referencing the interface [2] results in a warning, but
referencing the implementer [3] does not.

So it looks like the problem is with bindable interfaces only.

Thanks.

[1] https://paste.apache.org/JmIV
[2] https://paste.apache.org/zxSB
[3] https://paste.apache.org/Qko2



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-How-Binding-works-tp57096p62492.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com.INVALID>.
It might be that the compiler is not handling [Bindable] on interfaces.
I'm pretty sure I've seen it work on classes.  If you can run a quick test
to prove that, then that should be fixed in the compiler.

But using [Bindable] sets up change events on the public properties in the
class and if the value of the property is effectively a constant, then you
can make your app smaller and faster by telling the subsystem that some
property won't be dispatching change events.

I don't know if defining the properties as "const" instead of "var" would
work or not.  Might be worth a try.

Some day in the future, I hope we find time to optimize binding to
constants.  And in this case, binding for localization.  If your app does
not support changing locales at runtime (it picks up locale at startup and
assumes it never changes), there is probably better code that could be
generated.

Thanks,
-Alex

On 6/20/17, 12:09 AM, "Yishay Weiss" <yi...@hotmail.com> wrote:

>I agree it’s wasteful, but there’s a lot of old code that we’re porting
>that uses this as a shortcut.  I’ve changed all interface get definitions
>to be prefixed with [Bindable("__NoChangeEvent__")] and the compiler now
>seems happy. It should probably be enough to add it the interface
>declaration instead.
>
>If I were to rewrite the code what syntax would you suggest instead of
><Label text="{locStrings.SEARCH}”/> ?
>
>From: Alex Harui<ma...@adobe.com.INVALID>
>Sent: Tuesday, June 20, 2017 9:57 AM
>To: dev@flex.apache.org<ma...@flex.apache.org>
>Subject: Re: [FlexJS] How Binding works?
>
>I believe the warning was that the value of PURCHASED could change.  The
>Bindable subsystem does not know that the getter will always return the
>same string literal.  If other stuff could change, but didn't specify a
>change event, I would hope the compiler would warn about that part of the
>bindable expression.
>
>IMO, one should never use plain [Bindable] with getters and setters.  That
>just wraps the getter/setter in another getter/setter with change event
>detection.  That adds up eventually both in code size and runtime.
>Suddenly you are making two function calls instead of one to access the
>underlying value.
>
>You could use [Bindable("__NoChangeEvent__")] if you know a value doesn't
>change but isn't a const.  You probably don't want to add listeners for
>when PURCHASED changes, just when the current location manager changes.
>
>Of course, I could be wrong.
>
>-Alex
>
>
>
>On 6/19/17, 11:28 PM, "yishayw" <yi...@hotmail.com> wrote:
>
>>It looks like changing the definitions of the interface and the class to
>>
>>               [Bindable]function get PURCHASED():String;
>>and
>>                [Bindable]public function get PURCHASED():String { return
>>"PURCHASED"; }
>>
>>worked.
>>
>>So is it a bug that declaring the class and the interface as bindable was
>>not enough?
>>
>>
>>
>>
>>
>>--
>>View this message in context:
>>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fl
>>e
>>x-development.2333347.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p62
>>4
>>85.html&data=02%7C01%7C%7Cdeee45fa75c74c1828da08d4b7a7f7f2%7Cfa7b1b5a7b34
>>4
>>38794aed2c178decee1%7C0%7C0%7C636335379433525746&sdata=uK6hxHRAC%2BkVi8%2
>>B
>>igjlqgOKAypeFlS1EwLbZ6qNniDk%3D&reserved=0
>>Sent from the Apache Flex Development mailing list archive at Nabble.com.
>


RE: [FlexJS] How Binding works?

Posted by Yishay Weiss <yi...@hotmail.com>.
I agree it’s wasteful, but there’s a lot of old code that we’re porting that uses this as a shortcut.  I’ve changed all interface get definitions to be prefixed with [Bindable("__NoChangeEvent__")] and the compiler now seems happy. It should probably be enough to add it the interface declaration instead.

If I were to rewrite the code what syntax would you suggest instead of <Label text="{locStrings.SEARCH}”/> ?

From: Alex Harui<ma...@adobe.com.INVALID>
Sent: Tuesday, June 20, 2017 9:57 AM
To: dev@flex.apache.org<ma...@flex.apache.org>
Subject: Re: [FlexJS] How Binding works?

I believe the warning was that the value of PURCHASED could change.  The
Bindable subsystem does not know that the getter will always return the
same string literal.  If other stuff could change, but didn't specify a
change event, I would hope the compiler would warn about that part of the
bindable expression.

IMO, one should never use plain [Bindable] with getters and setters.  That
just wraps the getter/setter in another getter/setter with change event
detection.  That adds up eventually both in code size and runtime.
Suddenly you are making two function calls instead of one to access the
underlying value.

You could use [Bindable("__NoChangeEvent__")] if you know a value doesn't
change but isn't a const.  You probably don't want to add listeners for
when PURCHASED changes, just when the current location manager changes.

Of course, I could be wrong.

-Alex



On 6/19/17, 11:28 PM, "yishayw" <yi...@hotmail.com> wrote:

>It looks like changing the definitions of the interface and the class to
>
>               [Bindable]function get PURCHASED():String;
>and
>                [Bindable]public function get PURCHASED():String { return
>"PURCHASED"; }
>
>worked.
>
>So is it a bug that declaring the class and the interface as bindable was
>not enough?
>
>
>
>
>
>--
>View this message in context:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-development.2333347.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p624
>85.html&data=02%7C01%7C%7Cdeee45fa75c74c1828da08d4b7a7f7f2%7Cfa7b1b5a7b344
>38794aed2c178decee1%7C0%7C0%7C636335379433525746&sdata=uK6hxHRAC%2BkVi8%2B
>igjlqgOKAypeFlS1EwLbZ6qNniDk%3D&reserved=0
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com.INVALID>.
I believe the warning was that the value of PURCHASED could change.  The
Bindable subsystem does not know that the getter will always return the
same string literal.  If other stuff could change, but didn't specify a
change event, I would hope the compiler would warn about that part of the
bindable expression.

IMO, one should never use plain [Bindable] with getters and setters.  That
just wraps the getter/setter in another getter/setter with change event
detection.  That adds up eventually both in code size and runtime.
Suddenly you are making two function calls instead of one to access the
underlying value.

You could use [Bindable("__NoChangeEvent__")] if you know a value doesn't
change but isn't a const.  You probably don't want to add listeners for
when PURCHASED changes, just when the current location manager changes.

Of course, I could be wrong.

-Alex



On 6/19/17, 11:28 PM, "yishayw" <yi...@hotmail.com> wrote:

>It looks like changing the definitions of the interface and the class to
>
>		[Bindable]function get PURCHASED():String;
>and
>               	[Bindable]public function get PURCHASED():String { return
>"PURCHASED"; }
>
>worked.
>
>So is it a bug that declaring the class and the interface as bindable was
>not enough?
>
>
>
>
>
>--
>View this message in context:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-development.2333347.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p624
>85.html&data=02%7C01%7C%7Cdeee45fa75c74c1828da08d4b7a7f7f2%7Cfa7b1b5a7b344
>38794aed2c178decee1%7C0%7C0%7C636335379433525746&sdata=uK6hxHRAC%2BkVi8%2B
>igjlqgOKAypeFlS1EwLbZ6qNniDk%3D&reserved=0
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


RE: [FlexJS] How Binding works?

Posted by yishayw <yi...@hotmail.com>.
It looks like changing the definitions of the interface and the class to 

		[Bindable]function get PURCHASED():String;
and
               	[Bindable]public function get PURCHASED():String { return
"PURCHASED"; }

worked.

So is it a bug that declaring the class and the interface as bindable was
not enough?





--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-How-Binding-works-tp57096p62485.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

RE: [FlexJS] How Binding works?

Posted by Yishay Weiss <yi...@hotmail.com>.
                                public function get PURCHASED():String { return "PURCHASED"; }

But the class has

                [Bindable]public class DefaultStrings implements IUIStrings

From: Alex Harui<ma...@adobe.com.INVALID>
Sent: Tuesday, June 20, 2017 9:33 AM
To: dev@flex.apache.org<ma...@flex.apache.org>
Subject: Re: [FlexJS] How Binding works?

How is PURCHASED defined?

On 6/19/17, 11:10 PM, "yishayw" <yi...@hotmail.com> wrote:

>We have an mxml component where
>
>                       [Bindable]public var locStrings:IUIStrings =
>LocaleManager.localeStrings;
>...
>                        <js:beads>
>                           <js:ContainerDataBinding/>
>                       </js:beads>
>...
>                        <js:TextButton  text="{locStrings.PURCHASED}"/>
>
>LocaleManager is declared thus:
>
>                       [Bindable]
>                       public class LocaleManager
>
>and it has:
>                        public static function get
>localeStrings():IUIStrings
>
>where IUIString is declared thus:
>
>                       [Bindable]public interface IUIStrings
>
>and its implementation is declares like this:
>
>                       [Bindable]public class DefaultStrings implements
>IUIStrings
>
>Can anyone explain why I'm seeing this?
>
>                       Data binding will not be able to detect assignments
>to 'PURCHASED'.
>
>
>
>
>
>--
>View this message in context:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-development.2333347.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p624
>81.html&data=02%7C01%7C%7Cb672a18d7b984dac8a1008d4b7a56890%7Cfa7b1b5a7b344
>38794aed2c178decee1%7C0%7C0%7C636335368449199077&sdata=B9M048Wm1IsFYGOD%2F
>WAwrNhEmrJvAVEWXyPfP4MFuIQ%3D&reserved=0
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com.INVALID>.
How is PURCHASED defined?

On 6/19/17, 11:10 PM, "yishayw" <yi...@hotmail.com> wrote:

>We have an mxml component where
>
>			[Bindable]public var locStrings:IUIStrings =
>LocaleManager.localeStrings;
>...
>                        <js:beads>
>       		           <js:ContainerDataBinding/>
>	                </js:beads>
>...
>                        <js:TextButton  text="{locStrings.PURCHASED}"/>
>
>LocaleManager is declared thus:
>
>	                [Bindable]
>	                public class LocaleManager
>
>and it has:
>                        public static function get
>localeStrings():IUIStrings
>
>where IUIString is declared thus:
>
>	                [Bindable]public interface IUIStrings
>
>and its implementation is declares like this:
>
>                       [Bindable]public class DefaultStrings implements
>IUIStrings
>
>Can anyone explain why I'm seeing this?
>
>                       Data binding will not be able to detect assignments
>to 'PURCHASED'.
>
>
>
>
>
>--
>View this message in context:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-development.2333347.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p624
>81.html&data=02%7C01%7C%7Cb672a18d7b984dac8a1008d4b7a56890%7Cfa7b1b5a7b344
>38794aed2c178decee1%7C0%7C0%7C636335368449199077&sdata=B9M048Wm1IsFYGOD%2F
>WAwrNhEmrJvAVEWXyPfP4MFuIQ%3D&reserved=0
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: [FlexJS] How Binding works?

Posted by yishayw <yi...@hotmail.com>.
We have an mxml component where

			[Bindable]public var locStrings:IUIStrings = LocaleManager.localeStrings;
...
                        <js:beads>
       		           <js:ContainerDataBinding/>
	                </js:beads>
...
                        <js:TextButton  text="{locStrings.PURCHASED}"/>

LocaleManager is declared thus:

	                [Bindable]
	                public class LocaleManager

and it has:
                        public static function get
localeStrings():IUIStrings

where IUIString is declared thus:

	                [Bindable]public interface IUIStrings

and its implementation is declares like this:

                       [Bindable]public class DefaultStrings implements
IUIStrings

Can anyone explain why I'm seeing this?

                       Data binding will not be able to detect assignments
to 'PURCHASED'.





--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/FlexJS-How-Binding-works-tp57096p62481.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com>.
Well, that is a legitimate warning, but is innocuous.  I'm tempted to try
to figure out how to tell Maven to accept these warnings, but I don't know
how to do that.  That's why the Ant builds work.  Or get the compiler to
suppress the warning.

The other answer is to switch to ValueObjects if you are just using plain
Object.  Then your binding expression would look like
"{MyValueObject(data).label}.  MyValueObject would have to have the
appropriate [Bindable] metadata.

-Alex

On 12/9/16, 8:39 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:

>Hi Alex,
>
>just updated all commits and test your ItemRenderer and is not working, do
>you know what could be?
>
>The project 'App' has been successfully compiled and optimized.
>/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/examples/flexjs/MDLEx
>ample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
>col: 12 Data binding will not be able to detect assignments to 'label'.
>text="{data.label}" >
>           ^
>[INFO]
>------------------------------------------------------------------------
>[INFO] BUILD FAILURE
>
>
>2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:
>
>>
>>
>> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos
>>Rovira"
>> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org> wrote:
>>
>> >Hi
>> >
>> >I need to know how to deal with data binding in different situations,
>> >ItemRenderer, View, Container, Component, Bead,...
>> >
>> >I saw various classes ConstantBinding, ViewBeadBinding...
>> >
>> >Hope someone could share the main principles of Binding in FlexJS
>>
>> Binding in the regular Flex SDK is extremely wasteful.  That's why we
>> often see folks recommend that you start taking out data bindings when
>>you
>> have performance issues.  Flex Mobile default item renderers are written
>> in AS instead of MXML for that reason. Binding in general has to
>> "highly-sensitive".  It needs to look for all kinds of possible change
>> conditions, such as the source or destination being changed as well as
>>the
>> property on the source being changed.  In the regular Flex SDK, this
>> highly-sensitive detection mechanism is used everywhere you use binding
>> expressions.
>>
>> in FlexJS, we want to have different implementations based on certain
>> scenarios.  There are classes named XXXDataBinding (vs YYYBinding) that
>> implement a change detection mechanism specific to that scenario.  So
>> ViewDataBinding knows that most data bindings will probably be from the
>> applicationModel property to various controls.  The various
>>XXXDataBinding
>> implementations use the YYYBinding classes like ConstantBinding and
>> SimpleBinding to optimize for certain patterns that don't require as
>>much
>> overhead to set up.  There is a GenericBinding for everything else.
>>Also,
>> having a choice of YYYBinding classes allows the developer to not use {}
>> expressions and simply add a YYYBindingClass as a bead and get binding
>>to
>> work without the overhead of the compiler setting up a data structure
>>for
>> the XXXDataBindingClass to interpret at instantiation time.  So, this is
>> another example of PAYG.  You can be lazy and have the compiler and
>> framework figure out what to do with a {} expression, or you can save
>>code
>> by manually implementing it, or you can save even more by writing AS to
>> addEventListener for the right thing at the right time.
>>
>> Anyway, you mentioned ItemRenderer above, and I found out yesterday that
>> ItemRenderer binding needed its own implementation.  It can take
>>advantage
>> of knowing that if you bind to data.something, that there is no need to
>> set change detection for the source or destination objects.  It knows
>>that
>> the only trigger is when in the item renderer lifecycle, the data
>>property
>> is set.  I just pushed that change.  Now my renderer looks like:
>>
>> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>>                      xmlns:js="library://ns.apache.org/flexjs/basic"
>>                      width="100%">
>> <js:beads>
>>         <js:VerticalLayout />
>>         <js:ItemRendererDataBinding />
>>     </js:beads>
>>     <js:Label width="100%" height="30" style="fontWeight:bold"
>> text="{data.qname}" >
>>     </js:Label>
>>     <js:MultilineLabel id="description" width="100%"
>> text="{data.description}" />
>> </js:MXMLItemRenderer>
>>
>>
>>
>> HTH,
>> -Alex
>>
>>
>
>
>-- 
>
>Carlos Rovira
>Director General
>M: +34 607 22 60 05
>http://www.codeoscopic.com
>http://www.avant2.es
>
>Este mensaje se dirige exclusivamente a su destinatario y puede contener
>información privilegiada o confidencial. Si ha recibido este mensaje por
>error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
>proceda a su destrucción.
>
>De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>comunicamos
>que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
>S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>servicio o información solicitados, teniendo usted derecho de acceso,
>rectificación, cancelación y oposición de sus datos dirigiéndose a
>nuestras
>oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
>necesaria.


Re: [FlexJS] How Binding works?

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Hi Alex,

just updated all commits and test your ItemRenderer and is not working, do
you know what could be?

The project 'App' has been successfully compiled and optimized.
/Users/carlosrovira/Dev/Flex/source/flexjs/flex-asjs/examples/flexjs/MDLExample/src/main/flex/itemRenderers/CustomListItemRenderer.mxml(28):
col: 12 Data binding will not be able to detect assignments to 'label'.
text="{data.label}" >
           ^
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE


2016-12-09 16:25 GMT+01:00 Alex Harui <ah...@adobe.com>:

>
>
> On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org> wrote:
>
> >Hi
> >
> >I need to know how to deal with data binding in different situations,
> >ItemRenderer, View, Container, Component, Bead,...
> >
> >I saw various classes ConstantBinding, ViewBeadBinding...
> >
> >Hope someone could share the main principles of Binding in FlexJS
>
> Binding in the regular Flex SDK is extremely wasteful.  That's why we
> often see folks recommend that you start taking out data bindings when you
> have performance issues.  Flex Mobile default item renderers are written
> in AS instead of MXML for that reason. Binding in general has to
> "highly-sensitive".  It needs to look for all kinds of possible change
> conditions, such as the source or destination being changed as well as the
> property on the source being changed.  In the regular Flex SDK, this
> highly-sensitive detection mechanism is used everywhere you use binding
> expressions.
>
> in FlexJS, we want to have different implementations based on certain
> scenarios.  There are classes named XXXDataBinding (vs YYYBinding) that
> implement a change detection mechanism specific to that scenario.  So
> ViewDataBinding knows that most data bindings will probably be from the
> applicationModel property to various controls.  The various XXXDataBinding
> implementations use the YYYBinding classes like ConstantBinding and
> SimpleBinding to optimize for certain patterns that don't require as much
> overhead to set up.  There is a GenericBinding for everything else.  Also,
> having a choice of YYYBinding classes allows the developer to not use {}
> expressions and simply add a YYYBindingClass as a bead and get binding to
> work without the overhead of the compiler setting up a data structure for
> the XXXDataBindingClass to interpret at instantiation time.  So, this is
> another example of PAYG.  You can be lazy and have the compiler and
> framework figure out what to do with a {} expression, or you can save code
> by manually implementing it, or you can save even more by writing AS to
> addEventListener for the right thing at the right time.
>
> Anyway, you mentioned ItemRenderer above, and I found out yesterday that
> ItemRenderer binding needed its own implementation.  It can take advantage
> of knowing that if you bind to data.something, that there is no need to
> set change detection for the source or destination objects.  It knows that
> the only trigger is when in the item renderer lifecycle, the data property
> is set.  I just pushed that change.  Now my renderer looks like:
>
> <js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
>                      xmlns:js="library://ns.apache.org/flexjs/basic"
>                      width="100%">
> <js:beads>
>         <js:VerticalLayout />
>         <js:ItemRendererDataBinding />
>     </js:beads>
>     <js:Label width="100%" height="30" style="fontWeight:bold"
> text="{data.qname}" >
>     </js:Label>
>     <js:MultilineLabel id="description" width="100%"
> text="{data.description}" />
> </js:MXMLItemRenderer>
>
>
>
> HTH,
> -Alex
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Re: [FlexJS] How Binding works?

Posted by Alex Harui <ah...@adobe.com>.

On 12/9/16, 5:35 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlosrovira@apache.org> wrote:

>Hi
>
>I need to know how to deal with data binding in different situations,
>ItemRenderer, View, Container, Component, Bead,...
>
>I saw various classes ConstantBinding, ViewBeadBinding...
>
>Hope someone could share the main principles of Binding in FlexJS

Binding in the regular Flex SDK is extremely wasteful.  That's why we
often see folks recommend that you start taking out data bindings when you
have performance issues.  Flex Mobile default item renderers are written
in AS instead of MXML for that reason. Binding in general has to
"highly-sensitive".  It needs to look for all kinds of possible change
conditions, such as the source or destination being changed as well as the
property on the source being changed.  In the regular Flex SDK, this
highly-sensitive detection mechanism is used everywhere you use binding
expressions.

in FlexJS, we want to have different implementations based on certain
scenarios.  There are classes named XXXDataBinding (vs YYYBinding) that
implement a change detection mechanism specific to that scenario.  So
ViewDataBinding knows that most data bindings will probably be from the
applicationModel property to various controls.  The various XXXDataBinding
implementations use the YYYBinding classes like ConstantBinding and
SimpleBinding to optimize for certain patterns that don't require as much
overhead to set up.  There is a GenericBinding for everything else.  Also,
having a choice of YYYBinding classes allows the developer to not use {}
expressions and simply add a YYYBindingClass as a bead and get binding to
work without the overhead of the compiler setting up a data structure for
the XXXDataBindingClass to interpret at instantiation time.  So, this is
another example of PAYG.  You can be lazy and have the compiler and
framework figure out what to do with a {} expression, or you can save code
by manually implementing it, or you can save even more by writing AS to
addEventListener for the right thing at the right time.

Anyway, you mentioned ItemRenderer above, and I found out yesterday that
ItemRenderer binding needed its own implementation.  It can take advantage
of knowing that if you bind to data.something, that there is no need to
set change detection for the source or destination objects.  It knows that
the only trigger is when in the item renderer lifecycle, the data property
is set.  I just pushed that change.  Now my renderer looks like:

<js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:js="library://ns.apache.org/flexjs/basic"
                     width="100%">
<js:beads>
        <js:VerticalLayout />
        <js:ItemRendererDataBinding />
    </js:beads>
    <js:Label width="100%" height="30" style="fontWeight:bold"
text="{data.qname}" >
    </js:Label>
    <js:MultilineLabel id="description" width="100%"
text="{data.description}" />
</js:MXMLItemRenderer>



HTH,
-Alex