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: Navigation Notifications  (Read 6690 times)
oravecz
Newbie
*
Posts: 1


View Profile Email
« on: February 05, 2008, 12:57:07 »

What would be the best practice for handling navigation? I have a multi-page application and I have tried a couple approaches to signal when I want navigation to occur. They all seem a bit "dirty" to me.

On my "main" page there is a ViewStack, and the Mediator associated with this View Component is in control of making sure the correct page is shown. This mediator listens for notifications like SHOW_PAGE1, SHOW_PAGE2, etc. A page transition is usually associated with some work being done by a Command which is delegating the heavy lifting to a Proxy.

Is it a good practice to come up with Commands that only perform navigation. And these commands are invoked by other commands by sending notifications or creating macro commands? Or do people combine their navigation with system-wide notifications like NEW_ITEM_ADDED, or EDIT_CANCELED?

Right now, I have error checking (remote failure, etc) in the Proxy. Thus, the Proxy only know about the errors and can determine the appropriate next steps (stay put or navigate). This implies the Proxy is responsible for triggering the page transition. In the end, perhaps I should move more business logic to my command and keep the proxies stupid. Then the command would know more regarding how the transition should proceed.

What have others found as a good course of action?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: February 05, 2008, 08:06:02 »

Your proxy should be ignorant of the view. It can however send notifications like PAGE_RECEIVED, which is heard by a command or mediator(s), which in turn set the view components to the proper state.

-=Cliff>
Logged
Pages: [1]
Print