PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: maddec on January 18, 2008, 02:32:08

Title: mx.controls.Alert usage, PureMVC Best Practice Suggestion?
Post by: maddec on January 18, 2008, 02:32:08
Hi there,

I wonder if they are best practice suggestion regarding how to organize the use of mx.controls.Alert.

I wonder if gathering alert logic inside a Mediator is a good approach.

I mean having an AlertMediator which may be interested in every notifications related to alerts. Then modifing the Alert type depending to the context.
The question which remains open is how callbacks are used ( for example for confirmation Alerts (YES|NO) ).
Thank you for your interest.

Best regards.

Cedric M. (aka maddec)

visual & interactive communication

Title: Re: mx.controls.Alert usage, PureMVC Best Practice Suggestion?
Post by: nilsm on January 25, 2008, 05:37:41
Hi Cedric,

I just started writing a reply but it got more and more complex, so I guess the answer is "It depends on the requirements" :)

I think for the usage you are describing, you could use a value object as the Notification body, that includes an error code, the error description and the notifications to send on 'ok' and 'cancel'. You have to be careful though because you don't want to include any view information in there - so the type of alert to show should be determined in the Mediator (and the error descriptions should probably come from another Proxy).

In a simpler case, where no command/proxy interaction is required, you could just handle the entire process inside a single Mediator - after a particular user gesture, the Mediator pops up the Alert and only sends a Notification if 'ok' was clicked for example.

Getting long again - I'd better stop here :)

- Nils.