Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic UndoManager (Read 6022 times)
FreizeitDuscher
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Aug 26th, 2010
UndoManager
Sep 28th, 2010 at 11:51am
Print Post  
Hi,
i'am searching for a possibility to write the actual state
of the whole diagram to the UndoManager.

i've write a "sort" function, that moves many shapes.
it seems like the startComposite function does not track all steps.

is there an other function?

thanks!
olli
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager
Reply #1 - Sep 28th, 2010 at 4:45pm
Print Post  
Hi,

Only a few operations are saved automatically for undo, such as adding or removing items, and changing items positions interactively. If you need to save a batch of item positions changes done from code, this should work:

Code
Select All
CompositeCmd composite = new CompositeCmd(diagram, "Sort shapes");
for (DiagramItem item: diagram.getItems())
	composite.addSubCmd(new ModifyItemCmd(item));
composite.execute(); 



If some other property changes must be saved too, use ChangeItemCmd instead of ModifyItemCmd.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
FreizeitDuscher
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Aug 26th, 2010
Re: UndoManager
Reply #2 - Dec 11th, 2010 at 2:30pm
Print Post  
hi =)

that seems to work!

i've got two other questions now.

first, is there an option to disable the automatic captured undo records but have the possibillity to write in die history those "snapshots"^^.

second, in this sort algorithm i move a few shapes, if i move them while iam sorting, so that the user see a preview of the diagram after sorting, the diagram seems not do repaint correctly. only if the moving shapes contains other shapes that are linked, then it works very fine .. you've got n idea?

thank you! =)
olli
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager
Reply #3 - Dec 13th, 2010 at 8:55am
Print Post  
Hi,

1. You could implement Diagram.Listener.actionRecording and filter out all commands except the composite ones.

2. Try calling diagram.repaint() after all moving and sorting is done.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
FreizeitDuscher
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Aug 26th, 2010
Re: UndoManager
Reply #4 - Dec 13th, 2010 at 2:30pm
Print Post  
hi Stoyo,

1. thank you, that should work for me.
2. i've allready tried this, that doesnt work, it looks like there is a differnce between moving shapes, and moving shapes that are linked?

thank you,
olli

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager
Reply #5 - Dec 13th, 2010 at 4:07pm
Print Post  
Hi, Are you setting nodes positions while other nodes are being modified - e.g. from the nodeModifying handler?
  
Back to top
 
IP Logged
 
FreizeitDuscher
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Aug 26th, 2010
Re: UndoManager
Reply #6 - Dec 13th, 2010 at 4:10pm
Print Post  
yes, the function is called from the nodeModifying handler.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: UndoManager
Reply #7 - Dec 13th, 2010 at 7:05pm
Print Post  
Try also calling DiagramView.recreateCacheImage().

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
FreizeitDuscher
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 7
Joined: Aug 26th, 2010
Re: UndoManager
Reply #8 - Dec 13th, 2010 at 8:02pm
Print Post  
thats it, thank you! Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint