Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating (Read 4818 times)
AR
Junior Member
**
Offline


I Love MindFusion!

Posts: 65
Joined: Jan 23rd, 2015
Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating
Apr 5th, 2017 at 5:35pm
Print Post  
In our system users can make changes to the diagram at will - adding nodes and links and moving both within the diagram.

We automatically save the diagram, in the background, after each change, then reload the saved diagram (so we get ids for nodes etc. to use when adding links)

However, if a large background image (4.5 megabytes) is used for the diagram this save takes some time and the user can make changes whilst the save is taking place which then 'disappear' when the diagram is reloaded.

A possible solution would appear to be to remove the background image from the diagram before saving it, then put it back after the save. However, this causes the diagram to be displayed with a blank background for a significant period of time. From stepping through my code it seems to be the call to Diagram.saveToXml(document) which causes the 'backgroundless' diagram to be displayed.

Is there anyway of stopping this happening?

Or can you think of an alternative method which would allow saving all changes in the background, but would not 'loose' any changes made by the user during the time taken for the save.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating
Reply #1 - Apr 5th, 2017 at 6:11pm
Print Post  
There are suspendRepaint and resumeRepaint methods in DiagramView. Saving and loading after each change just to get integer identifiers is an overkill. If you have the code, make Diagram.updateRuntimeIndices public and call it when you need the numbers - they will be accessible via DiagramItem.getRuntimeIndex(). We'll make that public in official release soon. Also note that the identifiers used in XML are not permanent for items, they could change between different saves, e.g. if you delete an item.
  
Back to top
 
IP Logged
 
AR
Junior Member
**
Offline


I Love MindFusion!

Posts: 65
Joined: Jan 23rd, 2015
Re: Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating
Reply #2 - Apr 7th, 2017 at 1:10pm
Print Post  
Could you let me know when you make the official release with Diagram.updateRuntimeIndices() as a public method please.

(We're only using these values very short term, not assuming they remain the same long term)
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating
Reply #3 - Apr 10th, 2017 at 12:59pm
Print Post  
You can find a pre-release build here -
https://mindfusion.eu/_beta/jdiag_rtidx.zip

Official release should be available in a couple of weeks. There are some API changes: Pen, Brush and derived classes are now in the com.mindfusion.drawing package.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint