Skip to main content
mmarmol80
Known Participant
September 30, 2010
Question

NavigationParsley

  • September 30, 2010
  • 1 reply
  • 2287 views

I have been trying to understand a basic example of Navigation with parsley, I am using parsley 2.3.1 and navigation and navigationParsley 1.1

I have declared the context, created a ViewStack with to views inside with their views inside like this:

<mx:ViewStack xmlns:fx="http://ns.adobe.com/mxml/2009"                  xmlns:s="library://ns.adobe.com/flex/spark"                  xmlns:mx="library://ns.adobe.com/flex/mx"                  xmlns:presentation="org.mxhero.console.frontend.presentation.*"                  xmlns:spicefactory="http://www.spicefactory.org/parsley">      <fx:Script>           <![CDATA[                import org.mxhero.console.frontend.application.MainDestinations;                                [Injected]                [Bindable]                public var model:MainViewPM;                           ]]>      </fx:Script>            <fx:Declarations>           <spicefactory:Configure/>      </fx:Declarations>            <fx:Metadata>           [WayPoint]      </fx:Metadata>            <s:NavigatorContent width="100%" height="100%" automationName="{MainDestinations.LOGIN}" >           <s:layout>                <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />           </s:layout>           <presentation:Login />      </s:NavigatorContent>            <s:NavigatorContent width="100%" height="100%" automationName="{MainDestinations.DASHBOARD}">           <s:layout>                <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>           </s:layout>                     <presentation:Dashboard/>      </s:NavigatorContent>             </mx:ViewStack>

Here is the model:

package org.mxhero.console.frontend.presentation {      import com.adobe.cairngorm.navigation.NavigationEvent;            import org.mxhero.console.frontend.application.MainDestinations;      public class MainViewPM      {                [MessageDispatcher]           public var dispatcher:Function                      public function navigateTo(destination:String):void           {                dispatcher(NavigationEvent.createNavigateToEvent(destination));              }      } }

Here is one model from the views in the ViewStack

package org.mxhero.console.frontend.presentation {      import mx.controls.Alert;            import org.spicefactory.parsley.core.messaging.MessageProcessor;      [Landmark(name="content.dashboard")]      public class DashboardPM      {           [Enter(time="first")]           public function firstEnter():void           {                Alert.show("First");                           }                      [Enter(time="next")]           public function enter():void           {                Alert.show("Next");           }                      [Exit]           public function exit():void           {                Alert.show("Exit");           }                      [EnterInterceptor]           public function enterInterceptor(processor:MessageProcessor):void{                processor.proceed();                Alert.show("Proceed");           }      } }

and here is that view:

<?xml version="1.0" encoding="utf-8"?> <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"            xmlns:s="library://ns.adobe.com/flex/spark"            xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" xmlns:dashboard="org.mxhero.console.frontend.presentation.dashboard.*">      <fx:Declarations>           <!-- Place non-visual elements (e.g., services, value objects) here -->      </fx:Declarations>            <s:layout>           <s:VerticalLayout/>      </s:layout>            <fx:Script>           <![CDATA[                [Injected]                [Bindable]                public var model:DashboardPM;           ]]>      </fx:Script>            <dashboard:Header/>      <dashboard:BodyView/>       </s:Group>

When i try to cal navigateTo, i see in the debug console that the views are called but the viewStack does not change. I am kinda lost, i have searched all the examples in the repository for the navigation Library and i am not seeing what is wrong, any one can give me a hand with this?

Thanks!

This topic has been closed for replies.

1 reply

Participating Frequently
October 1, 2010

Hi,

have you added the CairngormNavigationSupport extention into your Parsley ContextBuilder? Are your objects that use the navigation annotiations such as Landmark, Enter etc declared in a context? Also, note that one of your examples show "Injected" instead of the "Inject" metadata that Parsley uses.

I've just committed Parsley 2.3.1 into trunk for C3 libraries, however, since this dependency is declared as external, the release SWCs build via Maven should work fine in this respect already.

Best,

Alex

mmarmol80
mmarmol80Author
Known Participant
October 1, 2010

Sorry, I was making several minor errors like using Injected insted of Inject, I have my own simple example working now, so Cairngorm Navigation library is back to my project!

Great work guys, and thanks for your time!