|
Re: where to place logic for deciding when to disable a
button using Cairngorm Architecture
I'd not use ViewHelpers here; what I'd consider is holding
a State object in your ModelLocator. Essentially, you only want a button
to be displayed once the application has reached a particular (valid)
state. So bind the enabled property of the button to a State flag that has
semantic meaning.
For example, in your model locator you might have a State
object with lots of booleans (indicating application states) such as
State.customerEditMode. If you only want your button enabled when the user
is in customer-edit mode, then bind the enabled property to
State.customerEditMode.
This will really help the readability and understandability
of your code as well, eg:
<mx:Button text="Paste"
enabled="{State.selectionOnClipboard}" />
tells me much more about that Button than burying the logic
for when the Paste button is enabled into a ViewHelper.
Your coding challenge is then to toggle State
appropriately; quite likely your state transitions will occur in the onResult()
methods of your various commands, eg:
class
com.iterationtwo.demo.commands.CopyToClipboardCommand
{
...
public function onResult( event:Event
):Void
{
// copy service has successfully copied
something to a server-side persistence tier
// now the user
can paste that data somewhere else.
ModelLocator.selectionOnClipboard =
true;
}
}
Convoluted example, but makes the point I
think....Does that help ?
Best,
Steven
--
Steven Webster
Technical Director iteration::two
[EMAIL PROTECTED] Office: +44 (0)131 338
6108
Mobile: +44 (0)7977 216 223 This 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. From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jesus Salvador Ramos Cardona Sent: 10 August 2005 05:39 To: [email protected] Subject: RE: [flexcoders] About synchronizing grid rendering with service completion Thanks for your
reply. Our problem, however,
is that the screen is ready and rendered before the remote object completes its
call. We already show the
busy cursor for the remote object, but this is not preventing the view from
rendering completely before the remote call returns from the
server. We use the
“onCreationComplete()” function of our mxml file to call the
EventBroadcaster. The mxml file is already rendered when the service called by
the EventBroadcaster returns the data. The problem we have is that we need to
disable certain controls of the view based on this returned data (An array
rendered in a data Grid). Is there any way to
know when a service (In our case a remote object) has finished returning the
data (A function, actionscript, etc.). The system is based in
Cairngorm, and the onResult method of the MyCommand.as is something like
this: public function
onResult( event : Object ) : Void {
mx.core.Application.application.detallesBLData =
event.result; } Our validation requires
the data in
mx.core.Application.application.detallesBLData Hope this is more
explanatory of our problem. Best
regards. J. De:
[email protected] [mailto:[EMAIL PROTECTED] En nombre de Rob Rusher You could use a
ViewHelper for that view. You could also set the showBusyCursor on the
RemoteObject to prevent the user for clicking anything until the screen is
ready. Regards, Rob
Rusher RIA
Consultant Macromedia Certified Flex
Instructor e: -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|
- RE: [flexcoders] About synchronizing grid rendering with se... Steven Webster
- RE: [flexcoders] About synchronizing grid rendering wi... Steven Webster

