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

Reply via email to