I think we don't have any "initComplete" at renderer level, so most of the times only way is to use addedToParent. Maybe would be good to add a hook instead of overriding that method.
El jue., 11 jun. 2020 a las 18:20, Alex Harui (<aha...@adobe.com.invalid>) escribió: > IMO, it would be best to not require adding addedToParent in a script. > > It could be that, because most Flex components were set up to be > itemrenderers, that mx Container and a few others should have a default > IBeadController of ItemRendererMouseController specified in MXRoyale > defaults.css. Maybe we could optimize ItemRendererMouseController to > disable itself if the Container is not being used as a renderer (because > data == null). > > But otherwise, having an MXRoyale ListItemItemRendererInitializer add it > is fine too. > > -Alex > > On 6/11/20, 1:58 AM, "Greg Dove" <greg.d...@gmail.com> wrote: > > I made a few adjustments to support using the IItemRendererProvider > interface on Menu with UIComponent based renderers. > Then I was able to use a mxml defined mx:HBox based renderer, and have > successfully used it (with some layout tweaks) with some legacy > content. > > With the approach so far, I still had to add this in part of the > Renderer's > script block: > > import > org.apache.royale.html.beads.controllers.ItemRendererMouseController; > import org.apache.royale.core.IBeadController; > > override public function addedToParent():void{ > super.addedToParent(); > if (getBeadByType(IBeadController) == null) { > addBead(new ItemRendererMouseController()); > } > } > > I think I could have done this (the part that checks and adds the > mousecontroller bead) instead > in mx.controls.beads.ListItemRendererInitializer, in > 'initializeIndexedItemRenderer' [1] but held off for now. Let me know > what > you think about doing it there. > > > 1. > > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Fblob%2Fe9040b9a03dc1e11829914dda74fa92b986ce6ab%2Fframeworks%2Fprojects%2FMXRoyale%2Fsrc%2Fmain%2Froyale%2Fmx%2Fcontrols%2Fbeads%2FListItemRendererInitializer.as%23L80&data=02%7C01%7Caharui%40adobe.com%7C64411efdffe74116228008d80de5a492%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637274627244844805&sdata=fAyn57aOexuZYipsLDRKEDc7aDujHc9kS6gGnP8Hz5c%3D&reserved=0 > > > On Thu, Jun 11, 2020 at 4:00 AM Alex Harui <aha...@adobe.com.invalid> > wrote: > > > Pretty sure AdvancedDataGrid supports assignable custom itemrenderers > > based on UIComponent. Might be a bit more work for Menu/MenuBar as > the > > current renderers are not UIComponents. > > > > HTH, > > -Alex > > > > On 6/10/20, 1:50 AM, "Greg Dove" <greg.d...@gmail.com> wrote: > > > > Hi - probably another question for Alex, unless Yishay you have > > something > > similar you have faced here: > > > > For mx.controls.Menu : > > specifically for : > > set itemRenderer > > AFAICS I don't think this is hooked up to take precedence over > the > > default > > css IItemRendererFactory for the class, which is picked up in > > addedToParent. > > > > Do we have other examples I should look at to mirror that, or > (based > > on a > > quick check in the Menu code) should I just do a one-time check > in > > Menu.addedToParent to see if it itemRenderer has already been > set and > > avoid > > the load from valuesManager in there, instead adding the explicit > > assignment as a bead? > > > > thanks, > > Greg > > > > > > > > > -- Carlos Rovira http://about.me/carlosrovira