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 [2]
Print
Author Topic: Implementing Undoable commands in PureMVC  (Read 20578 times)
richardleggett
Newbie
*
Posts: 5


View Profile WWW Email
« Reply #15 on: January 13, 2009, 07:53:23 »

Thanks Dracos I think I'll give that a try now, I don't see why that wouldn't work for me, and you're right, I had essentially the same code in the undo command.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #16 on: January 14, 2009, 06:40:43 »

Richard,

Could you send me the multicore version of the classes? I'll get it into the repo and rev the util to production.

-=Cliff>
Logged
anegri
Newbie
*
Posts: 8


View Profile WWW Email
« Reply #17 on: July 13, 2011, 09:11:45 »

I can't find the implementation of this and I am trying to write the functionality for a Java application, is there a demo of this posted yet?

Thanks!
-Alessandro
Logged
ddragosd
Courseware Beta
Jr. Member
***
Posts: 10


View Profile Email
« Reply #18 on: July 13, 2011, 10:36:49 »

Hi, you can find a demo here:
http://trac.puremvc.org/Demo_AS3_Flex_HistoryPanel

Hope it helps,
Dragos
Logged
anegri
Newbie
*
Posts: 8


View Profile WWW Email
« Reply #19 on: July 13, 2011, 03:14:05 »

Hi Draggos,

This helped quite a bit, I am almost done re-writing the undo utility and was a bit confussed on the following lines on the UndoableMacroCommandBase:

:
      Class commandClassRef = subCommands.get(i);
      ICommand commandInstance = new CommandClassRef();

and in the UndoableCommandBase:

:
      ICommand cmdInstance = new undoCmdClass();

What are these lines trying to do?  I don't find an undoCmdClass in the project... is it to create an instance of the specified command class?

Thanks!
-Alessandro
Logged
anegri
Newbie
*
Posts: 8


View Profile WWW Email
« Reply #20 on: July 13, 2011, 04:22:30 »

I have another questions too, looking at the sample application I noticed that the listeners were handled in the mediator... are they supposed to be in the view?  I am having a hard time re-designing an application I created with the PureMVC and implemented things very poorly... please don't take it in a bad way, this is very very... VERY helpful set of an example and utility!

Thanks!

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



View Profile WWW Email
« Reply #21 on: July 14, 2011, 09:59:15 »

Yes, the event listeners are in the correct place.

In order for the Mediator to mediate communications between the view component and the rest of the system, it needs to do two things:

1) Listen to the component for events that the rest of the system is interested in

and

2) Be interested in notifications that affect its view component.

This keeps the component from needing to know anything about the system it is a part of and the system from needing to know details about the view component. This is one of the ways PureMVC achieves the desired loose-coupling that allows the component to be easily reimplemented (and limit the refactoring impact to the Mediator). The component will be more reusable this way as well; you could put it into some other app without needing to drag PureMVC along with it. By the same token, it is easy to adapt foreign view components to your system by introducing a Mediator for it.

-=Cliff>
Logged
anegri
Newbie
*
Posts: 8


View Profile WWW Email
« Reply #22 on: September 15, 2011, 09:56:24 »

I ported the Undoable code to Java, where should I post it so that others can use it?  I am currently using it on two different projects and it seems to work pretty well (then again I just ported solid code).
« Last Edit: September 15, 2011, 10:28:51 by anegri » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #23 on: September 16, 2011, 07:21:24 »

Super! Send me a zipped copy of the project. (If you're on MacOS, please remove the .DS_Store and ._MacOSX files.)

-=Cliff>
Logged
anegri
Newbie
*
Posts: 8


View Profile WWW Email
« Reply #24 on: September 27, 2011, 11:24:36 »

I have the project zipped along with the version of PureMVC used.  Let me know if any more changes need to be done or if any issue comes up with it! 

Edit: This works for version 0.3 of the PureMVC, an updated version for version 1.0 of the PureMVC can be found below!

-Alessandro
« Last Edit: September 29, 2011, 11:36:33 by anegri » Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #25 on: September 28, 2011, 08:41:09 »

Is this working with the most recent version of the Java Standard port?

-=Cliff>
Logged
anegri
Newbie
*
Posts: 8


View Profile WWW Email
« Reply #26 on: September 28, 2011, 09:27:33 »

Yes it does, it was originally with version 0.3, but no API changes affect using version 1.0.  I can do a build with the current version.

-Alessandro
Logged
anegri
Newbie
*
Posts: 8


View Profile WWW Email
« Reply #27 on: September 29, 2011, 10:19:11 »

Actually the undo only works for the last action... I think it has to do with the changes on version 1.0 from version 0.3 where the Facade registers instances of the commands as opposed to having a class reference as in version 0.3.  I am working on fixing the issue, I might close then commands when saving them in the history.

How come that change was done to version 1.0?  I think the AS3 flavor uses class reference, doesn't it?
Logged
anegri
Newbie
*
Posts: 8


View Profile WWW Email
« Reply #28 on: September 29, 2011, 11:34:35 »

I just finished testing and all the changes are working well.  So the new version now is 1.2 for the Java port of the UndoPureMVC and is compatible with the version 1.0 of the PureMVC Standard Java version.  I updated my work projects to use the 1.0 version of the PureMVC as well, that way I could test properly the changes on the undo utility.

If there are any issues let me know and I will take care of them!

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



View Profile WWW Email
« Reply #29 on: September 30, 2011, 07:31:43 »

I will put this in the queue for adding to the site. In the interim, if anyone has feedback about the code leave it here.

Thanks, Alessandro!
Logged
Pages: 1 [2]
Print