[flexcoders] Re: Bindable Classes
Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions [EMAIL PROTECTED]wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Re: Bindable Classes
What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class-level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions [EMAIL PROTECTED]wrote: Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions [EMAIL PROTECTED]wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Re: Bindable Classes
using custom events with your bindable metadata is not only best practice but allows you to decide which properties you want to refresh. [Bindable(myEvent)] i would recomend using this at all times. On Wed, Sep 3, 2008 at 1:04 PM, Josh McDonald [EMAIL PROTECTED] wrote: What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class-level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions [EMAIL PROTECTED]wrote: Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions [EMAIL PROTECTED]wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- j:pn \\no comment
[flexcoders] Re: Bindable Classes
But then you have to write all the event creation and dispatch, plus all the getter/setter. That might be fair enough if you have a handful of props but if this is a couple of data classes with says 100 props each thats quite a bit of typing when all you want is a couple of props not to fire events when they change... unless there is a tool to generate the code from a list of variables. Personally in some cases I use custom events and others I am ok with the default handling, depends on what I am doing as to which is more suited to the situation. --- In flexcoders@yahoogroups.com, Johannes Nel [EMAIL PROTECTED] wrote: using custom events with your bindable metadata is not only best practice but allows you to decide which properties you want to refresh. [Bindable(myEvent)] i would recomend using this at all times. On Wed, Sep 3, 2008 at 1:04 PM, Josh McDonald [EMAIL PROTECTED] wrote: What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class-level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions [EMAIL PROTECTED]wrote: Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.com, Josh McDonald dznuts@ wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions reflexactions@wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: josh@ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- j:pn \\no comment
Re: [flexcoders] Re: Bindable Classes
it does depend on the scale of your application. first off, to use custom events you do not need getters and setters, but it does depend on how you want to use it. my personal feeling around models are that they should always be generated, its such a waste of time to code 'em by hand. On Wed, Sep 3, 2008 at 1:28 PM, reflexactions [EMAIL PROTECTED]wrote: But then you have to write all the event creation and dispatch, plus all the getter/setter. That might be fair enough if you have a handful of props but if this is a couple of data classes with says 100 props each thats quite a bit of typing when all you want is a couple of props not to fire events when they change... unless there is a tool to generate the code from a list of variables. Personally in some cases I use custom events and others I am ok with the default handling, depends on what I am doing as to which is more suited to the situation. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Johannes Nel [EMAIL PROTECTED] wrote: using custom events with your bindable metadata is not only best practice but allows you to decide which properties you want to refresh. [Bindable(myEvent)] i would recomend using this at all times. On Wed, Sep 3, 2008 at 1:04 PM, Josh McDonald [EMAIL PROTECTED] wrote: What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class-level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions [EMAIL PROTECTED]wrote: Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Josh McDonald dznuts@ wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions reflexactions@wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: josh@ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- j:pn \\no comment -- j:pn \\no comment
Re: [flexcoders] Re: Bindable Classes
I'm fairly certain you do need get/set functions to use custom events. It might be a pain, but unfortunately it's when you have objects with many bindable fields that you're more likely to need the custom events (otherwise binding becomes very cpu-intensive). -Josh On Wed, Sep 3, 2008 at 9:30 PM, Johannes Nel [EMAIL PROTECTED] wrote: it does depend on the scale of your application. first off, to use custom events you do not need getters and setters, but it does depend on how you want to use it. my personal feeling around models are that they should always be generated, its such a waste of time to code 'em by hand. On Wed, Sep 3, 2008 at 1:28 PM, reflexactions [EMAIL PROTECTED]wrote: But then you have to write all the event creation and dispatch, plus all the getter/setter. That might be fair enough if you have a handful of props but if this is a couple of data classes with says 100 props each thats quite a bit of typing when all you want is a couple of props not to fire events when they change... unless there is a tool to generate the code from a list of variables. Personally in some cases I use custom events and others I am ok with the default handling, depends on what I am doing as to which is more suited to the situation. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Johannes Nel [EMAIL PROTECTED] wrote: using custom events with your bindable metadata is not only best practice but allows you to decide which properties you want to refresh. [Bindable(myEvent)] i would recomend using this at all times. On Wed, Sep 3, 2008 at 1:04 PM, Josh McDonald [EMAIL PROTECTED] wrote: What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class-level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions [EMAIL PROTECTED]wrote: Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Josh McDonald dznuts@ wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions reflexactions@wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: josh@ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- j:pn \\no comment -- j:pn \\no comment -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Re: Bindable Classes
On 03/09/2008, at 9:30 PM, Johannes Nel wrote: it does depend on the scale of your application. first off, to use custom events you do not need getters and setters, but it does depend on how you want to use it. my personal feeling around models are that they should always be generated, its such a waste of time to code 'em by hand. Are there any generators that you recommend ?? I am currently using FCG (which has just gone open source) after initially using the one from crazedcoders, but would love to know of any other ones out there. Regards, Nik
Re: [flexcoders] Re: Bindable Classes
reflexactions wrote: But then you have to write all the event creation and dispatch, plus all the getter/setter. That might be fair enough if you have a handful of props but if this is a couple of data classes with says 100 props each thats quite a bit of typing when all you want is a couple of props not to fire events when they change... unless there is a tool to generate the code from a list of variables. There is; it's called Perl. Learn it, live it, love it. :) Using Perl it's trivial to generate classes from a 'template' file. For a little more effort you can generate all the boiler-plate code for frameworks such as Cairngorm or Parsley or whatever you use. Java DTO classes etc etc. I do this for every project and it makes changing the Model (adding/removing properties) trivial. Its also great for generating test data. SQL inserts, xml files etc. etc. Perl offers a great return for the effort required to learn it. Do yourself a favour and give Perl a whirl. cheers, - shaun
Re: [flexcoders] Re: Bindable Classes
I'm fairly certain you do need get/set functions to use custom events. actually not. [Bindable(event)] public var lala:Type; and an ad hoc event being dispatched works well. if the property is being set on your model and you wish to dispatch a custom event, creating a setter is the way to do it, but managing invalidations based on logic and dispatching events can allow you to manage multiple properties in batch schemas. remember that you can also have [Bindable(event2)] [Bindable(event1)] [Bindable(event)] public var lala:Type; as for generators, i used to use python, these days i use JET which is native to eclipse. I would also recomend having a look at the eclipse modeling framework, GEF, GMF and such things if you like code generation. On 9/3/08, Josh McDonald [EMAIL PROTECTED] wrote: I'm fairly certain you do need get/set functions to use custom events. It might be a pain, but unfortunately it's when you have objects with many bindable fields that you're more likely to need the custom events (otherwise binding becomes very cpu-intensive). -Josh On Wed, Sep 3, 2008 at 9:30 PM, Johannes Nel [EMAIL PROTECTED] wrote: it does depend on the scale of your application. first off, to use custom events you do not need getters and setters, but it does depend on how you want to use it. my personal feeling around models are that they should always be generated, its such a waste of time to code 'em by hand. On Wed, Sep 3, 2008 at 1:28 PM, reflexactions [EMAIL PROTECTED]wrote: But then you have to write all the event creation and dispatch, plus all the getter/setter. That might be fair enough if you have a handful of props but if this is a couple of data classes with says 100 props each thats quite a bit of typing when all you want is a couple of props not to fire events when they change... unless there is a tool to generate the code from a list of variables. Personally in some cases I use custom events and others I am ok with the default handling, depends on what I am doing as to which is more suited to the situation. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Johannes Nel [EMAIL PROTECTED] wrote: using custom events with your bindable metadata is not only best practice but allows you to decide which properties you want to refresh. [Bindable(myEvent)] i would recomend using this at all times. On Wed, Sep 3, 2008 at 1:04 PM, Josh McDonald [EMAIL PROTECTED] wrote: What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class-level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions [EMAIL PROTECTED]wrote: Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Josh McDonald dznuts@ wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions reflexactions@wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: josh@ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- j:pn \\no comment -- j:pn \\no comment -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- j:pn \\no comment
[flexcoders] Re: Bindable Classes
Yeah but if u dont have a get/set how do you know the property changed and who will fires the event, or are you saying that Flex automatically creates and dispatches the event for you? tks --- In flexcoders@yahoogroups.com, Johannes Nel [EMAIL PROTECTED] wrote: I'm fairly certain you do need get/set functions to use custom events. actually not. [Bindable(event)] public var lala:Type; and an ad hoc event being dispatched works well. if the property is being set on your model and you wish to dispatch a custom event, creating a setter is the way to do it, but managing invalidations based on logic and dispatching events can allow you to manage multiple properties in batch schemas. remember that you can also have [Bindable(event2)] [Bindable(event1)] [Bindable(event)] public var lala:Type; as for generators, i used to use python, these days i use JET which is native to eclipse. I would also recomend having a look at the eclipse modeling framework, GEF, GMF and such things if you like code generation. On 9/3/08, Josh McDonald [EMAIL PROTECTED] wrote: I'm fairly certain you do need get/set functions to use custom events. It might be a pain, but unfortunately it's when you have objects with many bindable fields that you're more likely to need the custom events (otherwise binding becomes very cpu-intensive). -Josh On Wed, Sep 3, 2008 at 9:30 PM, Johannes Nel [EMAIL PROTECTED] wrote: it does depend on the scale of your application. first off, to use custom events you do not need getters and setters, but it does depend on how you want to use it. my personal feeling around models are that they should always be generated, its such a waste of time to code 'em by hand. On Wed, Sep 3, 2008 at 1:28 PM, reflexactions [EMAIL PROTECTED]wrote: But then you have to write all the event creation and dispatch, plus all the getter/setter. That might be fair enough if you have a handful of props but if this is a couple of data classes with says 100 props each thats quite a bit of typing when all you want is a couple of props not to fire events when they change... unless there is a tool to generate the code from a list of variables. Personally in some cases I use custom events and others I am ok with the default handling, depends on what I am doing as to which is more suited to the situation. --- In flexcoders@yahoogroups.com flexcoders% 40yahoogroups.com, Johannes Nel johannes.nel@ wrote: using custom events with your bindable metadata is not only best practice but allows you to decide which properties you want to refresh. [Bindable(myEvent)] i would recomend using this at all times. On Wed, Sep 3, 2008 at 1:04 PM, Josh McDonald dznuts@ wrote: What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class- level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions reflexactions@wrote: Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.com flexcoders% 40yahoogroups.com, Josh McDonald dznuts@ wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions reflexactions@wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: josh@ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.comYahoo! Groups Links
[flexcoders] Re: Bindable Classes
Mike Labriola did a very good in depth presentation on how binding works at 360 Flex which was recorded and is available online. It runs about an hour and 20 minutes and is well worth the time if you want to understand how bindings work. Diving in the Data Binding Waters with Michael Labriola http://link.brightcove.com/services/player/bcpid1733261879?bclid=1729365228bctid=1741212660 --- In flexcoders@yahoogroups.com, reflexactions [EMAIL PROTECTED] wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks
Re: [flexcoders] Re: Bindable Classes
no you need to dispatch the event yourself. as i said in some cases a get/set pair is needed, but not always. my strategy is to have multiple events that updates multple properties dependent on which group changed. On Wed, Sep 3, 2008 at 4:15 PM, reflexactions [EMAIL PROTECTED]wrote: Yeah but if u dont have a get/set how do you know the property changed and who will fires the event, or are you saying that Flex automatically creates and dispatches the event for you? tks --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Johannes Nel [EMAIL PROTECTED] wrote: I'm fairly certain you do need get/set functions to use custom events. actually not. [Bindable(event)] public var lala:Type; and an ad hoc event being dispatched works well. if the property is being set on your model and you wish to dispatch a custom event, creating a setter is the way to do it, but managing invalidations based on logic and dispatching events can allow you to manage multiple properties in batch schemas. remember that you can also have [Bindable(event2)] [Bindable(event1)] [Bindable(event)] public var lala:Type; as for generators, i used to use python, these days i use JET which is native to eclipse. I would also recomend having a look at the eclipse modeling framework, GEF, GMF and such things if you like code generation. On 9/3/08, Josh McDonald [EMAIL PROTECTED] wrote: I'm fairly certain you do need get/set functions to use custom events. It might be a pain, but unfortunately it's when you have objects with many bindable fields that you're more likely to need the custom events (otherwise binding becomes very cpu-intensive). -Josh On Wed, Sep 3, 2008 at 9:30 PM, Johannes Nel [EMAIL PROTECTED] wrote: it does depend on the scale of your application. first off, to use custom events you do not need getters and setters, but it does depend on how you want to use it. my personal feeling around models are that they should always be generated, its such a waste of time to code 'em by hand. On Wed, Sep 3, 2008 at 1:28 PM, reflexactions [EMAIL PROTECTED]wrote: But then you have to write all the event creation and dispatch, plus all the getter/setter. That might be fair enough if you have a handful of props but if this is a couple of data classes with says 100 props each thats quite a bit of typing when all you want is a couple of props not to fire events when they change... unless there is a tool to generate the code from a list of variables. Personally in some cases I use custom events and others I am ok with the default handling, depends on what I am doing as to which is more suited to the situation. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Johannes Nel johannes.nel@ wrote: using custom events with your bindable metadata is not only best practice but allows you to decide which properties you want to refresh. [Bindable(myEvent)] i would recomend using this at all times. On Wed, Sep 3, 2008 at 1:04 PM, Josh McDonald dznuts@ wrote: What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class- level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions reflexactions@wrote: Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.comflexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Josh McDonald dznuts@ wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions reflexactions@wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy that then raises PropertyChange events as appropriate. This certainly saves a lot of time instead of having to go through a class and add Bindable to every single property. But... What if there is one property that I dont want to be Bindable and more importantly I dont want it to raise PropertyChange events. Is there same NonBindable tag to achieve this??? tks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%
[flexcoders] Re: Bindable Classes
Of course if you have got some external routine that updates a bunch of props all in one go and then creates and dispatches the event the you can use variables but thats not the typical case and not really viable if we are talking about a class that maybe in a collection and/or bound to UI input controls or the DataGrid and it is getting updated one property at a time dependent on what the user is doing. Anyway thanks for ur viewpoint, I followed JM advise and its doing what I need to do for now, so I am happy lol. tks --- In flexcoders@yahoogroups.com, Johannes Nel [EMAIL PROTECTED] wrote: no you need to dispatch the event yourself. as i said in some cases a get/set pair is needed, but not always. my strategy is to have multiple events that updates multple properties dependent on which group changed. On Wed, Sep 3, 2008 at 4:15 PM, reflexactions [EMAIL PROTECTED]wrote: Yeah but if u dont have a get/set how do you know the property changed and who will fires the event, or are you saying that Flex automatically creates and dispatches the event for you? tks --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Johannes Nel johannes.nel@ wrote: I'm fairly certain you do need get/set functions to use custom events. actually not. [Bindable(event)] public var lala:Type; and an ad hoc event being dispatched works well. if the property is being set on your model and you wish to dispatch a custom event, creating a setter is the way to do it, but managing invalidations based on logic and dispatching events can allow you to manage multiple properties in batch schemas. remember that you can also have [Bindable(event2)] [Bindable(event1)] [Bindable(event)] public var lala:Type; as for generators, i used to use python, these days i use JET which is native to eclipse. I would also recomend having a look at the eclipse modeling framework, GEF, GMF and such things if you like code generation. On 9/3/08, Josh McDonald dznuts@ wrote: I'm fairly certain you do need get/set functions to use custom events. It might be a pain, but unfortunately it's when you have objects with many bindable fields that you're more likely to need the custom events (otherwise binding becomes very cpu-intensive). -Josh On Wed, Sep 3, 2008 at 9:30 PM, Johannes Nel johannes.nel@ wrote: it does depend on the scale of your application. first off, to use custom events you do not need getters and setters, but it does depend on how you want to use it. my personal feeling around models are that they should always be generated, its such a waste of time to code 'em by hand. On Wed, Sep 3, 2008 at 1:28 PM, reflexactions reflexactions@wrote: But then you have to write all the event creation and dispatch, plus all the getter/setter. That might be fair enough if you have a handful of props but if this is a couple of data classes with says 100 props each thats quite a bit of typing when all you want is a couple of props not to fire events when they change... unless there is a tool to generate the code from a list of variables. Personally in some cases I use custom events and others I am ok with the default handling, depends on what I am doing as to which is more suited to the situation. --- In flexcoders@yahoogroups.com flexcoders% 40yahoogroups.comflexcoders% 40yahoogroups.com, Johannes Nel johannes.nel@ wrote: using custom events with your bindable metadata is not only best practice but allows you to decide which properties you want to refresh. [Bindable(myEvent)] i would recomend using this at all times. On Wed, Sep 3, 2008 at 1:04 PM, Josh McDonald dznuts@ wrote: What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class- level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions reflexactions@wrote: Ah ok.. I had thought the compiler generated a wrapper or sub class behind the scenes when you used the bindable tag... Well ok learn something new eahc day... tks --- In flexcoders@yahoogroups.comflexcoders% 40yahoogroups.comflexcoders% 40yahoogroups.com, Josh McDonald dznuts@ wrote: Nope. [Bindable] on a class doesn't wrap the class, it's just exactly the same as putting [Bindable] on every public field. -Josh On Wed, Sep 3, 2008 at 8:45 PM, reflexactions reflexactions@wrote: If I add the Bindable tag at a class level every property is wrapped in by a sort of proxy
Re: [flexcoders] Re: Bindable Classes
variables but thats not the typical case and not really viable if we are talking about a class that maybe in a collection and/or bound to UI input controls here i disagree. with complex views, charts and that kind of loving its best to invalidate in bunches. thats a good preso, understanding the changewatcher and binding utils is necesary to build data centric applications. On Wed, Sep 3, 2008 at 7:16 PM, reflexactions [EMAIL PROTECTED]wrote: Of course if you have got some external routine that updates a bunch of props all in one go and then creates and dispatches the event the you can use variables but thats not the typical case and not really viable if we are talking about a class that maybe in a collection and/or bound to UI input controls or the DataGrid and it is getting updated one property at a time dependent on what the user is doing. Anyway thanks for ur viewpoint, I followed JM advise and its doing what I need to do for now, so I am happy lol. tks --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Johannes Nel [EMAIL PROTECTED] wrote: no you need to dispatch the event yourself. as i said in some cases a get/set pair is needed, but not always. my strategy is to have multiple events that updates multple properties dependent on which group changed. On Wed, Sep 3, 2008 at 4:15 PM, reflexactions [EMAIL PROTECTED]wrote: Yeah but if u dont have a get/set how do you know the property changed and who will fires the event, or are you saying that Flex automatically creates and dispatches the event for you? tks --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.com, Johannes Nel johannes.nel@ wrote: I'm fairly certain you do need get/set functions to use custom events. actually not. [Bindable(event)] public var lala:Type; and an ad hoc event being dispatched works well. if the property is being set on your model and you wish to dispatch a custom event, creating a setter is the way to do it, but managing invalidations based on logic and dispatching events can allow you to manage multiple properties in batch schemas. remember that you can also have [Bindable(event2)] [Bindable(event1)] [Bindable(event)] public var lala:Type; as for generators, i used to use python, these days i use JET which is native to eclipse. I would also recomend having a look at the eclipse modeling framework, GEF, GMF and such things if you like code generation. On 9/3/08, Josh McDonald dznuts@ wrote: I'm fairly certain you do need get/set functions to use custom events. It might be a pain, but unfortunately it's when you have objects with many bindable fields that you're more likely to need the custom events (otherwise binding becomes very cpu-intensive). -Josh On Wed, Sep 3, 2008 at 9:30 PM, Johannes Nel johannes.nel@ wrote: it does depend on the scale of your application. first off, to use custom events you do not need getters and setters, but it does depend on how you want to use it. my personal feeling around models are that they should always be generated, its such a waste of time to code 'em by hand. On Wed, Sep 3, 2008 at 1:28 PM, reflexactions reflexactions@wrote: But then you have to write all the event creation and dispatch, plus all the getter/setter. That might be fair enough if you have a handful of props but if this is a couple of data classes with says 100 props each thats quite a bit of typing when all you want is a couple of props not to fire events when they change... unless there is a tool to generate the code from a list of variables. Personally in some cases I use custom events and others I am ok with the default handling, depends on what I am doing as to which is more suited to the situation. --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders% 40yahoogroups.comflexcoders% 40yahoogroups.com, Johannes Nel johannes.nel@ wrote: using custom events with your bindable metadata is not only best practice but allows you to decide which properties you want to refresh. [Bindable(myEvent)] i would recomend using this at all times. On Wed, Sep 3, 2008 at 1:04 PM, Josh McDonald dznuts@ wrote: What it does is renames your variables, and creates get/set methods, but it doesn't wrap the whole class. So unfortunately it's either all-or-none with the class- level [Bindable] -Josh On Wed, Sep 3, 2008 at 9:01 PM, reflexactions reflexactions@wrote: Ah ok.. I had thought the compiler generated a
Re: [flexcoders] Re: Bindable Classes
Right, now I see what you're saying. I thought you were saying that Flex will do what it normally does, only using your custom event instead of propertychange :) On Thu, Sep 4, 2008 at 2:22 AM, Johannes Nel [EMAIL PROTECTED] wrote: no you need to dispatch the event yourself. as i said in some cases a get/set pair is needed, but not always. my strategy is to have multiple events that updates multple properties dependent on which group changed. -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]