You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Idylog - Nicolas Granon <ng...@idylog.com> on 2018/11/04 11:27:28 UTC
Dynamic component instantiation and bindings
Hi all,
We make heavy use of BindingUtils bindProperty (mostly) and bindSetter (sometimes) methods.
We are a bit confused : is it still possible with Royale to bind explicitly/dynamically (through code) like we did in Flex (as opposed to static binding with curly braces syntax) ?
Our use-case is the following :
We dynamically generate "forms" (roughly speaking) by instantiating and adding components (container components, interactive components) at runtime.
As we instantiate components, we also bind them to the model with bindSetter and/or bindProperty.
(in the end, of course, the outer - dynamically generated - container is added to some generic "frame" container).
Are there any structural restrictions in Royale about that kind of logic ?
Many thanks in advance
Nicolas Granon
IDYLOG
Ingénierie Informatique
13 Bd Princesse Charlotte
98000 MONACO
Re: Dynamic component instantiation and bindings
Posted by Alex Harui <ah...@adobe.com.INVALID>.
Are you using the emulation components or the Basic components? We could probably emulate BindingUtils in the emulation components.
For Basic, there are beads you can use, like SimpleBinding, ConstantBinding and ChainBinding. I think ChainBinding is closest to BindingUtils.bindProperty. But if you don't have a chain to bind to, you can save a bit by using SimpleBinding. I don't think we have an equivalent for bindSetter. Volunteers could step up to create it or you can "fake it" by defining an actual setter property. IMO, "bindSetter" really should have been named "bindFunction".
HTH,
-Alex
On 11/4/18, 3:27 AM, "Idylog - Nicolas Granon" <ng...@idylog.com> wrote:
Hi all,
We make heavy use of BindingUtils bindProperty (mostly) and bindSetter (sometimes) methods.
We are a bit confused : is it still possible with Royale to bind explicitly/dynamically (through code) like we did in Flex (as opposed to static binding with curly braces syntax) ?
Our use-case is the following :
We dynamically generate "forms" (roughly speaking) by instantiating and adding components (container components, interactive components) at runtime.
As we instantiate components, we also bind them to the model with bindSetter and/or bindProperty.
(in the end, of course, the outer - dynamically generated - container is added to some generic "frame" container).
Are there any structural restrictions in Royale about that kind of logic ?
Many thanks in advance
Nicolas Granon
IDYLOG
Ingénierie Informatique
13 Bd Princesse Charlotte
98000 MONACO
RE: Dynamic component instantiation and bindings
Posted by Yishay Weiss <yi...@hotmail.com>.
Hi Nicolas,
There’s an example [1] that seems to at least partially answer your question.
Yishay
[1] https://github.com/apache/royale-asjs/blob/develop/examples/royale/DataBindingExample_as/src/main/royale/MyInitialView.as#L180
________________________________
From: Idylog - Nicolas Granon <ng...@idylog.com>
Sent: Sunday, November 4, 2018 1:27:28 PM
To: dev@royale.apache.org
Subject: Dynamic component instantiation and bindings
Hi all,
We make heavy use of BindingUtils bindProperty (mostly) and bindSetter (sometimes) methods.
We are a bit confused : is it still possible with Royale to bind explicitly/dynamically (through code) like we did in Flex (as opposed to static binding with curly braces syntax) ?
Our use-case is the following :
We dynamically generate "forms" (roughly speaking) by instantiating and adding components (container components, interactive components) at runtime.
As we instantiate components, we also bind them to the model with bindSetter and/or bindProperty.
(in the end, of course, the outer - dynamically generated - container is added to some generic "frame" container).
Are there any structural restrictions in Royale about that kind of logic ?
Many thanks in advance
Nicolas Granon
IDYLOG
Ingénierie Informatique
13 Bd Princesse Charlotte
98000 MONACO