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: Nested Views and its Mediator  (Read 9382 times)
darnpunk
Newbie
*
Posts: 5


View Profile Email
« on: September 15, 2008, 03:13:33 »

Hi everyone,

My first post and first attempt to use PureMVC for a project! I went through the documentation and some tutorial sites to get a gist of the framework. I understand a view has its own mediator to interact with the rest of the application.

However, I am having some doubts when it comes to views nested within views (multi-views in a view?). I am building a sort of a shopping cart and the view components used are nested in each other. The main movieclip (shopping cart movieclip) that I will add dynamically has a few movieclips nested in it (details window, order list etc) and this is where I am unclear about the mediator and its view.

Here is my current structure:

ApplicationFacade

controller
   - StartupCommand
   
model
   - DataProxy
   
view
   - ShoppingCartMediator
   - OrderListMediator
   - ThumbnailsMediator
   - DetailsWindowMediator
   - ApplicationMediator
   
   components
      - Thumbnails
      - DetailsWindow
      - ShoppingCart
      - OrderList
   
ShoppingCart component is the main component while the rest are all nested into it. I registered all nested components mediator in ShoppingCartMediator. Is this right?

So basically here how's I set it up:

-Main document class creates concrete facade (ApplicationFacade.getInstance())
-ApplicationFacade sends STARTUP notification
-StartupCommand tells facade to register ApplicationMediator, register DataProxy
-DataProxy sends notification that it has completed retrieval of data
-ApplicationMediator listens for this and handle notification by initializing the shop
-During this initializing the facade registers ShoppingCartMediator
-In ShoppingCartMediator constructor, I then register the rest of nested components mediator

Up to this far, I am creating mediators only for views that change often or are affected by the model. Am I on the right track here?  :-\ By the way, I am using CS3.

Thanks!

P.S. Sorry if I overlooked already existing topics on this issue.

Regards,
darnpunk
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: September 15, 2008, 04:45:26 »

Sounds like you are on the right track to me.

-=Cliff>   
Logged
darnpunk
Newbie
*
Posts: 5


View Profile Email
« Reply #2 on: September 15, 2008, 06:44:45 »

Hi Cliff,

Glad to know that. I've seen the documentation on best practices and framework concept and they are really great. On the other hand, I'm curious if there are examples of bad practices as a case study? I would like to know if there are hints/situations where you should feel that things are not going right as things go deeper.

Thanks!

Regards,
darnpunk
Logged
Pages: [1]
Print