Package org.freeplane.api
Interface ControllerRO
-
- All Known Subinterfaces:
Controller,Proxy.Controller,Proxy.ControllerRO
public interface ControllerROAccess to global state: in scripts, this is available as global variablec- read-only.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidexport(Map map, java.io.File destinationFile, java.lang.String exportTypeDescription, boolean overwriteExisting)exports map to destination file, example:java.util.List<? extends Node>find(boolean withAncestors, boolean withDescendants, NodeCondition condition)Starting from this node, recursively searches for nodes for whichcondition.check(node)returns true and adds their ancestor or descendant nodes if required.java.util.List<? extends Node>find(NodeCondition condition)Starting from the root node, recursively searches for nodes (in breadth-first sequence) for whichclosure.call(node)returns true.java.util.List<? extends Node>findAll()Returns all nodes of the map in breadth-first order, that is, for the following map,java.util.List<? extends Node>findAllDepthFirst()Returns all nodes of the map in depth-first order, that is, for the following map,java.util.List<java.lang.String>getExportTypeDescriptions()returns a list of export type descriptions that can be used to specify a specific export type inexport(Map, File, String, boolean).FreeplaneVersiongetFreeplaneVersion()returns Freeplane version.NodegetSelected()if multiple nodes are selected returns one (arbitrarily chosen) selected node or the selected node for a single node selection.java.util.List<? extends Node>getSelecteds()A read-only list of selected nodes.java.util.List<? extends Node>getSortedSelection(boolean differentSubtrees)returnsList<? extends Node>sorted by the node's vertical position.java.io.FilegetUserDirectory()returns the directory where user settings, logfiles, templates etc.floatgetZoom()returns the current zoom factor.booleanisInteractive()returns false if the system 'nonInteractive' is set.
-
-
-
Method Detail
-
getSelected
Node getSelected()
if multiple nodes are selected returns one (arbitrarily chosen) selected node or the selected node for a single node selection.
-
getSelecteds
java.util.List<? extends Node> getSelecteds()
A read-only list of selected nodes. That is you cannot select a node by adding it to the returned list.
-
getSortedSelection
java.util.List<? extends Node> getSortedSelection(boolean differentSubtrees)
returnsList<? extends Node>sorted by the node's vertical position.- Parameters:
differentSubtrees- if true children/grandchildren/grandgrandchildren/... nodes of selected parent nodes are excluded from the result.
-
getFreeplaneVersion
FreeplaneVersion getFreeplaneVersion()
returns Freeplane version. Use it like this:def required = FreeplaneVersion.getVersion("1.1.2"); if (c.freeplaneVersion < required) UITools.errorMessage("Freeplane version " + c.freeplaneVersion + " not supported - update to at least " + required);
-
getUserDirectory
java.io.File getUserDirectory()
returns the directory where user settings, logfiles, templates etc. are stored.- Since:
- 1.2
-
find
java.util.List<? extends Node> find(NodeCondition condition)
Starting from the root node, recursively searches for nodes (in breadth-first sequence) for whichclosure.call(node)returns true.A find method that uses a lambda ("block") for simple custom searches. As this closure will be called with a node as an argument (to be referenced by
it) the search can evaluate every node property, like attributes, icons, node text or notes.Examples:
def nodesWithNotes = c.find{ it.noteText != null } def matchingNodes = c.find{ it.text.matches(".*\\d.*") } def texts = matchingNodes.collect{ it.text } print "node texts containing numbers:\n " + texts.join("\n ")SeeNodeRO.find(NodeCondition)for searches on subtrees.- Parameters:
condition- a lambda that returns a boolean value. The closure will receive a NodeModel as an argument which can be tested for a match.- Returns:
- all nodes for which
closure.call(NodeModel)returns true.
-
find
java.util.List<? extends Node> find(boolean withAncestors, boolean withDescendants, NodeCondition condition)
Starting from this node, recursively searches for nodes for whichcondition.check(node)returns true and adds their ancestor or descendant nodes if required.- Since:
- 1.7.4
See
find(NodeCondition)for details.
-
findAll
java.util.List<? extends Node> findAll()
Returns all nodes of the map in breadth-first order, that is, for the following map,1 1.1 1.1.1 1.1.2 1.2 2[1, 1.1, 1.1.1, 1.1.2, 1.2, 2] is returned. SeeNodeRO.find(NodeCondition)for searches on subtrees.- Since:
- 1.2
- See Also:
findAllDepthFirst()
-
findAllDepthFirst
java.util.List<? extends Node> findAllDepthFirst()
Returns all nodes of the map in depth-first order, that is, for the following map,1 1.1 1.1.1 1.1.2 1.2 2[1.1.1, 1.1.2, 1.1, 1.2, 1, 2] is returned. SeeNodeRO.findAllDepthFirst()for subtrees.- Since:
- 1.2
-
getZoom
float getZoom()
returns the current zoom factor. A value of 1 means 100%.- Since:
- 1.2
-
isInteractive
boolean isInteractive()
returns false if the system 'nonInteractive' is set. This can be used in actions to not open dialogs etc.- Since:
- 1.2
-
getExportTypeDescriptions
java.util.List<java.lang.String> getExportTypeDescriptions()
returns a list of export type descriptions that can be used to specify a specific export type inexport(Map, File, String, boolean). These descriptions are internationalized.- Since:
- 1.3.5
-
export
void export(Map map, java.io.File destinationFile, java.lang.String exportTypeDescription, boolean overwriteExisting)
exports map to destination file, example:println c.exportTypeDescriptions.join('\n') boolean overwriteExistingFile = true c.export(node.map, new File('/tmp/t.png'), 'Portable Network Graphic (PNG) (.png)', overwriteExistingFile)- Parameters:
exportTypeDescription- UsegetExportTypeDescriptions()to look up available exportTypes. Note that the file format does not suffice to specify a specific export since there may be more than one, as for HTML.- Since:
- 1.3.5
-
-