:)
Obliged,
Dave
On 6/3/05, dave buhler <[EMAIL PROTECTED]> wrote:
Hi Steven,
That is absolutely what I was looking for! Wonderful!
However, you might get away with not using the view helper here at all ... I don't know in what context youare using this object called manager, but if it's important client-side state, then you might want to considerkeeping it on the ModelLocator, so that in your model locator, you define "lineManager" as an instance ofManagerVO.
For my purposes, I have a view called Managers.mxml with a datagrid of managers. When a manager is selected, I retrieve his information and populate a form with it on ManagersProfile.mxml. What does need to manage state is the ID since I will use it for get, save, update, delete (time to learn DAOs :) ). Right now, I pass the ID back, switch views, then store the ID again when the data is returned. Would I store just the manager's ID in the ModelLocator?
I am also confused about the best way to update a VO. Let's say I populate my VO with a viewHelper after Gary retrieves his profile. Gary updates his firstName in the tiFirstName Text Input. How should I update the VO for its firstName value? Should I do it with a change event from the TextField?
I had some issues with this last week, and after reading your PDF on databinding, I'm pretty sure I was missing the changeEvent handler. Do I have to use a changeEvent handler with databinding if I am using the MXDatabinding with the source and destination tags?
Thanks!
Dave
On 6/3/05, Steven Webster <[EMAIL PROTECTED] > wrote:Hi Dave,
I have a question about best practices and methodologies dealing with the ValueObjects.
Let me have a stab at this...
- Should I set the ValueObject by calling it from the onResult handler. Is there a more direct way to set and populate values in both the form AND the VO? Right now, I'm calling the Helper and I somehow think I'm missing something with the VO....
- Should I include the MX Databinding (do i have to?) and if so, should I include it in the VO class or as part of the viewHelper class?
- Should I set and get individual fields (firstname, lastname, email) or should I use one big function that acts as a setter and getter for a whole form to populate the VO?
- Is it better to set the VOs inline (ex: text={delegate.setFirstName (vo.firstname)} or should I call a function that gets and sets the values?
I'm not quite sure I understand your question here, but let's see where we go with this. In your result handler, onResult,the result should *already be* a value object. If your command execute() method is calling a business delegate class,that business delegate should be returning value object(s). If your business delegate is calling through to a server, thenon the other side of the wire, your server-side service should be returning value objects. You do all the Object.registerClass()magic, and those server-side VOs should be typed by the Remoting gateway and "appear" in your onResult handler astyped ActionScript value objects.In your onResult method, I'd like to see you do something like:var lineManager : ManagerVO = ManagerVO( event.result );viewHelper.setManagerForm( lineManager );I'd then like to see your View Helper not accepting loosely typed objects, but strongly typed value objects,eg:public function setManagerForm( manager : ManagerVO ){view.tiFirstName.text = manager.FIRSTNAME;// etc}However, you might get away with not using the view helper here at all ... I don't know in what context youare using this object called manager, but if it's important client-side state, then you might want to considerkeeping it on the ModelLocator, so that in your model locator, you define "lineManager" as an instance ofManagerVO.Then, in your result handler, rather than call the view helper to populate the form, your onResult methodwould update the "lineManager" instance on your ModelLocator, ie replace the call to viewHelper.setManagerForm()with:ModelLocator.lineManager = ManagerVO( event.result );In this way, you can then just use data-binding to bind your form to the ModelLocator.lineManager attributes,and if you have multiple views all rendering the same model, you don't have to do any additional work.I'm not sure if I'm answering your question, but perhaps the discussion above will give you some clarityin your own thoughts ?Does this help ?Best,Steven--Steven Webster
Technical Directoriteration::twoThis e-mail and any associated attachments transmitted with it may contain confidential information and must not be copied, or disclosed, or used by anyone other than the intended recipient(s). If you are not the intended recipient(s) please destroy this e-mail, and any copies of it, immediately.
Please also note that while software systems have been used to try to ensure that this e-mail has been swept for viruses, iteration::two do not accept responsibility for any damage or loss caused in respect of any viruses transmitted by the e-mail. Please ensure your own checks are carried out before any attachments are opened.
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

