Hi Takeshita, Carlos suggested that I post a quick example of the type of
config I am using for Crux. This includes use of Commands which is not in
the Royale examples currently.


I think the easiest way to explain for commands (for now) is to refer to
this[1]

Once you have your CommandMap set up, all that is required is to add it to
the set of beanProviders in the top level Crux configuration, an example
might look like this:

<!-- BeanProviders simply contain the non-display objects that Crux should
process. -->
<cx:beanProviders>
    <!-- an imported beanProvider (mxml based subclass) -->
    <services:CruxServicesConfig id="cruxServicesConfig"/>
    <!-- an imported beanProvider (mxml based subclass) -->
    <control:CruxCommandConfig/>
    <!-- an imported beanProvider (mxml based subclass) -->
    <model:CruxModelConfig/>
    <!-- an inline beanProvider -->
    <cx:BeanProvider>
        <portingutils:CruxDispatcherAccessor/>
    </cx:BeanProvider>
</cx:beanProviders>


So in the above examples, the CruxServicesConfig , CruxCommandConfig and
CruxModelConfig  are simply mxml files with the BeanProvider tag as root
tags.
If you need singleton access to them in a similar way that you use for
Cairngorm that would be easy to add also for services and models. But it
means importing those classes for all the usage sites (which I guess you
had to do for cairngorm anyway, so that could be a viable option if you
prefer). In most cases it's probably easier to switch to injection for the
models and services.



1.
https://swizframework.jira.com/wiki/spaces/SWIZ/pages/8126506/Support+for+the+Command+pattern



On Sun, Oct 13, 2019 at 8:06 AM Greg Dove <greg.d...@gmail.com> wrote:

>
> Hi Takeshita,
>
> 1. "model" is the same as Cairngorm's vo (value object)?
> Answer: Actually 'vo' seems more correct for that example. Those were done
> quite quickly and I guess I used a package structure as a template. I will
> change that example to use vo as the package name for those later this
> week, thanks for raising that.
> That example was just a quick attempt to express another example elsewhere
> in the full set of examples in a way that worked for Crux. So yes, those
> are supposed to be value objects.
>
> 2. Is like ServiceLocator mxml required for Crux also?
> Answer: The times I have used Crux, yes I set up a 'BeanProvider' that
> includes the services. The id used for each service can be used for
> injection (which is different to Cairngorm) but provides a way to 'locate'
> the service.
>
> 3. When sending/receiving to/from application server using RemoteObject,
> how it is coded in Crux?
> Answer: With the recent work I ported, I was doing that inside the
> commands, with an implements ICommand, IResponder type approach (that
> wasn't using remoting specifically, but mx services in general).
>
> you can inject the required service into the command (follow on from your
> question 2).
> [Inject(source="myServiceId")] // the myServiceId corresponds to a service
> in the services 'BeanProvider'
> public var service:HTTPService; //or RemoteObject
>
> Use of the command pattern is not required though, and I am working on
> another app that has the beginnings of Crux integration without using
> Commands. it is pretty flexible.
>
> 4. Is there any short introduction to migrate from Cairngorm to Crux?
> Answer: No, not yet. Unless someone else tried it in the last 6 weeks, I
> guess I am the only one to do this so far. I did it about 6-8 weeks ago for
> one client as part of a proof of concept (the goal was to get general
> business logic working and one or two view/UI components, the full app work
> will come later).
> If I get time I will aim to create a guide for that. Or even better (from
> my perspective) if you want, I would be happy to provide you with full
> support to get things working with Crux if you would be happy to contribute
> a guide that will help others to get it working. I think guides are much
> better when they directly incorporate the perspective of someone who is
> approaching this for the first time. (I'm not making this a condition for
> my help, just suggesting it as an option, because we're keen to make it
> easy for more people to contribute to Royale).
>
> A couple of things I can remember without going back to look at any
> specifics:
> For Crux commands:
>
> The execute method has no argument in Crux. In Cairngorm it has the event
> as the argument, iirc.
> ICommand does not provide access to the event.
> implement IEventAwareCommand if you want access to the event in the
> command.
>
> Global Dispatcher access:
> Because the Cairngorm code used a lot of singleton access, I cheated a bit
> and matched that for some of the code I was porting.
> I created a DispatcherAccessor with singleton access which I can probably
> add to the Crux lib as a util class for this type of thing.
> It is just used to inject the main dispatcher in during configuration,
> then it can be used elsewhere in a similar way to how the original
> Cairngorm code was accessing its global dispatcher. Or you can go full
> conversion and switch everything to use injection for dispatcher access,
> for example.
>
> Note also that the support for processing of View components (the ability
> to inject into view components, run PostConstruct methods etc, requires the
> 'JSStageEvents' bead to simulate stage events. You can see that in the
> examples in the main app.
>
>
>
> On Sat, Oct 12, 2019 at 8:54 PM Takeshita Shoichiro <jl03...@gmail.com>
> wrote:
>
>> Alex and Greg, thanks.
>>
>> I'd like to try Crux first.
>>
>> Greg, several questions for CruxGitHubCommitLogViewer.
>>
>> 1. "model" is the same as Cairngorm's vo (value object)?
>> 2. Is like ServiceLocator mxml required for Crux also?
>> 3. When sending/receiving to/from application server using RemoteObject,
>> how it is coded in Crux?
>> 4. Is there any short introduction to migrate from Cairngorm to Crux?
>>
>> Thanks.
>>
>>
>>
>>
>>
>> On Sat, Oct 12, 2019 at 3:51 PM Greg Dove <greg.d...@gmail.com> wrote:
>>
>>> Fyi I recently ported a Cairngorm app to Royale replacing cairngorm with
>>> Apache Royale Crux (based on Swiz). That part was quite easy. That's
>>> another option to consider.
>>>
>>> On Sat, 12 Oct 2019, 19:38 Alex Harui, <aha...@adobe.com> wrote:
>>>
>>>> It should be possible to emulate Cairngorm similar to how the MXRoyale
>>>> and SparkRoyale components emulate the Flex MX and Spark components.  The
>>>> source code appears to still be on SourceForge
>>>> https://sourceforge.net/projects/cairngorm.adobe/
>>>>
>>>>
>>>>
>>>> I don’t have time to work on emulating Cairngorm right now.  You could
>>>> do it, or hire someone to do it.
>>>>
>>>>
>>>>
>>>> HTH,
>>>>
>>>> -Alex
>>>>
>>>>
>>>>
>>>> *From: *Takeshita Shoichiro <jl03...@gmail.com>
>>>> *Reply-To: *"users@royale.apache.org" <users@royale.apache.org>
>>>> *Date: *Friday, October 11, 2019 at 10:39 PM
>>>> *To: *"users@royale.apache.org" <users@royale.apache.org>
>>>> *Subject: *Cairngorm framework
>>>>
>>>>
>>>>
>>>> Alex, thanks.
>>>>
>>>>
>>>>
>>>> Appreciate to every one to respond to my question in this thread.
>>>>
>>>>
>>>> ------------------------------------------------------------------------------------------------------
>>>>
>>>> Our Flex application uses Cairngorm framework, which means
>>>> Cairngorm.swc is included in lib.
>>>>
>>>> I think it will not work without Flash.  Is there any solution to work
>>>> Flex code that uses Cairngorm with Apache Royale?
>>>>
>>>> Appreciate any advice in advance.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>> --
>> Shoichiro Takeshita
>> 武下 祥一郎
>>
>>
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>  ウイルス
>> フリー。 www.avast.com
>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>> <#m_-648658528344627431_m_1038977350632280350_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>
>

Reply via email to