public class Launcher
extends java.lang.Object
Controller
object.
To run a headless Freeplane instance use Launcher.create().launchHeadless()
,
to run a freeplane with complete user UI use Launcher.create().launch()
Code Example:
public static void createNewMindMap(File freeplaneInstallationDirectory, final File newMapFile) {
final Launcher launcher = Launcher.createForInstallation(freeplaneInstallationDirectory).disableSecurityManager();
HeadlessMapCreator mapCreator = launcher.launchHeadless();
final Map map = mapCreator.load(TestApp.class.getResource("/templateFile.mm")).unsetMapLocation().getMap();
final Node childNode = map.getRoot().createChild();
String value = "hello world";
childNode.setText(value);
final String nodeText = (String) mapCreator.script("node.to.text", "groovy").executeOn(childNode);
System.out.println("Read node value: " + nodeText);
if(! nodeText.equals(value))
throw new AssertionError("unexpected value returned");
map.saveAs(newMapFile);
System.out.println("Saved file " + newMapFile.getAbsolutePath());
launcher.shutdown();
}
Modifier and Type | Method and Description |
---|---|
static Launcher |
create()
Creates Launcher for starting embedded Freeplane instance.
|
static Launcher |
createForInstallation(java.io.File freeplaneInstallationDirectory)
Creates Launcher for starting embedded Freeplane instance.
|
Launcher |
disableSecurityManager()
Disables security manager for launched Freeplane instance.
|
HeadlessMapCreator |
launchHeadless()
Launchs Freeplane without UI and returns HeadlessMapCreator instance.
|
Controller |
launchWithUI(java.lang.String[] args)
Launchs Freeplane with UI and returns Controller instance.
|
static void |
main(java.lang.String[] args) |
void |
shutdown()
The method should be call on application exit to shutdown embedded Freeplane instance.
|
Launcher |
userDirectory(java.io.File userDirectory)
Sets user configuration directory (without the version).
|
Launcher |
userDirectory(java.lang.String userDirectory)
Sets user configuration directory (without the version).
|
public static void main(java.lang.String[] args)
public static Launcher createForInstallation(java.io.File freeplaneInstallationDirectory)
freeplaneInstallationDirectory
- Path to freeplane installation directory
Only one Launcher per JVM can be created.java.lang.IllegalStateException
- is launcher already was created.public static Launcher create()
java.lang.IllegalStateException
- is launcher already was created.public HeadlessMapCreator launchHeadless()
java.lang.IllegalStateException
- is Freeplane was already launched.public Controller launchWithUI(java.lang.String[] args)
java.lang.IllegalStateException
- is Freeplane was already launched.public void shutdown()
public Launcher disableSecurityManager()
public Launcher userDirectory(java.io.File userDirectory)
public Launcher userDirectory(java.lang.String userDirectory)