Dienstag, 9. November 2010

Confluence: Freemind mindmaps embedded in pages

If you want to embed freemind (*.mm) mindmaps into your confluence page (which is not possible by default) just follow these steps and you're ready to go.


mindmap macro setup
  1. Get the Freemind browser applet from here Freemind at Sourceforge
  2. Create a page in your confluence that can be access by an anonymous user and attach the freemindbrowser.jar to it.
  3. Login as Confluence Administrator and create a new user macro
  4. Put the following code into the template textbox:

#set($width= $param1)
#if (!$width)
  #set ($width=600)
#end
#set($height= $param2)
#if (!$height)
  #set ($height=450)
#end
#set($attachmentUrl="$action.getGlobalSettings().getBaseUrl()$content.getAttachmentNamed($param0).getDownloadPathWithoutEncoding()")
<applet code="freemind.main.FreeMindApplet.class" 
    archive="http://your.company.confluence.server/download/attachments/2687383/freemindbrowser.jar"       width="$width" height="$height">
    <param name="type" value="application/x-java-applet;version=1.4">
    <param name="scriptable" value="false">
    <param name="modes" value="freemind.modes.browsemode.BrowseMode">
    <param name="browsemode_initial_map"
         value="$attachmentUrl">
    <param name="initial_mode" value="Browse">
    <param name="selection_method" value="selection_method_direct">
</applet>
Just replace http://your.company.confluence.server/download/attachments/2687383/freemindbrowser.jar with the url of the attached freemindbrowser.jar

Now you can use the macro with the following syntax to embed freemind mindmaps:
{mindmap:<attachment_filename>[|<width>[|<height>]]}

Example:
{mindmap:my_mindmap.mm|650|500}


Enjoy it! :-)

10 Kommentare:

  1. Stefan - thanks a lot for your effort. After having spend a long time searching for a "mind mapping solution" for Confluence, you made my day! Very much appreciated!! :-)

    And for everyone looking for some mind mapping data (.mm) to get a demonstration page running: check out [WikiMindMap.org|http://wikimindmap.org/].

    Best regards,
    Andreas

    AntwortenLöschen
  2. I really want to use this, but I'm getting the following error when I try to use the macro:

    Firefox can't find the server at docs.saxotech.com$content.getattachmentnamed($param0).getdownloadpathwithoutencoding().

    Any idea why this might be happening?

    AntwortenLöschen
  3. @Eliane
    It seems that your Confluence doesn't resolve the $content variable to the page entity object.

    Which Confluence version are you using?
    I developed the macro with Confluence 3.3 but it should work with 3.4.x too.

    AntwortenLöschen
  4. Hi,

    thanks for your little tutorial. It's a nice idea, but it doesn't work for me :( The generated html code looks fine, but freemind exits with an IOException.

    11.07.2011 18:43:15 freemind.controller.Controller obtainFocusForSelected
    INFO: No view present. No focus!
    freemind.main.XMLParseException: XML Parse Exception during parsing of a html element at line 1: Expected: /
    11.07.2011 18:43:15 freemind.main.Resources logException
    SEVERE: An exception occured:
    java.io.IOException
    at freemind.modes.browsemode.BrowseMapModel.load(BrowseMapModel.java:117)
    at freemind.modes.ControllerAdapter.load(ControllerAdapter.java:346)
    at freemind.modes.browsemode.BrowseController.load(BrowseController.java:246)
    at freemind.main.FreeMindApplet.init(FreeMindApplet.java:298)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    View is null.

    I suspect that it cannot access the mindmap, since it is an attachment to a page, which is not public. Since freemind does not know about my user credentials and starts a new session, it cannot download the mindmap.

    Do you have an idea to work around that?

    Thanks,
    Andreas

    AntwortenLöschen
  5. Hi Andreas,
    this error looks more like a corrupted or invalid freemind map. We have a confluence running with no public spaces and everything just runs fine.

    Maybe you used an freemind export from another mindmapping program which is not fully conform to the freemind file type. If this is the case try to open it with freemind and save it again.

    Another common problem is that this macro only works with Confluence 3.3 or greater.

    Regards
    Stefan

    AntwortenLöschen
  6. Hi Stefan,

    the mindmap is the original freemind.mm that comes with freemind, and I hope that it is in a valid format :) Confluence is 3.0, so no problems to expect there as well. Have you tried the macro with a page that is not anonymously accessable?

    Andreas

    AntwortenLöschen
  7. I so want to use this! I'm getting the following error when I try it with confluence 4.0m29 (I know it's beta.. I couldn't resist)

    load: class freemind.main.FreeMindApplet.class not found.
    java.lang.ClassNotFoundException: freemind.main.FreeMindApplet.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.ClassNotFoundException: freemind.main.FreeMindApplet.class

    AntwortenLöschen
    Antworten
    1. I had the same issue as Michael above - but using the jar from "export as java applet" resolved this issue.

      However the map is still not rendering...

      Löschen
  8. I was excited to find this as many others have indicated, but I am having problems getting it to load. I am getting a class not found error. Opening the Java console, it shows:

    INFO: Initializing mode Browse
    Jan 25, 2013 3:44:48 PM freemind.modes.ModesCreator getMode
    INFO: Done: Initializing mode Browse
    Jan 25, 2013 3:44:48 PM freemind.controller.Controller obtainFocusForSelected
    INFO: No view present. No focus!
    Jan 25, 2013 3:44:48 PM freemind.modes.common.listeners.MindMapMouseWheelEventHandler
    INFO: Setting SCROLL_SKIPS to 80
    Jan 25, 2013 3:44:48 PM freemind.controller.Controller obtainFocusForSelected
    INFO: Requesting Focus for tickets, freemind.view.mindmapview.NodeView[,0,0,0x0,invalid,layout=freemind.view.mindmapview.VerticalRootNodeViewLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=]
    Java Plug-in 10.4.1.255
    Using JRE version 1.7.0_11-b21 Java HotSpot(TM) Client VM
    User home directory = C:\Users\...

    I am using Confluence 4.1.4 and had to create @params to get the user macro to load. It looks good from a Confluence implementation POV and it is opening the Jar, I am thinking it might be an issue with Java but cannot be sure. I've unpacked the jar and can find the freemind.view.mindmapview.NodeView class, but don't know where to go from there.

    Any ideas would be appreciated.

    Thanks,
    Larry

    AntwortenLöschen
  9. Hi. very pleased to see the explanation. waiting for other interesting posts at a time when that will come.
    From bvba Woodstone

    AntwortenLöschen