Re: [FlexJS] How Binding works?
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.247.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?
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" <yishayj...@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 >mailto:aha...@adobe.com.INVALID> >Sent: Tuesday, June 20, 2017 9:57 AM >To: dev@flex.apache.org<mailto:dev@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" <yishayj...@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.247.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p62 >>4 >>85.html=02%7C01%7C%7Cdeee45fa75c74c1828da08d4b7a7f7f2%7Cfa7b1b5a7b34 >>4 >>38794aed2c178decee1%7C0%7C0%7C636335379433525746=uK6hxHRAC%2BkVi8%2 >>B >>igjlqgOKAypeFlS1EwLbZ6qNniDk%3D=0 >>Sent from the Apache Flex Development mailing list archive at Nabble.com. >
RE: [FlexJS] How Binding works?
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 mailto:aha...@adobe.com.INVALID> Sent: Tuesday, June 20, 2017 9:57 AM To: dev@flex.apache.org<mailto:dev@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" <yishayj...@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.247.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p624 >85.html=02%7C01%7C%7Cdeee45fa75c74c1828da08d4b7a7f7f2%7Cfa7b1b5a7b344 >38794aed2c178decee1%7C0%7C0%7C636335379433525746=uK6hxHRAC%2BkVi8%2B >igjlqgOKAypeFlS1EwLbZ6qNniDk%3D=0 >Sent from the Apache Flex Development mailing list archive at Nabble.com.
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"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.247.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p624 >85.html=02%7C01%7C%7Cdeee45fa75c74c1828da08d4b7a7f7f2%7Cfa7b1b5a7b344 >38794aed2c178decee1%7C0%7C0%7C636335379433525746=uK6hxHRAC%2BkVi8%2B >igjlqgOKAypeFlS1EwLbZ6qNniDk%3D=0 >Sent from the Apache Flex Development mailing list archive at Nabble.com.
RE: [FlexJS] How Binding works?
It’s more to let the compiler know the implementations are bindable. I don’t expect them to automatically become bindable. From: piotrz<mailto:piotrzarzyck...@gmail.com> Sent: Tuesday, June 20, 2017 9:52 AM To: dev@flex.apache.org<mailto:dev@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 piotrzarzyck...@gmail.com -- View this message in context: http://apache-flex-development.247.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?
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 piotrzarzyck...@gmail.com -- View this message in context: http://apache-flex-development.247.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?
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.247.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?
public function get PURCHASED():String { return "PURCHASED"; } But the class has [Bindable]public class DefaultStrings implements IUIStrings From: Alex Harui<mailto:aha...@adobe.com.INVALID> Sent: Tuesday, June 20, 2017 9:33 AM To: dev@flex.apache.org<mailto:dev@flex.apache.org> Subject: Re: [FlexJS] How Binding works? How is PURCHASED defined? On 6/19/17, 11:10 PM, "yishayw" <yishayj...@hotmail.com> wrote: >We have an mxml component where > > [Bindable]public var locStrings:IUIStrings = >LocaleManager.localeStrings; >... > > > >... > > >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.247.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p624 >81.html=02%7C01%7C%7Cb672a18d7b984dac8a1008d4b7a56890%7Cfa7b1b5a7b344 >38794aed2c178decee1%7C0%7C0%7C636335368449199077=B9M048Wm1IsFYGOD%2F >WAwrNhEmrJvAVEWXyPfP4MFuIQ%3D=0 >Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS] How Binding works?
How is PURCHASED defined? On 6/19/17, 11:10 PM, "yishayw"wrote: >We have an mxml component where > > [Bindable]public var locStrings:IUIStrings = >LocaleManager.localeStrings; >... > > > >... > > >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.247.n4.nabble.com%2FFlexJS-How-Binding-works-tp57096p624 >81.html=02%7C01%7C%7Cb672a18d7b984dac8a1008d4b7a56890%7Cfa7b1b5a7b344 >38794aed2c178decee1%7C0%7C0%7C636335368449199077=B9M048Wm1IsFYGOD%2F >WAwrNhEmrJvAVEWXyPfP4MFuIQ%3D=0 >Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS] How Binding works?
We have an mxml component where [Bindable]public var locStrings:IUIStrings = LocaleManager.localeStrings; ... ... 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.247.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?
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 piotrzarzyck...@gmail.com -- View this message in context: http://apache-flex-development.247.n4.nabble.com/FlexJS-How-Binding-works-tp57096p5.html Sent from the Apache Flex Development mailing list archive at Nabble.com.
Re: [FlexJS] How Binding works?
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.rov...@gmail.com im Auftrag von Carlos Rovira" <carlos.rov...@gmail.com im Auftrag von carlos.rov...@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 <christofer.d...@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 <carlos.rov...@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 <christofer.d...@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.d...@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" <aha...@adobe.com>: > > > > > > > > On 12/9/16, 1:08 PM, "Christofer Dutz" < > christofer.d...@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 E
Re: [FlexJS] How Binding works?
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 <christofer.d...@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 <carlos.rov...@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 <christofer.d...@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.d...@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" <aha...@adobe.com>: > > > > > > > > On 12/9/16, 1:08 PM, "Christofer Dutz" < > christofer.d...@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?
On 12/9/16, 2:45 PM, "carlos.rov...@gmail.com on behalf of Carlos Rovira"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?
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": 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" : On 12/9/16, 1:08 PM, "Christofer Dutz" 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?
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": On 12/9/16, 1:08 PM, "Christofer Dutz" 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?
On 12/9/16, 1:08 PM, "Christofer Dutz"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?
On 12/9/16, 12:02 PM, "carlos.rov...@gmail.com on behalf of Carlos Rovira"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?
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": 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" 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.rov...@gmail.com im Auftrag von Carlos >Rovira" carlos.rov...@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 > : > >> 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" : >> >> 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.rov...@gmail.com on behalf of >Carlos >> Rovira" >> carlos.rov...@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 : >> > >> >> >> >> >> >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of >Carlos >> >>Rovira" >> >> carlosrov...@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 >> >>
Re: [FlexJS] How Binding works?
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"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.rov...@gmail.com im Auftrag von Carlos >Rovira" carlos.rov...@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 > : > >> 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" : >> >> 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.rov...@gmail.com on behalf of >Carlos >> Rovira" >> carlos.rov...@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 : >> > >> >> >> >> >> >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of >Carlos >> >>Rovira" >> >> carlosrov...@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 >>
Re: [FlexJS][Maven] Build failure caused by compiler warnings (was: Re: [FlexJS] How Binding works?)
I just comitted a change to allow a return value of 2 in flexjs-compiler/flexjs-maven-plugin/src/main/java/org/apache/flex/maven/flexjs/BaseMojo.java (Line 227) Chris Am 09.12.16, 22:00 schrieb "Alex Harui": On 12/9/16, 11:54 AM, "Christofer Dutz" wrote: >The maven build will not fail because of this. All it does is output >warnings. > >If it does fail, this is definitely something we need to fix. I observed that the SWF build output the warning and apparently did not think that was a failure because it continued on to the JS build, output the same warnings, and then Maven reported failure. The Ant build seems to allow both a return code of 0 and 2. What are Maven's or the Mojo's rules? Thanks, -Alex
Re: [FlexJS][Maven] Build failure caused by compiler warnings (was: Re: [FlexJS] How Binding works?)
On 12/9/16, 11:54 AM, "Christofer Dutz"wrote: >The maven build will not fail because of this. All it does is output >warnings. > >If it does fail, this is definitely something we need to fix. I observed that the SWF build output the warning and apparently did not think that was a failure because it continued on to the JS build, output the same warnings, and then Maven reported failure. The Ant build seems to allow both a return code of 0 and 2. What are Maven's or the Mojo's rules? Thanks, -Alex
Re: [FlexJS] How Binding works?
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.rov...@gmail.com im Auftrag von Carlos Rovira": 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 : > 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" : > > 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.rov...@gmail.com on behalf of Carlos > Rovira" > > 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 : > > > >> > >> > >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos > >>Rovira" > >> > 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 >
Re: [FlexJS] How Binding works?
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: > 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" : > > 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.rov...@gmail.com on behalf of Carlos > Rovira" > > 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 : > > > >> > >> > >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos > >>Rovira" > >> > 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
Re: [FlexJS] How Binding works?
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: 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;> 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: > 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.rov...@gmail.com on behalf of Carlos Rovira" > > wrote: > > >I tried this, but with no luck, still doesn't output nothing: > > > >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;> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >2016-12-09 19:59 GMT+01:00 Alex Harui : > > > >> 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.rov...@gmail.com on behalf of Carlos > >>Rovira" > >> > >> wrote: > >> > >> >Hi Alex, > >> > > >> >I get to work as you said, but trying to make a bindable var to reduce > >> >verbosity like this: > >> > > >> >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;> > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> > > >> >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 : > >> > > >> >> 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.rov...@gmail.com on behalf of Carlos > >> >>Rovira" > >> >> > >> >> 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 : > >> >> > > >> >> >> > >> >> >> > >> >> >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos > >> >> >>Rovira" > >> >> >> > >> 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
Re: [FlexJS] How Binding works?
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": 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.rov...@gmail.com on behalf of Carlos Rovira" 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 : > >> >> >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos >>Rovira" >> 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: >> >> http://ns.adobe.com/mxml/2009; >> xmlns:js="library://ns.apache.org/flexjs/basic" >> width="100%"> >> >> >> >> >> > text="{data.qname}" > >> >> > text="{data.description}" /> >> >>
Re: [FlexJS][Maven] Build failure caused by compiler warnings (was: Re: [FlexJS] How Binding works?)
The maven build will not fail because of this. All it does is output warnings. If it does fail, this is definitely something we need to fix. Chris Am 09.12.16, 19:50 schrieb "Alex Harui": On 12/9/16, 10:25 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira" wrote: >You're right, compile is working, but message was confused (BUILD FAILURE) > >Maybe Chris could help with this? Well, I'm sure he can, but Chris did want our stuff to compile without warnings, so I think he set Maven to fail on warnings. I'm fine with that rule: we should have ways to suppress warnings individually because sometimes a warning is important. The binding warning is legitimate. It says that there aren't change events for data.foo. That could bite you some day, but is ok in this particular situation. The "correct" answer is to use ValueObjects and cast the data binding expression as I showed, but that can be a pain for prototyping. It turns out that with FlexJS, you can suppress this binding warning for simple binding expressions by making a fake ValueObject with the required properties and casting. The data binding code doesn't type-check so you can get away with it. I just pushed a prototype of an ASDoc app with a fake ValueObject and suppressed warnings via casting in the SummaryRenderer.mxml and DetailRenderer.mxml HTH, -Alex >>> >> >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}" > >> > ^
Re: [FlexJS] How Binding works?
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.rov...@gmail.com on behalf of Carlos Rovira"wrote: >I tried this, but with no luck, still doesn't output nothing: > >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;> > > > > > > > > > > > > > > > >2016-12-09 19:59 GMT+01:00 Alex Harui : > >> 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.rov...@gmail.com on behalf of Carlos >>Rovira" >> >> wrote: >> >> >Hi Alex, >> > >> >I get to work as you said, but trying to make a bindable var to reduce >> >verbosity like this: >> > >> >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;> >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> >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 : >> > >> >> 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.rov...@gmail.com on behalf of Carlos >> >>Rovira" >> >> >> >> 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 : >> >> > >> >> >> >> >> >> >> >> >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos >> >> >>Rovira" >> >> >> >> 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 >>
Re: [FlexJS][Maven] Build failure caused by compiler warnings (was: Re: [FlexJS] How Binding works?)
On 12/9/16, 11:04 AM, "omup...@gmail.com on behalf of OmPrakash Muppirala"wrote: >Even if the class as marked as Bindable? If I understand your plan, yes. When you write {data.foo}, the binding system is trying to detect not only changes to foo, but also data. If you say that data is of a marker type IBindableObject, there is no foo property defined on that interface, so there is no way to figure out what change event would be dispatched. Also, in my case, I'm just using plain Objects underneath. If I'm going to actually use a ValueObject, then casting in some way is "better", but it would be nice to have a way to use plain Objects and suppress the individual warnings. -Alex
Re: [FlexJS] How Binding works?
I tried this, but with no luck, still doesn't output nothing: 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;> 2016-12-09 19:59 GMT+01:00 Alex Harui: > 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.rov...@gmail.com on behalf of Carlos Rovira" > > wrote: > > >Hi Alex, > > > >I get to work as you said, but trying to make a bindable var to reduce > >verbosity like this: > > > >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;> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >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 : > > > >> 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.rov...@gmail.com on behalf of Carlos > >>Rovira" > >> > >> 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 : > >> > > >> >> > >> >> > >> >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos > >> >>Rovira" > >> >> > 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 > >>
Re: [FlexJS][Maven] Build failure caused by compiler warnings (was: Re: [FlexJS] How Binding works?)
Even if the class as marked as Bindable? On Fri, Dec 9, 2016 at 11:03 AM, Alex Haruiwrote: > > > On 12/9/16, 10:59 AM, "omup...@gmail.com on behalf of OmPrakash Muppirala" > wrote: > > >On Fri, Dec 9, 2016 at 10:50 AM, Alex Harui wrote: > >> > >> The binding warning is legitimate. It says that there aren't change > >> events for data.foo. That could bite you some day, but is ok in this > >> particular situation. The "correct" answer is to use ValueObjects and > >> cast the data binding expression as I showed, but that can be a pain for > >> prototyping. It turns out that with FlexJS, you can suppress this > >>binding > >> warning for simple binding expressions by making a fake ValueObject with > >> the required properties and casting. The data binding code doesn't > >> type-check so you can get away with it. I just pushed a prototype of an > >> ASDoc app with a fake ValueObject and suppressed warnings via casting in > >> the SummaryRenderer.mxml and DetailRenderer.mxml > >> > >> > >I am wondering if we should create a new marker interface like > >IBindableObject and use that in the data setter/getter? > > > >Something like: > > > >public function set data(v:IBindableObject) { > >} > > > >And my value objects look like this: > > > >[Bindable] > >public class SimpleVO implements IBindableObject { > >... > >} > > > >IBindableObject could just be an empty, i.e. marker interface. > > > >Then there is no need to cast in the code. Also, maybe the compiler can > >be > >trained to not throw bindable warnings when it sees IBindableObject as the > >type? > > > >Not sure if I am missing something with this approach. > > I don't think that would help. The individual properties on data still > wouldn't have any change event metadata. > > -Alex > >
Re: [FlexJS][Maven] Build failure caused by compiler warnings (was: Re: [FlexJS] How Binding works?)
On 12/9/16, 10:59 AM, "omup...@gmail.com on behalf of OmPrakash Muppirala"wrote: >On Fri, Dec 9, 2016 at 10:50 AM, Alex Harui wrote: >> >> The binding warning is legitimate. It says that there aren't change >> events for data.foo. That could bite you some day, but is ok in this >> particular situation. The "correct" answer is to use ValueObjects and >> cast the data binding expression as I showed, but that can be a pain for >> prototyping. It turns out that with FlexJS, you can suppress this >>binding >> warning for simple binding expressions by making a fake ValueObject with >> the required properties and casting. The data binding code doesn't >> type-check so you can get away with it. I just pushed a prototype of an >> ASDoc app with a fake ValueObject and suppressed warnings via casting in >> the SummaryRenderer.mxml and DetailRenderer.mxml >> >> >I am wondering if we should create a new marker interface like >IBindableObject and use that in the data setter/getter? > >Something like: > >public function set data(v:IBindableObject) { >} > >And my value objects look like this: > >[Bindable] >public class SimpleVO implements IBindableObject { >... >} > >IBindableObject could just be an empty, i.e. marker interface. > >Then there is no need to cast in the code. Also, maybe the compiler can >be >trained to not throw bindable warnings when it sees IBindableObject as the >type? > >Not sure if I am missing something with this approach. I don't think that would help. The individual properties on data still wouldn't have any change event metadata. -Alex
Re: [FlexJS][Maven] Build failure caused by compiler warnings (was: Re: [FlexJS] How Binding works?)
On Fri, Dec 9, 2016 at 10:50 AM, Alex Haruiwrote: > > > On 12/9/16, 10:25 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira" > wrote: > > >You're right, compile is working, but message was confused (BUILD FAILURE) > > > >Maybe Chris could help with this? > > Well, I'm sure he can, but Chris did want our stuff to compile without > warnings, so I think he set Maven to fail on warnings. I'm fine with that > rule: we should have ways to suppress warnings individually because > sometimes a warning is important. > > The binding warning is legitimate. It says that there aren't change > events for data.foo. That could bite you some day, but is ok in this > particular situation. The "correct" answer is to use ValueObjects and > cast the data binding expression as I showed, but that can be a pain for > prototyping. It turns out that with FlexJS, you can suppress this binding > warning for simple binding expressions by making a fake ValueObject with > the required properties and casting. The data binding code doesn't > type-check so you can get away with it. I just pushed a prototype of an > ASDoc app with a fake ValueObject and suppressed warnings via casting in > the SummaryRenderer.mxml and DetailRenderer.mxml > > I am wondering if we should create a new marker interface like IBindableObject and use that in the data setter/getter? Something like: public function set data(v:IBindableObject) { } And my value objects look like this: [Bindable] public class SimpleVO implements IBindableObject { ... } IBindableObject could just be an empty, i.e. marker interface. Then there is no need to cast in the code. Also, maybe the compiler can be trained to not throw bindable warnings when it sees IBindableObject as the type? Not sure if I am missing something with this approach. Thanks, Om > HTH, > -Alex > > > >>> > >> >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}" > > >> > ^ > >
Re: [FlexJS] How Binding works?
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.rov...@gmail.com on behalf of Carlos Rovira"wrote: >Hi Alex, > >I get to work as you said, but trying to make a bindable var to reduce >verbosity like this: > >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;> > > > > > > > > > > > > > > >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 : > >> 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.rov...@gmail.com on behalf of Carlos >>Rovira" >> >> 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 : >> > >> >> >> >> >> >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos >> >>Rovira" >> >> 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
Re: [FlexJS] How Binding works?
Hi Alex, I get to work as you said, but trying to make a bindable var to reduce verbosity like this: 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;> 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: > 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.rov...@gmail.com on behalf of Carlos Rovira" > > 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 : > > > >> > >> > >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos > >>Rovira" > >> 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: > >> > >> http://ns.adobe.com/mxml/2009; > >> xmlns:js="library://ns.apache.org/flexjs/basic" > >> width="100%"> > >> > >> > >> > >> > >> >> text="{data.qname}" > > >> > >> >> text="{data.description}" /> > >> > >> > >> > >> > >> HTH, > >> -Alex > >> >
Re: [FlexJS][Maven] Build failure caused by compiler warnings (was: Re: [FlexJS] How Binding works?)
On 12/9/16, 10:25 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira"wrote: >You're right, compile is working, but message was confused (BUILD FAILURE) > >Maybe Chris could help with this? Well, I'm sure he can, but Chris did want our stuff to compile without warnings, so I think he set Maven to fail on warnings. I'm fine with that rule: we should have ways to suppress warnings individually because sometimes a warning is important. The binding warning is legitimate. It says that there aren't change events for data.foo. That could bite you some day, but is ok in this particular situation. The "correct" answer is to use ValueObjects and cast the data binding expression as I showed, but that can be a pain for prototyping. It turns out that with FlexJS, you can suppress this binding warning for simple binding expressions by making a fake ValueObject with the required properties and casting. The data binding code doesn't type-check so you can get away with it. I just pushed a prototype of an ASDoc app with a fake ValueObject and suppressed warnings via casting in the SummaryRenderer.mxml and DetailRenderer.mxml HTH, -Alex >>> >> >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}" > >> > ^
[FlexJS][Maven] Build failure caused by compiler warnings (was: Re: [FlexJS] How Binding works?)
You're right, compile is working, but message was confused (BUILD FAILURE) Maybe Chris could help with this? 2016-12-09 17:48 GMT+01:00 Alex Harui: > 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. > > > On 12/9/16, 8:39 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira" > > 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 > > > > >
Re: [FlexJS] How Binding works?
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.rov...@gmail.com on behalf of Carlos Rovira"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 : > >> >> >> On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos >>Rovira" >> 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: >> >> http://ns.adobe.com/mxml/2009; >> xmlns:js="library://ns.apache.org/flexjs/basic" >> width="100%"> >> >> >> >> >> > text="{data.qname}" > >> >> > text="{data.description}" /> >> >> >> >> >> 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
Re: [FlexJS] How Binding works?
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: > > > On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira" > 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: > > http://ns.adobe.com/mxml/2009; > xmlns:js="library://ns.apache.org/flexjs/basic" > width="100%"> > > > > > text="{data.qname}" > > > text="{data.description}" /> > > > > > 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?
On 12/9/16, 5:35 AM, "carlos.rov...@gmail.com on behalf of Carlos Rovira"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: http://ns.adobe.com/mxml/2009; xmlns:js="library://ns.apache.org/flexjs/basic" width="100%"> HTH, -Alex