Last active
February 17, 2017 12:50
-
-
Save plewin/1480ebf6e13def55c4da5cf155eb7351 to your computer and use it in GitHub Desktop.
Minimal code to generate freeplane mm files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.freeplane.features.map.IMapSelection; | |
import org.freeplane.features.map.MapModel; | |
import org.freeplane.features.map.NodeModel; | |
import org.freeplane.features.mode.Controller; | |
import org.freeplane.features.url.mindmapmode.MFileManager; | |
import org.freeplane.main.application.FreeplaneStarter; | |
import org.freeplane.main.headlessmode.FreeplaneHeadlessStarter; | |
import org.freeplane.main.headlessmode.HeadlessMapViewController; | |
import java.io.File; | |
import java.io.IOException; | |
// hack to prevent an unsupported method exception | |
class Stub extends HeadlessMapViewController { | |
@Override | |
public IMapSelection getMapSelection() { | |
return null; | |
} | |
} | |
public class Test { | |
public static void main(String[] args) throws IOException { | |
FreeplaneStarter s = new FreeplaneHeadlessStarter(); | |
Controller e = s.createController(); | |
e.setMapViewManager(new Stub()); | |
s.createModeControllers(e); | |
MFileManager mFileManager = new MFileManager(); | |
MapModel map = new MapModel(); | |
map.setRoot(new NodeModel("hi", map)); | |
// load data from neo4j | |
// create the freeplane model | |
mFileManager.writeToFile(map, new File("...tmp..")); | |
// send the file content as a http response | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment