Cairngorm 3

Is it true that in C3, you will be able to call functions in the view?

as far as I see it, the c3 is just a line Director archiecture. They recommend be implemented using an Ioc framework.

If you use messaging framework parsley for example, if course you can simply call the functions one views directly to establish shipping between components. But you will porbably not according to the directives of the architecture.

Instead of calling the functions of view directly, you may prefer to call the functions on the PresentationModels points of view and make the view update themselves. If it takes a complex update logic on change model, the Observer class c3 library can be useful.

Learn more about it here

http://forums.Adobe.com/thread/590272?TSTART=0

Tags: Adobe Open Source

Similar Questions

  • Cairngorm - ModuleViewLoader question?

    Hello

    Don't know if it's really a mistake...

    I use the following to insert a module into a MXML file

    < module: ModuleViewLoader width = "100%" height = "21".

    moduleManager = "{counterpartySearchModule}".

    skinClass = "com.adobe.cairngorm.module.ModuleViewLoaderSkin" > "

    < module: loadPolicy >

    < module: BasicLoadPolicy / >

    < / module: loadPolicy >

    < / module: ModuleViewLoader >

    While it works well... at first when the module is about to load... I get a text saying 'Landing' and then 'Loading'... "and I can not understand why.

    The module is basically a module of AutoComplete using AutoComplete of Hillel Coren library.

    It is a behavior of Cairngorm Modules or is it something I need to study with AutoComplete of Hillel Coren library?

    Thank you

    I solved my problem

    Landing and loading channels come from the ModuleViewLoaderSkin. If you do not want these you need to create your own.

  • Cairngorm 3 with FlexSDK 4.5.1 lib compatibility

    What versions of library of parsley/Cairngorm 3 are compartible with FlexSDK 4.5.1?
    Parsley/Spicelib cares as much as I would like to ask the question on Spicefactory

    Forum, but it's stop in the last week or so. Someone knows why?

    Thank you

    All this should be compatible.

  • problem during build source cairngorm

    Hello

    I checked cairngorm SVN and try to build using Maven 3.0.3. But I have encountered these problems:

    1, mvn complaints that brought 'external' is not recognized. (see annex 1)

    cairngorm_1.png

    2, perhaps because point 1 above, the generation cannot resolve the dependencies and failed (see attachment 2)

    cairngorm_2.png

    3, in the libraries/pom.xml, the version of the flex sdk is still 4.1. How can I make it work with flexsdk 4.5.1?

    Can you help me understand how to compile the cairngorm3 correctly?

    Thank you!

    York

    you're referncing trunk? Trunk is here earlier:

    http://sourceforge.NET/Adobe/Cairngorm/code/827/tree/cairngorm3/trunk/

    You can use the web based SVN via the 'Code' button in the menu bar on SF or http://sourceforge.net/adobe/cairngorm/code/

    I don't see Flex 4.5 in the pom of high-level in the trunk.

    Popup library is available in different versions. Popup itself does not contain a reference to the parsley, but there is also a PopupParlsey version. This is really useful in the old version of parsley which are provided via the wiki because that in later versions of parsley, parsley added the tag PopUp that makes this obsolute.

    The distribution of parsley only made reference to Popup library non - parsley.

  • Cairngorm 3 in Flex4

    Hello

    I'm new in flex4 and want to use an architectural setting. But there is confusion in using the framework.

    Can U please suggest me that I can use Cairngorm 3 in flex4. Is there no problem to use it.

    Or else should I have to go with parsley 2.2 only in flex4.

    Or parsley 2.3.1 and Cairngorm 3 (combination)

    What is the best...

    Thanks and greetings

    Hello

    Please click the link: http://rushmeflex.blogspot.com/2010/09/cairngorm-3-example.html

    Hope this helps

    Rush me

  • Best use of a model in cairngorm

    I'm a bit confused about the use of a model, ModelLocator in cairngorm

    I created it and everything works fine but what is the best way to access it, currently I have many forms that all do something like

    < fx:Script >
    <! [CDATA]

    import com.model.ModelLocator;

    [Bindable] private var model: ModelLocator = ModelLocator.getInstance ();

    and then later on

    private void fun1(evt:Event):void
    {

    Model.something = 'blah '.

    var s1:String = model.anotherSomething;

    }

    or something else

    Is it OK to have varibles across the mxml files different all creating a model private var, made this last resouces or is it ok because than its static

    I have also several arrayCollections 11 + other stuff in the model, is this ok

    Hi JockMahon,

    Its ok fine, you can go with this...

    However do not forget something you will be declaring variables in the ModelLocator class if you use them in your application. I mean more of an mxml page, or in the form of files. However if you need to a property or variable in a single file, then you can declare it locally in the file instead of inside decalring

    ModelLocator.

    ModelLocator in cairngorm framework is a class singleton in how many files, you have a model variable, it will actually return or return only single instance of the ModelLocator class static.

    [Bindable] private var model: ModelLocator = ModelLocator.getInstance ();

    How many times, you have a variable using the style above decalring then you will get only a single static reference to the instance of the ModelLocator class. No no instances are created. It's like you get a pointer to the model variable.

    I hope it is clear now.

    Thank you

    Jean Claude

  • Help me complete my first Login of Cairngorm example.

    Hello

    I'm still fearing to make an application using Cairngorm. Help, please

    This will be my sketch of my Caringorm request.

    This will is a LoginExample where on a successful connection is displayed as WELCOME or INVALID CONNECTION in the case of a bad connection.

    Please go through my code:

    It's my hand mxml file


    <? XML version = "1.0" encoding = "utf-8"? >
    < mx:Application xmlns:controller = "uk.co.clockobj.cairngormdemo.controller. *" >
    < controller: AppController / >
    < mx:Script >

    user: UserDTO var = new UserDTO();
    public function login (): void
    {
    User.UserName = UNAMETI.text;
    User.Password = PASSTI.text;
    systemManager.dispatchEvent (LoginEvent.LOG_USER_IN, user);

    }
    < / mx:Script >
    < / mx:Application >

    It's my UserDTO object:

    package dto
    {
    [Bindable]
    [RemoteClass(alias="namespace.to.some.server.dto")]
    public class UserDTO
    {
    public var username: String;
    password public var: String;

    public void UserDTO()
    {
    }
    }
    }

    This is my controller class:

    controller package
    {
    SerializableAttribute public class AppController extends FrontController
    {
    public void AppController()
    {
    Super();
    initialiseCommands();
    }

    private void initialiseCommands(): void
    {
    addCommand (LOG_USER_IN, LogUserInCommand);
    }
    }
    }

    This is my class of the event:

    package events
    {
    import com.adobe.cairngorm.control.CairngormEvent;

    SerializableAttribute public class LoginEvent extends CairngormEvent
    {

    public static const var LOG_USER_IN:String = "LOG_USER_IN";

    the user public var: UserDTO

    public void LoginEvent (type: String, user: UserDTO, bubbles: Boolean = false, cancelable: Boolean = false)
    {
    Super (type, bubbles, cancelable);

    This.User = UserDTO;
    }

    }
    }

    This is my command class:

    package controls
    {
    public class LogUserInCommand implements ICommand, IResponder
    {

    Service myremoteservice;
    public void LogUserInCommand()
    {
    }

    override public function execute(event:CairngormEvent):void
    {

    myRemoteService = ServiceLocator.getInstance () .getRemoteObject ("docsServices");
    }

    public void result(data:Object):void
    {

    ModelLocator.getInstance (.welcome = property ResultEvent (data));

    }

    public void fault(info:Object):void
    {

    ModelLocator.getInstance (.invalid = property ResultEvent (data));


    }

    }
    }

    This is my ModelLocator class:

    package template
    {[Bindable]
    / public class ModelLocator implements IModelLocator
    {
    private static var _instance:ModelLocator;

    Public Shared function getInstance (): {ModelLocator}
    If (_instance == null) {}
    _instance = new ModelLocator();
    }
    return _instance;
    }

    public void ModelLocator()
    {
    If (_instance! = null)
    {
    throw (new Error ("class Singleton has already been instantiated"));
    } else
    {
    session = new SessionModel();
    }
    }

    the user public var: UserDTO

    public var welcome: String;
    public var invalid: String;

    }
    }


    I have my file services.mxml defined in connection with my java file:


    < mx:RemoteObject
    ID = "docsServices".
    destination = "ToRemote.

    source = "cairngormcf.com.cf.CairngormJava" > "
    < / mx:RemoteObject >

    my questions to what is above the code are:

    1. How can I call the FrontController of my connection function of the main Application under the container form.

    2. after sending my logon function event, who should listen to this event. (How to do here)

    3.
    3. after obtaining the DTO user details in my Java layer, I validate the data and I sends a string either valid or invalid connection Login as String, here's how my main Application gets it data?

    Please help me in all these things, really, it will be a great help.

    While waiting for the responses from the experts

    Thanks a lot for reading long code.

    Hi Kiran, this is your class in place of the stuff as mentioned in the classes below that it's

    or if you can change it yourself here I use the custom component and I import this component custom demand... so use custom component to send event cairngorm...

    the best practice is to create a display component, and then import this view in your application and which will reduce the file size of your application and file size of download... so if you have any problem using this code let me know

    company
    ------------
    1 MyServices
    ------------

    http://www.Adobe.com/2006/mxml '.
       
    xmlns:Cairngorm = "" com.adobe.Cairngorm.Business. * ">"
       
       
        <>
    destination = "user".
    ID = "userRO" >
           
       
       

    2 UserDelegate
    --------------
    business package
    {
    import com.adobe.cairngorm.business.ServiceLocator;
       
    Import mx.rpc.AsyncToken;
    Import mx.rpc.IResponder;
    Import mx.rpc.remoting.RemoteObject;
       
    import Vos. UserVO;
       
    public class UserDelegate
    {
           
    public var myServices:ServiceLocator;
           
    public void UserDelegate()
    {
    TODO: to implement the function
    myServices = ServiceLocator.getInstance ();
               
    }
           
    Create a function to communicate with the server here

    public void validateUser(userObj:UserVO,responder:IResponder):void {}
               
    Check out the service you want
    communicate the servicelocator
               
    var userRO:RemoteObject = myServices.getRemoteObject ("userRO");
    var resMsg:AsyncToken = userRO.validateUser (userObj);
               
    join the answering machine
               
    resMsg.addResponder (responder);
               
               
    }

    }
    }

    LoginCommand
    ------------
    package controls
    {
    import business. UserDelegate;
       
    import com.adobe.cairngorm.commands.ICommand;
    import com.adobe.cairngorm.control.CairngormEvent;
       
    How to import events. LoginEvent;
       
    Import model. MyModelLocator;
       
    Import mx.controls.Alert;
    Import mx.rpc.IResponder;
    Import mx.rpc.events.ResultEvent;
       
    import Vos. UserVO;

    public class LoginCommand implements ICommand, IResponder
    {
    public var myModel:MyModelLocator;
    public var userDelegate:UserDelegate;
           
    public void LoginCommand()
    {
    TODO: to implement the function
    This allows to manipulate data in the
    model
               
    myModel = MyModelLocator.getInstace ();
    }

    public void execute(event:CairngormEvent):void
    {
    TODO: to implement the function
    We will do our logic here
               
    var loginEvent:LoginEvent = event as LoginEvent;
    var userObj:UserVO = loginEvent.userDtl;
               
    / * If (userObj.userName == "[email protected]" &)
    {userObj.password == "naresh") "}
    do something
    myModel.userDtl = userObj;
    myModel.APP_STATE = "login";
                   
    } else {}
    do something else
    Alert.Show ("connection failed");
    }*/
               
    create the delegate user instance
               
    userDelegate = new UserDelegate();
    userDelegate.validateUser (userObj, this);
                
    }
           
    public void result(event:Object):void {}
               
    var resultEvent:ResultEvent = event as ResultEvent;
               
    {if(resultEvent.Result!=null)}

    myModel.userDtl = resultEvent.result as UserVO;
    myModel.APP_STATE = "login";
                
    } else {}
                   
    Alert.Show ("connection failed");
    }
               
    }
           
    public void fault(event:Object):void {}
               
    }
           
           
    }
    }

    LoginPanel
    ----------

    <>
    "xmlns:MX ="http://www.adobe.com/2006/mxml"
    title = "Login here" >
       
       
            How to import events. LoginEvent;
    import Vos. UserVO;
    Import model. MyModelLocator;
    Import mx.events.ValidationResultEvent;
               
    public void loginUser(event:MouseEvent):void {}
                   
    var emailValEvnt:ValidationResultEvent
    = emailVal.validate ();
    var pswdValEvnt:ValidationResultEvent
    = pswdVal.validate ();
                               
    If (emailValEvnt.type is ValidationResultEvent.VALID
    (& pswdValEvnt.type == ValidationResultEvent.VALID) {}
                       
    as the validation is made
    communicate the data on the server
                       
    the failure of the value object
    var userObj:UserVO = new UserVO();
    userObj.userName = userNameTI.text;
    userObj.password = passwordTI.text;
                       
    var loginEvent:LoginEvent =
    new LoginEvent (LoginEvent.LOGIN_EVENT, userObj);
    dispatches the event
    loginEvent.dispatch ();

    CairngormEventDispatcher.getInstance.dispatch (loginEvent);  //Import com.adobe.cairgorm.CairngormEventDispatcher CairngormEventDispathcer
    } else {}
    display error message
    this.errorString = 'Pleae enter valid details';
    }
                   
    }
               
    ]]>
       
       
    <>
    source = "{userNameTI}".
    property = "text".
    ID = "emailVal".
    required = "true".
    triggerEvent =""
    />

    <>
    source = "{passwordTI}".
    ID = "pswdVal".
    maxLength = "16".
    minLength = "6".
    property = "text".
    triggerEvent =""
    />


           

               
           
           
               
           

           
       
           
       

       

    MyFrontController
    -----------------
    controller package
    {
    import com.adobe.cairngorm.control.FrontController;
       
    How to import events. LoginEvent;
    import controls. LoginCommand;

    SerializableAttribute public class MyFrontController extends FrontController
    {
    public void MyFrontController()
    {
    Super();
    addCommand (LoginEvent.LOGIN_EVENT, LoginCommand);
               
    }
           
    }
    }

    LoginEvent
    -----------
    package events
    {
    import com.adobe.cairngorm.control.CairngormEvent;
       
    import flash.events.Event;
       
    import Vos. UserVO;

    SerializableAttribute public class LoginEvent extends CairngormEvent
    {
    public static const = "loginEvent"; LOGIN_EVENT:String
            
    public var userDtl:UserVO;
           
    public void LoginEvent (type: String, userObj:UserVO)
    {
    TODO: to implement the function
    Super (type);
    this.userDtl = userObj;
    }
           
    override public function clone (): Event {}
               
    return of new LoginEvent (type, userDtl);
    }
    }
    }

    MyModelLocator
    --------------
    package template
    {
    import com.adobe.cairngorm.CairngormError;
    import com.adobe.cairngorm.model.IModelLocator;
       
    import Vos. UserVO;
       
    [Bindable]
    / public class MyModelLocator implements IModelLocator
    {
    public static var instance: MyModelLocator;
           
    public void MyModelLocator(enforcer:SingletonEnforcer)
    {
    TODO: to implement the function
    {if(Enforcer==null)}
                   
    trace ("you cannot create more than one instance of ModelLocator");
    throw new CairngormError ("initializing Multiple");
                                   
    }
               
    }
           
    public static function getInstace (): {MyModelLocator}
               
    {if(instance==null)}
    create a new instance
    Return it
    instance = new MyModelLocator (new SingletonEnforcer());
    return instance;

    } else {}
    return the existing instance
    return instance;
    }
               
    }
           
    Declare the Variables here
    Don't forget to initialize them
           
    contains the user data
    public var userDtl:UserVO = new UserVO();
    check the status of the application
    public var APP_STATE:String ="";
           
    }
    }
    Class SingletonEnforcer {}

    UserVO
    -------
    package vo
    {
    [Bindable]
    [RemoteClass(alias="com.test.lcds.vo.UserVO")]
    public class UserVO
    {
    public var userName:String;
    password public var: String;
           
    public void UserVO()
    {
    }

    }
    }

    Cairngorm2
    -----------

    <>
    "xmlns:MX ="http://www.adobe.com/2006/mxml"
    layout = "absolute".
    xmlns:comp = "comp.*.
    xmlns:control = "controller.*".
    xmlns:vo = "vo.*".
    xmlns:business = "mentoring."
    Initialize = "initApp () '"
    currentState = "{myModel.APP_STATE}" > "
       
       
       
       
       
       
       
       
       
       
            Import model. MyModelLocator;
               
    [Bindable]
    public var myModel:MyModelLocator;
               
    public function initApp (): void {}
                   
    myModel = MyModelLocator.getInstace ();
                   
                   
    }
               
    ]]>
       

       
           
               
               
                   
    text = fontWeight "Congratulation {myModel.userDtl.userName}" = "bold" fontSize = "18" / >
               

           

       

       
        <>
    horizontalCenter = "0".
    Red = "0" id = "loginpanel1" >
           
       
       

    Place these classes in relavent ane packages try it... you must implement service locator in the pakage delegate as well as the UserDelegate class

  • Are there separate Forums to post Cairngorm related questions

    Hello

    I'm practicing Flex with Java using Cairngorm, I'm some queries in Cairngorm, please let me know if I can post cairngorm questions here or is it all Forum planned for it?

    Thank you.

    Hi, here is the link for the cairngorm forums.

    http://forums.Adobe.com/community/opensource/Cairngorm

  • Examples of applications Cairngorm 3 - lack of libraries

    I checked the sample applications of http://opensource.Adobe.com/svn/opensource/cairngorm3/trunk/samples/InSync/ repository, but these reference samples of Cairngorm libraries, that are missing. What version should I use to be able to build these samples?

    best regards Zdenek

    Insync samples work with the latest versions of trunk snapshot. But for now with versions release in our repository Maven. We are migrating to SourceForge and have just started to put the latest SWC in the SF herewiki. Of course, you can always get the latest version of the Maven repositorySWCs.

  • Module and Navigation for Cairngorm 3.0.13

    Hello

    do you have a calendar on the release of Module and Navigation/NavigationParsley to the repository maven for Cairngorm 3.0.13?

    I am currently getting errors using the 3.0.12 version, which I think is due to the different version of the compiler flex for 3.0.12 (i.e. 4.0.0.x), while the version of the compiler flex 3.0.13 is 4.1.0.x, which is the version that we use for the construction of our project, too.

    Don't want to get on your nerves, just trying to get a feel for speed and to plan ahead for our integration of it / hudson , great job on the transition to maven makes life a lot easier! If we could help you on that front (I don't really have what is now missing out the Module/Navigation/NavigationParsley for 3.0.13, maybe I could help?)

    best Jonas

    Good news: we've just released new libraries as 3.0.14. The library of navigation left RC to 1.0.

    We don't have not updated the wiki still however, which could take a few more days.

    Best,

    Alex

  • A query regarding Cairngorm events

    I'm new to cairngorm.
    I'm designing a StudentApplication using Flex with Cairngorm.
    I am struck at writing a Cairngorm event class. Please guide me

    Assume that this StudentApplication is suppourting Create, Delete, Update, read operations.

    My question is what I have to write 4 event classes, every representative of this operation.

    Or is it possible to do so in an event class by taking 4 different constant Sring, each representing the appropriate Action.

    package com.control
    {
    import com.adobe.cairngorm.control.CairngormEvent;

    public class CreateEvent extends CairngormEvent
    {


    }
    public static const EVENT_CREATE_STUDENT: String = "EVENT_CREATE_STUDENT";
    }

    My question is what I need to do Create, Update, Delete, reading for all events
    Event of my Application?

    Please guide me.

    Thanks in advance.

    Hi Kiran,

    You can write all the events in a class single say StudentEvent class and perform the appropriate action according to the type of event (delete, update, add... etc) but if you do you need to process the result returned by the remote service based on the type of event in command later and write your logic.

    for ex:

    In your layer (StudentCommand) command in the results... Manager function you need to treat them that way...

    public function result (data: Object): void

    {

    If (data! = null)

    {

    If (_eventtype is "deletestudent")

    {

    Write you the logic to remove the student

    }

    ElseIf (_eventtype == "createstudent")

    {

    Write logic to create the student

    }

    ElseIf (_eventtype == "updatestudent")

    {

    Write logic to update students

    }

    on the other

    {

    Write you logic to read the details of the student

    }

    }

    }

    deletestudent, createstudent, updatestudent and readsrstudent are the event four guys who you here as of constant static in StudentEventclass.

    If you want to write event 4 classes for all then also its good so that you can have the class wrapper for all events.

    If you want to have custom and reduces the code, then use the single event class. Its based on your requirement...

    Thank you

    Jean Claude Chari

  • Cannot send a Cairngorm event!

    I have a Cairngorm event:

    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////

    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////

    public class ChangeData extends CairngormEvent

    {

    public static var EVENT_CHANGE_DATA:String = "ChangeData;

    public function ChangeData (type: String, bubbles: Boolean =fake, cancelable: Boolean =fake)

    {

    Super (Charts_FrontController.EVENT_CHANGE_DATA);

    }

    }

    ////////////////////////////////////////////////////////////////////////////////////////// /////////////////

    I stated the following in the FrontController:

    public static const = "ChangeData; Charts_FrontController.EVENT_CHANGE_DATA:String

    and now I can't get this to work:

    ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////

    import flash.events.Event;

    import com.adobe.cairngorm.control.CairngormEventDispatcher;

    public function ChangeData(e:MouseEvent): Sub

    {

    var ev:ChangeData = new ChangeData ('ChangeData');

    CairngormEventDispatcher.getInstance () .dispatchEvent (ev);

    }

    ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////

    It gives me two errors:

    Type was not found or was not a compile-time constant: ChangeData

    Method cannot be used as a constructor

    Help, please

    change the name of the method - it interferes with the name of the class

  • Access xml files in Cairngorm

    Hi all

    I create a simple application to access data xml using Cairngorm. I used HTTPService and defined in a file Services.mxml. Now where do I place the xml file and what URL should I put in the HTTPService?

    When you create a structure of directories of cairngorm, there are so many directories which is the root folder? Here's my directory structure...

    project

    bin

    Main.swf (I'll run the application in the AIR around here)

    libs

    CBC

    XML

    myXML.Xml

    company

    Services.MXML (here, I defined the HTTPService)

    delegates

    MyDelegate.as (define an instance of HTTPService here)

    events

    MyEvent.as

    answering machines

    orders

    MyCommand.as (define the delegate here)

    Display

    MyView.mxml (event is raised here)

    Main.MXML (display is defined here)

    I tried to use the url ".» "/ xml/myxml.xml. This gave 'stream error Error #2032.

    What should I do here?

    Kind regards

    SHiVik

    Hello

    Try the url = xml/myxml.xml

  • Events in Cairngorm

    Hi all

    In cairngorm, is it OK if I don't set the event properties?

    Thanks and greetings

    ShiVik

    Hello

    Yes, it's ok.

    You must define a name for the event and that's enough. All the other data and info you can get model.

  • On the stakeholders in Cairngorm

    Hi all

    Here, I'm confused. I saw some examples of cairngorm in action - login screens, messages in a blog, etc..

    From what I understand, I got all my services will lie in the mxml ServiceLocator file. I have many classes of service and I'll create a RemoteObject to each of them, setting their methods inside the tag mx:RemoteObject using the mx:method tag.

    But what about speakers? Should I create a separate machine for each method of each service? Or 1 answering machine by service? Or just once the answering machine - this is not a Singleton, so I think that this option is not correct.

    Please guide me properly.

    Thanks and greetings

    ShiVik

    You are right. I messed up my terminology. You have an answering machine for each method in your service. I saw a method as a service, if you get what I mean.

    That's what you get when you are not using Cairngorm for a few months. Sorry for the mixup!

  • Question about ModelLocator in Cairngorm

    Hi all

    I just started using Cairngorm in my application. I did some sample applications to get a core of Cairngorm and the classes used terminology.

    Can an application built using Cairngorm cause multiple ModelLocators? as for some screens I want separate ModelLocators? Is this a bext practice when using Cairngorm?

    P.S. I want to use mutiple ModelLocators but they'll all be a singleton.

    Anyone can guide me please?

    Thanks and greetings

    ShiVik

    Hello

    Yes, you can use several ModelLocators in your application. Extend this class and that your class modellocator made-to-measure to meet your requirement.

    Make sure that they are used for different purposes.

    Best regards

    Rush me

Maybe you are looking for