Congratulations. Good to know that you got it to work. -Alex
On 10/28/19, 9:41 AM, "Ramazan Ergüder Bekrek" <e.bek...@yandex.com> wrote: In my attempt to allow dynamic states based on annotations without a big refactoring of the Flex SDK, I have successfully implemented something which is working pretty well. And again it is all running inside of an OSGi runtime so I created a simple extension to the OSGi framework that monitors any added UIComponent on the stage and check if the component is candidate for a DynamicStateHost ready to received DynamicState. Equivalently each time a bundle is loaded in the OSGi runtime, it also checks if there is any candidate which is a DynamicState for the previously identified DynamicStateHost. I tested the code with an empty [host] Module containing zero state which is annotated with [DynamicStateHost(name="host")] and 2 other modules that are annotated with [DynamicState(name="editor", target="host", default=true)] [DynamicState(name="marketplace", target="host", default=false)] When the OSGi runtime instanciates the Main UI [DynamicStateHost] it gets added on the stage and my extension intercepts it and check what was already parsed from the annotations. The extension gives the hand to the normal Flex process of handling the DynamicAddItem that I created based on the AddItem that are generated by the mxml compiler. This is a success and I'm pleased by the result. Thanx for the guidance Alex. Best Regards Ergü 21.10.2019, 17:11, "Alex Harui" <aha...@adobe.com.invalid>: > IMO, Binding is independent from states. Even if you took out all of the states, if you had a binding from a non-public property, there is no way to get that to work dynamically at runtime (at least, not without a ton of work). You should be able to generate bindings for public properties so if you can constrain your use of bindings for public properties, then you should be able to get things to work. Instead of generating getter/setters, you have to add the right event listeners for changes. > > HTH, > -Alex > > On 10/21/19, 7:26 AM, "Ramazan Ergüder Bekrek" <e.bek...@yandex.com> wrote: > > After looking how the compiler generates MXML states as suggested by Alex I've discovered some important details... > > Let's say that I have these two UI component in my main UI. > > <serviceloader:UIService id="marketplace" purpose="marketplace" width="100%" height="100%" bottom="0" includeIn="marketplace"/> > <serviceloader:UIService id="editor" purpose="timeline" width="100%" height="35%" bottom="0" includeIn="editor"/> > > The class that is generated automatically is this: https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpastebin.com%2Fdg93hAQv&data=02%7C01%7Caharui%40adobe.com%7C86028f33d2064d2f4c8308d75bc59d60%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%7C637078776631165631&sdata=JbQQnHakQP5ogh6Hzuk5Z6DTolPEMo0JZcU6odxkdAI%3D&reserved=0 > > As you can see also the class has this annotation [DynamicStateHost(name="multiverses")] > I decided to remove all the states from the main UI to generate them automatically. > I my DynamicStateHandler class that is generating the states automatically there is the coded inspired by the MXML compiler. > > I am able to achieve almost anything except the part where the compiler adds the getter/setter for the Bindings from line 83 to 119. > Naturally when my state handler try to set the current state of the main UI to the default one : https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpastebin.com%2F3Y3C7Fi8&data=02%7C01%7Caharui%40adobe.com%7C86028f33d2064d2f4c8308d75bc59d60%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%7C637078776631165631&sdata=mveTi%2Bmwrbketlwbqm4SFOeJa%2BKMrOsdSeNAd5gdlRw%3D&reserved=0 > > I get this error: > > Property editor not found on MultiversesMainUI and there is no default value. > at mx.states::OverrideBase/getOverrideContext()[D:\flex_sdk\Sources\flex-sdk\frameworks\projects\framework\src\mx\states\OverrideBase.as:151] > > Does anyone has an idea how to fix this? I've created a dynamic class which extends from Module and used that instead but it doesn't work neither. > Right now I have no clue how to bypass this constraint. > > Best regards > > Ergü