PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: codecraig on September 26, 2008, 03:07:04

Title: Best Approach for Managing User Navigation
Post by: codecraig on September 26, 2008, 03:07:04
My Flex application has two navigation controls that are always visible to the user.  At the top there is a bread crumb (http://blog.smashedapples.com/2008/06/flex-breadcrumb.html) and on the left side is an Accordion (similar to something in Microsoft Outlook, etc). 

Sample menu options might include:

The BreadCrumb navigator uses the menus defined above, the accordion is exactly the same except it does not have a "home".  So in the Accordion there are two "header" buttons (not sure what the top level button is that you click on), one says "File" and the other says "Options".  When the "File" accordion option is selected the user can see three "LinkButton" controls, one each for "New", "Save" and "Close".  Same goes for "Options" accordion button.

These two navigation controls are defined in my AppMain.mxml (the root Application).  Basically I need to keep track of where the user is in the view so that at some point a previously viewed view can be shown.  For example, image if the user goes to Preferences.  If they start changing values and then decide they don't want to do that, they can click a "cancel" button (on the Preferences screen) and the application should go back to showing whatever view they were in previously.

I should mention that the content area that takes up the majority of the display (to the right of the Accordion) is implemented as a ViewStack, so for example when you click on "Preferences" it's view is shown.
Any suggestions on the best way to do this?

I was going to have the navigation controls (BreadCrumb and Accordion) fire events from AppMain.mxml and let my ApplicationMediator.as handle them by saying "appMainView.viewStack.selectedIndex = 2" (something like that).  I was thinking about keeping some sort of view state in the proxy so when another view says "show previous view" (i.e. the user clicked cancel) the mediator can access the proxy find out what the previous view was and show it.

Just curious, what your thoughts are, have you done this, any tips???