Mediation of components contained within a flex PopUp

levi.strope's Avatar

levi.strope

21 Jan, 2010 07:08 AM

I know this horse has been beat to death. But I don't think this particular issue has been handled yet (sorry if it has).

So - I know some of you have said "don't ever mediate an itemRenderer" and to those people I say - choose the next problem 1 post down, haha. Seriously though I've had no issues whatsoever until now.

With that said the problem is very simple. I have a PopUp that I've put on stage using the following:

    PopUpManager.addPopUp(distroForm, contextView, true, PopUpManagerChildList.POPUP);
    mediatorMap.createMediator(distroForm);

This works great! But my current problem is that the above mentioned distroForm contains a list of information. The itemRenderer for this list is highly customized and contains clickable controls along with the data element.

In order to respond to those clicks my first inclination is to mediate the itemRenderer. I've done this in other places in the application (that are not popups) and it seems to work great. But this one perplexes me.

I'm thinking that there is no way to have automatic mediation in this instance, and I would have to create each item renderer for each data record of the data property. I won't do this obviously but I'm just not sure there is another way to do this without including logic in my view.

My entire goal is to have no logic in the popup. No binding tags or anything. Just a view. Same with the itemRenderer on said popup.

I know that because the pop up is created on a different display list than what RobotLegs can listen to; that I have to use createMediator(). But what do I do for child components on that same pop-up that also require mediation?

Thanks in advance!

I'm open to criticism on mediating the itemRenderer. I know they can get rather complicated, but I've had nothing but success until now. I welcome alternative suggestions that still allow me to keep the view/popup as skeletal like as possible while not having to add logic to the itemRenderer itself.

-Levi

  1. 1 Posted by levi.strope on 21 Jan, 2010 07:15 AM

    levi.strope's Avatar

    I'm currently thinking of constructing the list object myself within the PopUp's mediator and then adding it to the popup after I've provided binding for the list data.

    Even so I think I would still have to loop through the data and manually create a mediator for each renderer needed to receive the list. Am I wrong?

  2. Support Staff 2 Posted by Joel Hooks on 21 Jan, 2010 07:18 AM

    Joel Hooks's Avatar

    I just don't see any good reason to mediate an item renderer outside of convenience. Flex 3 item renderers are JACKED. If you implement mx.controls.listClasses.IDropInListItemRenderer it is easy to get at the list/grid and dispatch the events from there. Item renderers are just so volatile... In the Signals/RL example I posted recently I did inject a Signal into my renderers. That worked well.

    We need to make a Robotlegs PopupManager...

  3. 3 Posted by levi.strope on 21 Jan, 2010 07:33 AM

    levi.strope's Avatar

    You guys never sleep! I'll take that to my team this morning, in about 7 hours, and see if we can't figure this one out based on your advice Joel.

    I do find it funny you call my mediation of the item renderer convenient :) I thought convenience would have me just put all the logic in the renderer and be done with it! But based on everything else you've said, that might be the lesser of the evils. And you're absolutely right on all accounts - item renderers are more like list obfuscators.

  4. Till Schneidereit closed this discussion on 02 Mar, 2010 12:46 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac