Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Show Java Loading manually (Read 2310 times)
jagdipa
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 52
Joined: Jun 23rd, 2011
Show Java Loading manually
Sep 6th, 2011 at 1:57pm
Print Post  
Sometimes I have to load a large amount of data into the Java applet. For example, I am creating 400 notes to load back a flowchart. This is taking over 20 seconds.

What I would like to do is display the Java loading message during this period. Is this possible? If not, then I will create a custom loading message. It would just be nicer to have the java one.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Show Java Loading manually
Reply #1 - Sep 6th, 2011 at 2:25pm
Print Post  
I don't think there's any way to do that. Perhaps it's better to decrease the loading time anyway Smiley Are you creating items on the server and it takes 20 seconds to transfer them to the browser?
  
Back to top
 
IP Logged
 
jagdipa
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 52
Joined: Jun 23rd, 2011
Re: Show Java Loading manually
Reply #2 - Sep 6th, 2011 at 4:00pm
Print Post  
Sort answer - I am creating them on the client side ..... its complicated !

Long answer - I am loading a dataset into JSON. Then I am using javascript to loop through the JSON and create the items on the client.

The reason for this is that I have a list of all the nodes below the flowchart. The list has extra columns that the user can edit, such as 'year', 'type' etc. The user can modify the values, and I keep the JSON uptodate accordingly.

The JSON is passed back to the server for saving.

In the mean time, I have just created a node stating 'Please wait. Loading'. I delete this node once the loading is completed. I dont expect the user to have so many nodes, but its worth testing. I am always put a restriction on the number of nodes.

Infact, once this is finished, I would love to show you the end product. I can provide a link and hopefully get your thoughts.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Show Java Loading manually
Reply #3 - Sep 6th, 2011 at 5:30pm
Print Post  
Ok, perhaps you could add the nodes in several stages so that the user can see something immediately, as long as you know the nodes' positions from the beginning. E.g. when all data is loaded, sort the records by how far nodes are from the origin of the diagram, and add the first several nodes to fill the visible part of the applet. Then you can run a JavaScript timer that adds the rest of the nodes in chunks of say 25 or 50. Since they are sorted, the next nodes will probably be already created if the user scrolls down.

To avoid using much JavaScript to Java interop, which is not very fast, make sure you are initializing items properties through their defaults in the Diagram, instead of calling setters on individual objects after creation. E.g. set Diagram.ShapeBrush once instead of calling node.setBrush for each node.

Also if you are running some layout algorithm, you might try using its faster variants. E.g. LayeredLayout is faster when EnforceLinkFlow is enabled, and OrthogonalLayout is much faster if you set MinimizeLinkBends to false.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint