Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: structuring the implementation of a graceful saving of changes  (Read 6640 times)
creacog
Newbie
*
Posts: 2


View Profile WWW Email
« on: April 22, 2008, 07:16:59 »

can't believe I've allowed myself to get so muddled with something which on the face of it seems so simple, but straight to the point....

Application: Built as AIR, allows creation, editing, opening, saving of a single document to disc i.e. single application/document window.

Use case: Handle saveable changes when user notifies QUIT, NEW or OPEN.

This requires a sequence of operations including one or two async user interactions...
1. Present a Confer Save alert, result : Save, Don't save or cancel
2. If the document has never been saved, present BrowseForSave, result: File object or cancel

On success: Re-issue the original notification
On cancel: Noop

Although a self-contained modal operation, there are view implications. In addition to the presentation of dialogues, we also need to send notifications allowing things like the native menu (MainMenuMeditor) to disable menu options until the operation is complete.

Currently I have a DocumentProxy that contains the file object, hooks to other data proxies and handles the loading/saving of data - including presenting file-browse dialogues. I pondered whether this should be Proxy or Mediator for some time, but settled on Proxy... for now.

Now how to structure the operation. Slightly worried about the potential for proliferation of objects and notifications. After trying to work out how to build Command object supported by an 'operation' proxy to give it state (clearly the wrong thing to do) I found the "Asynchronous command chaining" thread on this forum (http://forums.puremvc.org/index.php?topic=23.0) covering similar issues though relating to services rather than user-interactions.

So it looks like I probably need to construct an operation object based on the spicelib task framework. But where to put that object (and it's tasks)? Current thinking is it should probably be a Mediator - but that thinking changes by the hour. Could be an extended Command? Possibly it may be an object mostly outside PureMVC that communicates directly with it's actors though events, and only notifies pureMVC of SUCCESS or CANCEL. (SUCCESS replaced by the onward notification i.e. QUIT, NEW, OPEN)

Any thoughts, strategies, pointers welcome. Thanks.

paul
--
http://blog.creacog.co.uk


Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: April 22, 2008, 09:45:42 »

Have a look at the StartupManager Utility, this may help.

-=Cliff>
Logged
Pages: [1]
Print