Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Where to put ItemRenderers?  (Read 8021 times)
justSteve
Courseware Beta
Sr. Member
***
Posts: 55


View Profile Email
« on: March 31, 2008, 03:19:43 »

Just finished reading Peter Ent's itemRenderers: Part 4: States and Transitions (http://weblogs.macromedia.com/pent/) outlining a really clear way to handle a lot of what my menus' buttons have to deal with - state and showing or hiding other elements depending on that state.

But the renderer as presented in that specific demo seems impossible to implement in Purely MVC fashion. Is it a matter of breaking the different code elements to respective roles? As presented it's soooo nice and tidy.

Do we have itemRenderers exhibited in any demos?

thx
--steve...
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: March 31, 2008, 11:58:25 »

Hi Steve,

What problems are you having specifically?

I have one on the back burner. But what problems specifically are you having? Aside from the normal fact that item renders stink in Flex?

-=Cliff>
Logged
justSteve
Courseware Beta
Sr. Member
***
Posts: 55


View Profile Email
« Reply #2 on: April 01, 2008, 03:51:27 »

The problem is getting my head around the division of labors involved. A view looks to a controller for it's info but it looks as though in Ent's code the view (dataitemRenderer) is poking directly into the model.
>>
The set data function determines which state to use by looking at the value of instock:
      override public function set data( value:Object ) : void
      {
         super.data = value;
         
         if( data )
         {
            if( data.instock == "yes" )
               currentState = "";
            else
               currentState = "NoStockState";
         }
      }
>>

Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: April 02, 2008, 07:50:33 »

In the item renderer, 'data' is the property of the specific data being rendered. This comes from the view component (DataGrid, List, etc) it is rendering an item for.

Here's a scenario to clear things up:

  • On receiving data from a service, a Proxy could send a Notification with a reference to its ArrayCollection of VOs.
  • A Mediator might hear this and set that ArraryCollection as the dataProvider of the DataGrid component it is stewarding.
  • The DataGrid might have a custom ItemRenderer it uses to display a given field.
  • That ItemRenderer's 'data' property would be the VO being displayed in its row of the DataGrid.
  • The ItemRenderer could examine any or all fields of that VO in order to determine how to behave and what to display.

Hope this helps,
-=Cliff>
Logged
justSteve
Courseware Beta
Sr. Member
***
Posts: 55


View Profile Email
« Reply #4 on: April 02, 2008, 08:01:23 »

I does help...thankx much.
Logged
Pages: [1]
Print