leaningtech / cheerpj-applet-runner

CheerpJ Applet Runner - Chrome Extension to Enable Java Applets
http://www.leaningtech.com/cheerpj
57 stars 3 forks source link

Freeplane Mindmap does not finish loading #62

Closed dartrax closed 1 year ago

dartrax commented 1 year ago

I try to use Cheerpj to view Mindmaps generated from Freeplane. Freeplane allows to export as Java Applet. But it never finishes loading.

I've uploaded an example here: https://www.dartrax.de/other/freeplane/mindmap.html

I hope the issue will be found and fixed :-)

alexp-sssup commented 1 year ago

This applet unfortunately triggers multiple bugs and at this stage we are completely focused on a new architecture for CheerpJ (CheerpJ 3.0, see our announcement here: https://leaningtech.com/announcing-cheerpj-3-0-a-jvm-replacement-in-html5-and-webassembly-to-run-java-applications-and-applets-on-modern-browsers/)

CheerpJ 3.0 will structurally solve this sorts of bugs, but in the meantime we can suggest a workaround HTML that should work. Compared to the original HTML there are a few modifications:

  1. Added the mindmap.html_files/ in front of all JAR files, this was a mistake in the original HTML
  2. Removed the redundant ./ from JAR paths, as they confuse the CheerpJ loader
  3. Removed the JNLP reference, which is not properly supported
  4. Integrated CheerpJ directly in the page via <script> tags, you will not need to use the extension
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>Test</title>
        <style type="text/css">
/**/
body { margin-left:0px; margin-right:0px; margin-top:0px; margin-bottom:0px; height:100% }
html { height:100% }
/**/
          </style>
          <script src="https://cjrtnc.leaningtech.com/20230517/loader.js"></script>
          <script>cheerpjInit()</script>
    </head>
    <body>
        <applet code="org.freeplane.main.applet.FreeplaneApplet.class" archive="mindmap.html_files/freeplaneviewer.jar,mindmap.html_files/freeplaneapi_viewer.jar,mindmap.html_files/kitfox-svg-salamander-1.1.1-p1.jar" width="100%" height="100%">
            <param name="browsemode_initial_map" value="./mindmap.html_files/map.mm">
            <param name="selection_method" value="selection_method_direct">
            <param name="codebase_lookup" value="false">
            <script>document.write("<param name='location_href' value='" + window.location.href +"'/>");</script><param name="location_href" value="https://www.dartrax.de/other/freeplane/mindmap.html">
        </applet>
    </body>
</html>

Hope this helps, I will keep this issue open as a test case for the future release of a CheerpJ 3.0 Applet Runner

dartrax commented 1 year ago

Thank you for your fast reply! It's a benefit that the extension is not needed in this case. I've uploaded your HTML to this URL: https://www.dartrax.de/other/freeplane/mindmap2.html

The User interface loads, but the Mindmap ./mindmap.html_files/map2.mm is not loaded.

When I look at the console, there seem to be some .jar.js files generated that contain HTML from the homepage. This doesn't look right, but I don't know if that has something to do with it...

alexp-sssup commented 1 year ago

Are you sure this applet works with native Java? From my tests, both native Java and CheerpJ cannot load the map because some class is missing, in particular: org/freeplane/api/ChildNodesAlignment. This class is not available in any of the 3 JAR files which are used.

dartrax commented 1 year ago

I should have checked that first. I also don't get it to work native so I created a bug report in the freeplane project, let's see what happens.

dartrax commented 1 year ago

The applet works now with native java, i've uploaded it here: https://www.dartrax.de/other/freeplane/map.html However, I did not succeed in modifying map.html in such a way that it works with cheerpj like you've done before, not even the UI loads. You'll find my try here: https://www.dartrax.de/other/freeplane/map_cheerpj.html May be you can have a look at it once again?

alexp-sssup commented 1 year ago

This seem to work for me: image

dartrax commented 1 year ago

Now even with loading the mindmap. Thanks, it must have been a caching problem.

Do you see a possibility to reduce loading time? Probably wait for the new v3.0 I guess? ;-)

alexp-sssup commented 1 year ago

Yes, CheerpJ 3.0 is being engineered from scratch to improve loading time. For CheerpJ 2.x you could get better result by AOT compiling the jar to jar.js files.

Please see instructions here: https://docs.leaningtech.com/cheerpj/Getting-Started

dartrax commented 1 year ago

Great! That reduced loading time from 35s down to 14s! I've just compiled the three jar files to jar.js and added them to the directory with the jar files. It was easy, the documentation is easy to follow!

alexp-sssup commented 1 year ago

Glad to hear the docs were helpful. If you need further help, please consider joining our discord: https://discord.gg/CHeATR6E9k