Hi Michael,

In your complex value object case, here's what we'd recommend now.

In your command, put the complex object in your model (ModelLocator),
eg.

ModelLocator.getInstance().complextData = theResultFromTheServer;

Now, in your view, you bind to that model item, but call a utility class
to massage the results into the format you want. eg,

<mx:Label text="{ MyUtilityClass.formatDataToSomethingSimpler(
ModelLocator.getInstance().complexData ) }" />

Now, you could possibly call MyUtilityClass a view helper, in the broad
sense of the pattern, but extracting it this way lets you, for example,
unit tests it's functionality and keeps the Model and View separate.

Cheers,

Ali


Alistair McLeod
Practice Director (Rich Internet Applications)
Adobe Consulting
Westpoint, 4 Redheughs Rigg, South Gyle, Edinburgh, EH12 9DQ, UK
p: +44 (0) 131 338 6108
[EMAIL PROTECTED]
http://weblogs.macromedia.com/amcleod



-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: 16 May 2006 13:14
To: flexcoders@yahoogroups.com
Cc: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Are ViewHelper and ViewLocator deprecated in
Cairngorm 2?

I am using the viewLocator and viewHelper in a fds2b3 prototype, and
they function correctly, although  a post from Steve Webster states
that:

"My quick response is that we really don't anticipate you needing to use
ViewHelpers as much (if at all).  Use ModelLocator instead (that's why I
left it out the article series"

However, I think I understand when you say that:

"It seems that the command class has no idea where the view is."

Thus I use the command class to set the variable, and that is all.  If I
have a complex value object that I need to iterate through to get single
value to be displayed in a view (although I know that there might be
arguments for doing all this on the java layer, however ...), I would
rather call a viewHelper to handle this (one that is linked
intrinsically with a view) rather than fill the command class with
business logic.

So ... this is probably a long winded way to say that, 'yes' the
viewHelper and viewLocator work fine  in fds2b3.










             "Larry Liang"                     To:
flexcoders@yahoogroups.com                                   
             <[EMAIL PROTECTED]>            cc:

             Sent by:                          Subject:  [flexcoders]
Are ViewHelper and ViewLocator deprecated 
             flexcoders@yahoogroups.com          in Cairngorm 2?

             05/15/2006 07:52 AM

             Please respond to

             flexcoders









Hi all,

I just donwloaded the latest cairngorm framework for fb2 beta 3. I found
that the viewhelper and viewlocator are still included in the package. I
remeber (please correct me if I'm wrong) that these two classes are
deprecated for flex 2.

If this is the case, then suppose a command class needs to update a
view, should it only do that throuhg ModelLocator class. It seems that
the command class has no idea where the view is. For example, if a
command class need to set a label on a view to say "downloading..."
before start a webservice call and after the rpc call comes back, the
command class sets the label text to be empty. How should the command
class handle this situation if it does not know where the view is.

The only way that I can think of is to have a string variable in
ModelLocator class which is bound to the label text property. and then
command class can update the label text through this string variable.
I'm sure there is a better (best practice) way to update a view in a
command class. Please give me some hints.

Thanks
Larry







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links











------------------------------------------------------------------------
---
This e-mail message (including attachments, if any) is intended for the
use of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt
from disclosure.  If you are not the intended recipient, you are
notified that any dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error, please notify the sender and erase this e-mail
message immediately.
------------------------------------------------------------------------
---



------------------------ Yahoo! Groups Sponsor --------------------~-->
Get to your groups with one click. Know instantly when new email arrives
http://us.click.yahoo.com/.7bhrC/MGxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links









--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to