- Welcome, Guest. Please Login or Register
MindFusion  
  Version 2 of our Xamarin Calendar component adds Resource view and support for Universal Windows Platform. Now beta testing spreadsheet component for Java Swing. We have released our Java Swing Pack.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating
Read 400 times

AR   Offline
Junior Member
**
Posts: 58
I Love MindFusion!


   
     
 
Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating
Apr 5th, 2017 at 6:35pm
 
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.
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1100
Gender: male
tech.support


   
     
 
Re: Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating
Reply #1 - Apr 5th, 2017 at 7:11pm
 
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.
 
 
 
IP Logged    
 
     

AR   Offline
Junior Member
**
Posts: 58
I Love MindFusion!


   
     
 
Re: Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating
Reply #2 - Apr 7th, 2017 at 2:10pm
 
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)
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1100
Gender: male
tech.support


   
     
 
Re: Is it possible to call Diagram.saveToXml(Document) without the displayed Diagram updating
Reply #3 - Apr 10th, 2017 at 1:59pm
 
You can find a pre-release build here -
http://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
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print