3 Replies Latest reply on Mar 1, 2010 7:55 AM by liorchaga

    Navigation Library with Parsley 2.2

    liorchaga

      I tried using the new Navigation Library, and I get an exception when using the Waypoint meta tag:

       

      <mx:Metadata>
           [Waypoint(name="structures")]
      </mx:Metadata>
      

       

      Error: Unmappable attributes for mapped class com.adobe.cairngorm.navigation.waypoint.decorator::WaypointDecorator: name
      

       

      I also tried testing the new library with the insync example, using only the api, shell and expenses modules, and eliminating all use of any cairngorm library other than the navigation and module libraries (which I compiled against parsley 2.2 with no errors).

      I got the same exception.

       

       

      What is the new syntax for using waypoint?

        • 1. Re: Navigation Library with Parsley 2.2
          Alex Uhlmann Level 3

          You don't need the name property of the Waypoint metadata anymore, therefore the exception. Just [Waypoint]. Check out the docs here, also because of some other new features in case you've missed them such as deferred and nested navigation.

           

          We're in the process of migrating to Parsley 2.2. Once that's done, we'll update the Insync samples.

          • 2. Re: Navigation Library with Parsley 2.2
            liorchaga Level 1

            That indeed solved my problem, but still the navigation doesn't work.

            This is my main.mxml:

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*" xmlns:presentation="com.structures.login.presentation.*"
                                xmlns:presentation1="com.structures.main.presentation.*" xmlns:cairngorm="com.adobe.cairngorm.*"
                                xmlns:spicefactory="http://www.spicefactory.org/parsley">
                 <spicefactory:ContextBuilder config="MainConfig" />
                 <spicefactory:Configure />
                 <mx:Script>
                      <![CDATA[
                           import com.adobe.cairngorm.CairngormNavigationLib;
                           import com.adobe.cairngorm.navigation.NavigationEvent;
                           import com.structures.main.presentation.MainContentDestination;
                           import mx.rpc.remoting.RemoteObject;
                           import org.spicefactory.parsley.flex.FlexContextBuilder;
            
                           [Event(name="navigateTo", type="com.adobe.cairngorm.navigation.NavigationEvent")]
                           [ManagedEvents(names="navigateTo")]
            
                           private function navigateToBO(event:MouseEvent):void
                           {
                                dispatchEvent(NavigationEvent.newNavigateToEvent(MainContentDestination.BACK_OFFICE));
                           }
            
                           private function navigateToLogin(event:MouseEvent):void
                           {
                                dispatchEvent(NavigationEvent.newNavigateToEvent(MainContentDestination.LOGIN));
                           }
                      ]]>
                 </mx:Script>
            
                 <cairngorm:CairngormNavigationLib />
                 <mx:VBox>
            
                      <mx:Button label="Go to backoffice" click="navigateToBO(event)" />
                      <mx:Button label="Login Page" click="navigateToLogin(event)" />
                      <presentation1:MainViewStack width="100%" height="100%" />
                 </mx:VBox>
            </mx:Application>
            
             
            

             

             

            And this is my view stack:

            <?xml version="1.0" encoding="utf-8"?>
            <mx:ViewStack xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" xmlns:Core="Structures.Core.*"
                             xmlns:spicefactory="http://www.spicefactory.org/parsley" xmlns:presentation="com.structures.login.presentation.*"
                             xmlns:cairngorm="com.adobe.cairngorm.*">
                 <spicefactory:Configure />
                 <mx:Script>
                      <![CDATA[
                           import com.adobe.cairngorm.module.ParsleyModuleDescriptor;
                           import com.adobe.cairngorm.navigation.waypoint.decorator.WaypointDecorator;
                           import com.structures.login.presentation.LoginPM;
                           import mx.modules.IModuleInfo;
                           import org.spicefactory.parsley.flex.FlexContextBuilder;
            
                           [Bindable]
                           [Inject(id="backOffice")]
                           public var backOffice:IModuleInfo;
                      ]]>
                 </mx:Script>
                 <mx:Metadata>
                      [Waypoint]
                 </mx:Metadata>
            
                 <Core:StructuresViewLoader id="loader" automationName="{MainContentDestination.BACK_OFFICE}" width="100%" height="100%" info="{backOffice}" />
                 <presentation:Login id="login" automationName="{MainContentDestination.LOGIN}" width="100%" height="100%" />
            
            
            </mx:ViewStack>
            
             
            

             

            I thought maybe the messaging is not working because my main.mxml is an application (so he is not configured in the context). But then I tried configure the messaging in a MainPM class injected to main.mxml and dispatch the NavigationEvent through there, and it also didn't work.

             

            Am I missing something?

            • 3. Re: Navigation Library with Parsley 2.2
              liorchaga Level 1

              I found the problem.

              First, it seems that I was correct about having to go through the MainPM which is configured in the context file.

               

              And second, the actual problem was that I put the ManagedEvents tag inside the class declaration and not outside of it (not the first time it happens to me).

               

              Thanks for your help Alex!