2 Replies Latest reply on Feb 28, 2010 1:12 AM by liorchaga

    Cairngorm 3 and Parsley versions

    liorchaga

      I'm trying to build a modular application using Cairngorm 3.

      I've examined thoroughly the Insync-Extended example published on Adobe's site, and tried to reproduced the steps in my own applications.

       

      At first I used Parsley 2.2 in my application, but once I've tried to use CairngormNavigationLib, I got an exception in the PreLoader.as (couldn't even debug into my code). I concluded that I must use Parsley 2.1 (for the latest cairngorm swc files are compiled against Parsley 2.1).

      This solved my problem, but now I'm facing a backwards compatibility problem.

      The Insync example uses Parsley 2.0.1 (obviously with an older build of Cairngorm 3). So many of the things I'm trying to implement can't be done.

      For example, in the Insync example, every module is a spicefactory ContextModule. But this was removed from Parsley 2.1, so I use mx:Module.

      To my surprise, the module was not loaded. Tried to figure out why, and I found out that Parsley 2.1 wouldn't inject anything to my mxml files (I have not experienced this problem in 2.0.1 and 2.2 versions).

      So it appears that in order to use 2.1, I must inject all my views into each other through the context config (which obviously I do not want to do).

       

      This is my configuration:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Object xmlns:parsley="http://www.spicefactory.org/parsley" 
                   xmlns:mx="http://www.adobe.com/2006/mxml"
                   xmlns:module="com.adobe.cairngorm.module.*">
      
           <module:ParsleyModuleDescriptor objectId="backOffice" url="../BackOffice/bin-debug/BackOffice.swf" domain="{ ClassInfo.currentDomain }" />
      
      </mx:Object>
      
       
      

       

      This is my main (shell) file:

      <?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.main.presentation.*" 
           xmlns:cairngorm="com.adobe.cairngorm.*"
           xmlns:spicefactory="http://www.spicefactory.org/parsley/flex"
           preinitialize="FlexContextBuilder.build(MainConfig);" 
           addedToStage="dispatchEvent(new Event('configureIOC', true))">
      
           <mx:Script>
                <![CDATA[
                     import com.adobe.cairngorm.CairngormNavigationLib;
                     import com.adobe.cairngorm.navigation.NavigationEvent;
                     import com.structures.main.presentation.MainContentDestination;
                     import org.spicefactory.parsley.flex.FlexContextBuilder;
      
                     private function navigateToBO(event:MouseEvent):void
                     {
                          dispatchEvent(NavigationEvent.newNavigateToEvent(MainContentDestination.BACK_OFFICE));
                     }
                ]]>
           </mx:Script>
           <mx:Button label="Go to backoffice" click="navigateToBO(event)" />
           <cairngorm:CairngormNavigationLib />
           <presentation:MainViewStack width="100%" height="100%" />
      </mx:Application>
      

       

      This is my MainViewStack:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:ViewStack xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" xmlns:Core="Structures.Core.*"
                       xmlns:spicefactory="http://www.spicefactory.org/parsley/flex" addedToStage="dispatchEvent( new Event( 'configureIOC', true ) )">
           <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>
                [WaypointDecorator(name="structures")]
           </mx:Metadata>
      
           <Core:StructuresViewLoader id="loader" automationName="{MainContentDestination.BACK_OFFICE}" width="100%" height="100%" info="{backOffice}" />
      </mx:ViewStack>
      
       
      

       

      And finally, this is the target module (in another swc):

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module width="100%" height="100%" layout="vertical" xmlns:spicefactory="http://www.spicefactory.org/parsley/flex"
                   xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:cairngorm="com.adobe.cairngorm.*" xmlns:module="com.adobe.cairngorm.module.*"
                   addedToStage="init()">
           <cairngorm:CairngormIntegrationLib />
      
           <mx:Script>
                <![CDATA[
                     import org.spicefactory.parsley.flex.FlexContextBuilder;
      
                     public function init()
                     {
      
                          FlexContextBuilder.build(BackofficeCtx);
                     }
                ]]>
           </mx:Script>
           <mx:Label text="This is the backoffice!!!" />
      </mx:Module>
      
       
      

       

       

      What is the recommended parsley version for working with Cairngorm 3?

      If it's 2.1, how can I overcome the need to configure all my views in the context config?

      Is there an updated example for modular application?

      Is it too early to adopt cairngorm 3? It seems that it changes very frequently and lacks some documentation.

       

      thanks,

      Lior

        • 1. Re: Cairngorm 3 and Parsley versions
          Alex Uhlmann Level 3

          We're in the process of migrating to Parsley 2.2. You can retrieve older versions via our release site
          or SVN

           

          I've just comitted a first version of the Navigation library for Parsley 2.2. Once the libraries are ported to 2.2, we'll also update the samples.

           

          Beside the libraries C3 also contains guidelines and tools. Check them out in case you havn't and let us know what you think about the particular subjects. The libraries are optional, and some of them are indeed in experimental stages. We want to release early and often. We often go through great efforts to release anything at all to the open source community when within projects and serving customers. While I'd expect that this resource will greatly improve over time, it is also meant to be in "flux" to allow us to feedback our opinions based on project experiences quickly and progressivley. Our success will also depend based on the feedback and support we'll receive from the community.

          • 2. Re: Cairngorm 3 and Parsley versions
            liorchaga Level 1

            Thanks for your swift reply Alex.

            I would not withhold my feedback from you :-)