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.

Tags: Flex

Similar Questions

  • Using Flex Performance Profiler for profiling Flex with Java Applications

    Hello

    I intend to use the Flex Profiler to profile my request.
    I have developed a model of application using Flex MXML, ActionScript classes for events and Cairngorm, Java , Oracle database and Blazeds.

    Can I use Flex Performance Profiler to profile my request. ??

    I ask this question as I have ad read the threshold to Adobe site and my Application includes java methods

    "You can use the Profiler to profile ActionScript 3.0 applications.

    Can someone please tell me what this means? and I can use the Performnace Flex Profiler.

    Season me please.

    If you want to evaluate the response time when you call a service, you can use Charles Web Debugging Proxy as it is able to control the calls using the AMF protocol.

    If you want to monitor is the ActionScript objects from Java in the class that retrieves the result in the service, you can use the Flex Profiler.

  • 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

  • Cairngorm events

    I just picked up on Cairngorm and it seems somewhat confusing. I hope someone could help me clarify this point. I have an array of files that I would like to import. How can I run each command without manually create commands and delegates for each of these files. In the end, I might have probably more than just 2 files, 100's.

    private var _file:Array = new Array("file1.xml","file2.xml");

    private void importFiles(): void
    {
    for each (var: string element in _files)
    {
    var event: ItunesEvent = new ItunesEvent (item);
    CairngormEventDispatcher.getInstance () .dispatchEvent (event);
    }
    }

    I essentially want to happen is that when 'file1.xml' is done importing, run the same command to import "file2.xml", etc. and so forth.

    Thank you.

    Nice... looks like than what I wrote just worked. What I did was create a table entitled 'list files' in my model.

    then in the initial start, I have this:

    private var _playListPath:Array;

    for each (var: string element in _playListPath)
    {
    model.fileList.push (item);
    }

    var event: ItunesEvent = new ItunesEvent(model.fileList[0]);
    CairngormEventDispatcher.getInstance () .dispatchEvent (event);

    Then in my order:

    model.fileList.shift ();
    If (model.fileList.length! = 0)
    {
    var e:ItunesEvent = new ItunesEvent(model.fileList[0]);
    CairngormEventDispatcher.getInstance () .dispatchEvent (e);
    }

  • 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

  • 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

  • Cairngorm login authentication problem

    Hello

    Currently I am doing an application that allows a user to log on and according to their level of authorization, they may have full access to the application or have limited access.

    Currently I have implemented so that when the user submits their login information, I send an event that calls the order login and connection delegate validates the result, if successful, then it updates a variable called loginAccess in the model.

    In the main mxml, I put in place so that when loading first the currentState property is related to the loginAccess in the model, so when we connect and succeeds then the variable loginAccess is updated, which then updates the current state of the main application. It works fine, totally in function logout simple connection, but I need to present the viewer with something different based on their permission level - allowing the entire application to be accessible if you are an administrator and one that is destined to a comments user who can only see parts of the application.

    So what, in my opinion, would be the easiest is if the user is prompted, then I can hide or remove some controls and components like tabs, buttons and labels that are not allowed if the user is an administrator and do nothing are.

    This is my problem, I have no way to determine if a user is a guest or an admin at the point when the user first connects.

    In other words, if I do an if/else statement such as: If the user is prompted and then remove the 2nd child of the tab navigation, then I have no the case in my main application to call it, because if I call to creationComplete it is too early, the user has not connected...

    I am making sense here?

    I wonder if I can send some sort of an event of the LoginCommand once the authorization of the user is determined that will then trigger a function in the main mxml which will exercise a function to remove components (if they are a guest), but I don't know how to do this as when the user first connects the connection event is dispatched by the connection component and not the main mxml.

    I do not know if my approach is the best way or if there is a better way.

    Please if anyone has any suggestions that would be great,

    I created this application a few weeks ago completely in flex and am now converted to cairngorm as an exercise and everything is done except for this part.

    Thanks in advance for any help!

    Fuyuko

    public var openTasksComp:OpenTasks;

    his only declaring a variable, uninitialized.

    you have to match to your model by


  • Help the Flex, Blaze and Cairngorm

    I have using Blaze, Flex3, and Cairngorm, I have a simple application at the present time, in which I send a Cairngorm event, he gets from the picked up that the command is executed and the delegate can send data to the RemoteObject. I can see in the output that Blaze does what it is supposed to do and the return of what it is supposed to return, but the returned data never makes it to the function result IResponder. What I am doing wrong? Can you send the code if necessary.

    Found the problem. ... in my delegate I forgot to addResponder to the AsyncToken.
    Before:
    public function getUsers (): void {}
    var call: AsyncToken;
    Call = service.getUsers ();
    Alert.Show ("Get users has been called");
    }

    After:
    public function getUsers (): void {}
    var call: AsyncToken;
    Call = service.getUsers ();
    call.addResponder (this.responder);
    Alert.Show ("Get users has been called");
    }

  • Event Bubbling: Relay of the custom events

    Background:
    The bubbling in the action script 3 event causes an event to travel from the responsible subject through all its objects from parent to the root application. The event then moves back down to the original object.

    Goal: keep the data, the controller and the loosely coupled views
    1. When display objects are instantiated, they send an event by saying that they need certain information. The event has the type of information they need.
    2. the purpose of data capture this event, determines if it it has in memory. If it isn't, it retrieves information from a web service and pushes the result in a table.
    3. once the result in memory, it takes an event that contains the index of the result table.
    4. the view captures the result, out of the index and use it to link to the correct array element

    Result: The display is automatically updated every time that the data object is called by the web service with an update.

    In this scenario, nor the view or the data can be parents of each other, but each must be able to respond to the events of each and other. The reason is so that I can have multiple views generated dynamically, using the same data.

    Question:
    If the data (model) and the views are children of the same application, how does one maintain loose coupling between them?

    Current solution:
    The only thing I could get to is having the object application or controller catch all custom events and then their reconsignment to the children. The problem is that it is messy.

    I could also design a handler class that would have the forwarding of events to the right of the child hierarchy. I could include a private string variable that would capture the name of the object responsible for when my custom event was known as the class handler could do dynamic mapping.

    Is there a better solution?

    Thanks - I posted the question on something awful and someone suggested that I use a microwave recommended architecture on Adobe Labs called Cairngorm , I'll go through the documentation and give it a test drive this week.

  • Question framework Cairngorm abourt?

    Hello

    I don't understand why put us the following line in the homepage.

    < control: myController id = "controller" / >
    < id: Commercial Services = 'services' / >

    but no code in the homepage use the ID for the control and businesses.

    Thank you

    Mark

    These create references to your object of service.mxml and your application controller object using the cairngorm objects by raising events and execution of services.

    The service.mxml file contains all the CPP or web service config given as:

    ' URL =' http://localhost:8090/febatmon/XML/ControlNav.xml ' / >

    The appController object must extend the FrontController and is used as a central repository for the execution of event like this:

    SerializableAttribute public class AppController extends FrontController {}

    public static const LOAD_CONTROL_NAV_EVENT: String = "LOAD_CONTROL_NAV_EVENT";

    public void AppController() {}

    addCommand (AppController.LOAD_CONTROL_NAV_EVENT, ControlNavLoadCommand);
    }
    }

  • Cairngorm makes too rely on / promote Singletons?

    It seems to me that Cairngorm too promotes the use of Singleton classes for application development, which can cause serious headaches down the road.

    Two of their main design patterns are the CairngormEventDispatcher/CairgormEvent and the ModelLocator, as well as the FrontController. I came across a number of cases where the original design of an application was assumed to be independent, when in fact a little forethought would have made it clear that, ultimately, it is a built-in custom component more than anything else. Be able to use autonomous was useful, but in general it would be integrated as a module into another Flex application.

    The problem comes when you need to add a second instance of the Cairngorm application. I have a widget creation and a reading widget, both built from code shared since the creation widget also includes the reading widget. So now I want to integrate the TWO creating a widget AND a widget of reading in my application. Indeed, like any other component (think combobox), I might want to include several widgets reading, each showing some users personal creation, all on the same page.

    However, because my reading widget using Cairngorm, I'm practically no chance with the current code base. Assuming that I cram several widgets reading in a certain way (after all the question of departure/FrontController service) I have no way to control which of my multiple widgets responds when I hit the play button in one of them, because they are all listening for this event. Similarly my boss ModelLocator completely breaks down, since all widgets reading will share the same ModelLocator.

    Is it just me? Am I missing something? Or is the original designer of this application need to know better how he would serve a year later? What is a breakdown of the total Cairngorm design patterns?

    Yes, it looks like Cairngorm was not may not be the best choice for the 'widgets' you. I guess you have a point they should clarify better when you are not using Cairngorm. I have never tried to use when developing a component custom (or whatever it is) it's going to be added in a complete application.

    Reading various articles, I (IIRC) feel like the guys from Farata Systems (perhaps Yakov) seem not to be very keen on frameworks (Cairngorm is called a "mictoarchitecture"), but rather of focus simply on strong "design component" and using the Flex event (i.e. dispatchEvent()) system. I certainly appreciate this attitude of questioning because too often inside, it seems that people seem to accept 'best practices' and 'how it is 'supposed' to do' as bible regardless of whether she is really an added value, or add unnecessary complexity. I think that the answer to everything, always, 'it depends' and we have to use our common sense and intelligence to understand that we really gain anything by doing something 'standard' which has questionable value.

    I used the Cairngorm architecture but not meet your problem, maybe because I use it only to a "demand" level, never intend to have the product of this project integrated in what either.

    http://ColdFusion.sys-con.com/read/479472_1.htm
    (Didn't read all this, or I forgot if I did it, just put it here in case something I said about others ' opinions was not completely accurate.)

  • Cairngorm - problem resulthandling

    We use the Cairngorm framework in our Flex 2.0 App and now meet a problem related to the resulthandling. If I trace the result in the onResult handler in the command class, once the first time traces I call service, the second two times, three times third and so on. It could be related to the code that adds the event handler, but I'm not sure.

    Any of you encounter the same problem, or maby see some errors in the code below?

    Event class:

    SerializableAttribute public class GetCategoriesEvent extends CairngormEvent
    {
    public void GetCategoriesEvent() {}
    Super (GetCategoriesEvent.EVENT_GET_CATEGORIES);
    }
    public static var EVENT_GET_CATEGORIES:String = 'getCategories ';
    }


    Command class:

    / public class GetCategoriesCommand implements Command {responder
    private var model: ModelLocator = ModelLocator.getInstance ();

    public void execute (event: CairngormEvent): void {}

    var delegate: GetCategoriesDelegate = new GetCategoriesDelegate (this);
    var getCategoriesEvent: GetCategoriesEvent = GetCategoriesEvent (event);
    delegate.getCategories ();
    }

    public function onResult (event: * = null): void {}
    Application.application.trace ("onResult:" + event.result);
    }

    public function onFault (event: * = null): void {}
    Application.application.trace ("onFault:" + event.result);
    }
    }



    Delegate class:

    public class GetCategoriesDelegate
    {
    private var responder: responder;
    private var service: Object;

    public void GetCategoriesDelegate (responder: responder)
    {
    This.service = ServiceLocator.getInstance () .getHTTPService ("getCategories") like HTTPService;
    This.Responder = responder;
    }

    getCategories() public void: void {}
    service.addEventListener (ResultEvent.RESULT, getCategories_onResult);
    service.addEventListener (FaultEvent.FAULT, getCategories_onFault);
    service. Send();
    }

    private function getCategories_onResult (event: ResultEvent): void {}
    responder.onResult (event);
    }

    private function getCategories_onFault (event: ResultEvent): void {}
    responder.onFault ();
    }
    }

    Service:

    "" < mx:HTTPService id = 'getCategories' url = ' http://localhost:9081 / saver/fondtilbud/action? action = list_verdipapir_kategorier '
    showBusyCursor = "true".
    useProxy = "false" / >

    Hello

    Do you want a new instance of GetCategoriesDelegate response to demand. It seems that you keep to add listeners to your service. Try

    getCategories() public void: void {}
    var token: AsyncToken = service.send ();
    If (token! = null)
    {
    token.addResponder (responder);
    }
    }

    Do your GetCategoriesCommand implements IResponder, and result and fault functions

    William Chan

  • How to invite people to an event calendar with the new iOS 10?

    Before I updated to iOS of 10, I was able to create a calendar event with the apple iPhone built-in calendar and there is an option to 'invite' contacts him so they could add to their calendar. I can't find this option now after the new update. Where and how can I do this?

    Invite others to an event. You can invite people to an event, even if you're not the one who, on demand with Exchange and some other servers. Press an event, press on modify, then on the guests. Type the names, or tap to select the people to contact. If you don't want to be notified when someone refuses a meeting, go to settings > calendar, then disable view guest declines.

Maybe you are looking for