Thanks a lot for your help!

All the solutions proposed by Niels are good, but I’ll stick to solution 2:
my PersonItem update the ModelLocator and use System Controller to dispatch
an event. When result is received, the ModelLocator is updated, and my
ViewPersonInDetailForm will listen for changes. I guess this will work well
for me!

And... yes Marcelo, "sou tuga." ;)

João Saleiro 

________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Marcelo de Moraes Serpa
Sent: sexta-feira, 5 de Maio de 2006 12:36
To: Open Source Flash Mailing List
Subject: Re: [osflash] Best practices using ARP for calling a command
andreturning result to apropriate view

Hello João (it seems you speak portuguese too?)

I agree with Niels on the use of Grant´s SystemController and a ModelLocator
(any ModelLocator implementation, you don´t really need data binding, in
this case it only complicate things.), that´s the best way I found to pass
parameters to commands, also. 


Currently I´m still using viewRef and calling a function on the view to
update it and pulling the data from the view when I need parameters to be
passed to the command. I guess the most elegant solution for me (and
eventually for you) is to use SystemController together with a ModelLocator
to pass parameters to the command and to update the views, I will update my
app in the next version. 

Suggestions from more experienced arp developers on this subject would be
much appreciated!

- Marcelo Serpa.


On 5/5/06, nyls < [EMAIL PROTECTED]> wrote:
Hello,

I think you can solve it in a view ways: 


1. The ChildForm from Peter Hall in the ARP lab. This Form has when
dispatching an event it 'bubbles' up to parent Forms. You could catch it in
the application. And dispatch the 'getPerson' command there, that way your 
view ref is 'linked' to application ..

2. use the ARPX extensions form Grant. He has a 'system event controller'
were views can register to listen for events. When the command is finished
fill a model, dispatch an event through the system controller.. Every view 
which listens for that event can get the data from the model..

3. dispatch the command from the ListPersonForm. Let this command fill a
modellocator and let the detailForm listen for changes on the modellocator. 


I think number 2 is the most easiest to implement + the most elegant
because every thing is there

Success,

Niels

Ps. There is an ARP mailing list :>






-----Oorspronkelijk bericht----- 
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens
[EMAIL PROTECTED]
Verzonden: vrijdag 5 mei 2006 3:32
Aan: [email protected]
Onderwerp: [osflash] Best practices using ARP for calling a command
andreturning result to apropriate view 

Hello!

We are developing a RIA as our final graduation project, using MTASC+ASDT
for
developing, and ARP framework.
At certain point on our application, we have one form (ListPersonsForm) that
uses an AMFPHP service to retrieve a "resumed" list of persons (name, id and

photo). When received, we have a loop that attaches PersonItem (a class
linked
to a MC on the library) instances on the ListPersonsForm, one for each
person,
obviously. At this point, everything is working fine. From here, we have a 
design problem.

When the user presses a PersonItem instance we want to call the getPerson
service which retrieves person's detailed data, and we want to refresh the
ViewPersonInDetailForm with the new data. 

So, we have:

Application
        |-ListPersonsForm
        |       |-instances of PersonItem
        |
        |-ViewPersonInDetailForm

and two commands, getResumedListOfPersons and getPerson(id). 

PersonItem has it's own onPress handler (to allow it to change background
color
when pressed). We also want to dispatch the getPerson event when PersonItem
is
pressed, but that means that we would need to add to the Controller one 
event
listener to each PersonItem instance, which i am sure it is a bad practice.

___1___
So, the first question is: what's the best solution for dispatching
getPerson
from PersonItem instances (or elsewhere) when they are pressed? 

___2___
The second question is: on ARP framework, commands should use the viewRef to
inform the view that the data as arrived. But it's the
ViewPersonInDetailForm
who should receive the data, and, for now (while the above solution isn't 
solved), incorrectly, our "viewRef" is the instance of PersonItem who
dispatched the event, who doesn't need the data and shouldn't be aware of
the
existence of ViewPersonInDetailForm...

Can you help us proposing best practices for the problem(s) above? 


Thanks in advance! :D

João Saleiro


_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org


_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

 

João Saleiro


Email/MSN: [EMAIL PROTECTED]
Skype: joao.saleiro
Tel: +351 916 077 097 / +351 968 203 370
WWW: http://www.webfuel.pt



_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to