Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What functionality is the java code responsible for within the GraphEditor in the mxgraph example for javascript?

I am studying the grapheditor example under mxgraph's javascript https://github.com/jgraph/mxgraph/tree/master/javascript/examples/grapheditor

However, I notice there are two parts. There's a javascript/HTML portion in the www folder. And there's a java portion.

I am a bit rusty from my Java, so I cannot be sure what the Java code is responsible for.

Does the Javascript and HTML portion be totally responsible for the UI/UX display of the GraphEditor example?

Meaning to say things like displaying the action menu and drag and drop etc are handled by the javascript and html portion?

So what's the Java code responsible for exactly?

like image 517
Kim Stacks Avatar asked Dec 18 '18 09:12

Kim Stacks


1 Answers

The front-end part is only client-side JavaScript and HTML. The Java back-end is partly historic for older browsers that couldn't do things like open/save locally without echoing the file via a server.

There's also export functionality on the server. A long time ago browsers couldn't generate raster images (like PNG) locally, so the server had to do it. Now IE 11 is the only supported browser that cannot do this.

There's also PDF export, no browser can currently do this, so that's always generated on the server. See https://github.com/jgraph/mxgraph/blob/master/javascript/examples/grapheditor/java/src/com/mxgraph/examples/web/GraphEditor.java

like image 180
Thomas the Tank Engine Avatar answered Nov 14 '22 22:11

Thomas the Tank Engine