Package org.freeplane.api

# Interface NodeRO

All Known Subinterfaces:
  `Node`, `Proxy.Node`, `Proxy.NodeRO`

public interface NodeRO
The currently selected node: `node` - read-only.

## Method Summary

Modifier and Type
Method
Description
`List<? extends Node>`
`allAt(String path)`
Returns a list of all nodes matching given path.
`Node`
`at(String path)`
Returns a single node located by path given as a string argument.
`List<? extends Node>`
`find(boolean withAncestors, boolean withDescendants, NodeCondition condition)`
Starting from this node, recursively searches for nodes for which `condition.check(node)` returns true and adds their ancestor or descendant nodes if required.
`List<? extends Node>`
`find(NodeCondition condition)`
Starting from this node, recursively searches for nodes for which `closure.call(node)` returns true.
`List<? extends Node>`
`findAll()`
Returns all nodes of the branch that starts with this node in breadth-first order.
`List<? extends Node>`
`findAllDepthFirst()`
Returns all nodes of the branch that starts with this node in depth-first order.
`String`
`getAlias()`
Alias of the node
`Convertible`
`getAt(String attributeName)`
allows to access attribute values like array elements.
`Attributes`
`getAttributes()`
`Quantity<LengthUnit>`
`getBaseDistanceToChildrenAsLength()`
`byte[]`
`getBinary()`
Returns a BASE64 encoded node text (see `Node.setBinary(byte[])`) as a binary object.
`NodeBookmark`
`getBookmark()`
Returns the bookmark for this node, if one exists.
`String`
`getBranchAsTextOutline()`
`ChildNodesLayout`
`getChildNodesLayout()`
`int`
`getChildPosition(Node childNode)`
returns the index (0..) of this node in the (by Y coordinate sorted) list of this node's children.
`List<? extends Node>`
`getChildren()`
returns the children of this node ordered by Y coordinate.
`Cloud`
`getCloud()`
a reference to an accessor object for cloud properties of this node.
`ConditionalStyles`
`getConditionalStyles()`
`Collection<? extends Connector>`
`getConnectorsIn()`
`Collection<? extends Connector>`
`getConnectorsOut()`
`int`
`getCountNodesSharingContent()`
The count of node sharing their content with this node.
`int`
`getCountNodesSharingContentAndSubtree()`
The count of nodes sharing their content and subtree with this node.
`Date`
`getCreatedAt()`
`DependencyLookup`
`getDependents()`
`Convertible`
`getDetails()`
returns the text of the details as a Convertible like `getNote()` for notes: node.details.to.plain plain text of the node, possibly after formula evaluation node.details.plain the same.
`String`
`getDetailsContentType()`
Returns details content type.
`String`
`getDetailsText()`
returns the raw HTML text of the details if there is any or null otherwise.
`String`
`getDisplayedText()`
Plain or HTML text of this node after possible transformation (formula evaluation, formatting, ...) and after text shortening.
`ExternalObject`
`getExternalObject()`
`String`
`getFormat()`
returns the format string of the formatter if available and null otherwise.
`NodeGeometryRO`
`getGeometry()`
`boolean`
`getHideDetails()`
returns true if node details are hidden.
`default int`
`getHorizontalShift()`
`Quantity<LengthUnit>`
`getHorizontalShiftAsLength()`
`default int`
`getHorizontalShiftInScreenPixels()`
`String`
`getHtmlText()`
The node text as HTML markup.
`Icons`
`getIcons()`
a reference to an accessor object for icons of this node.
`String`
`getId()`
`boolean`
`getIsGlobal()`
True if the node can be accessed using global accessor, see `at(String)`
`Date`
`getLastModifiedAt()`
`LayoutOrientation`
`getLayoutOrientation()`
`Link`
`getLink()`
a reference to an accessor object for link properties of this node.
`default Map`
`getMap()`
Deprecated.
since 1.7.10 - use `getMindMap()`
`MindMap`
`getMindMap()`
The mind map this node belongs to.
`default int`
`getMinimalDistanceBetweenChildren()`
`Quantity<LengthUnit>`
`getMinimalDistanceBetweenChildrenAsLength()`
`default int`
`getMinimalDistanceBetweenChildrenInScreenPixels()`
`Node`
`getNext()`
returns the next node with respect to this node in depth-first order.
`String`
`getNodeID()`
Deprecated.
since 1.2 - use Node.getId() instead.
`int`
`getNodeLevel(boolean countHidden)`
if countHidden is false then only nodes that are matched by the current filter are counted.
`List<? extends Node>`
`getNodesSharingContent()`
The count of nodes sharing their content with this node.
`List<? extends Node>`
`getNodesSharingContentAndSubtree()`
The nodes sharing their content and subtree with this node.
`Convertible`
`getNote()`
returns the text of the note as a Convertible.
`String`
`getNoteContentType()`
Returns note content type.
`String`
`getNoteText()`
Returns the HTML text of the note.
`Object`
`getObject()`
The object that's displayed as the node text - normally the raw text of this node (then this method is equivalent to `getText()`).
`Node`
`getParent()`
`Node`
`getParentNode()`
Deprecated.
since 1.2 - use `getParent()` instead.
`List<? extends Node>`
`getPathToRoot()`
a list of all nodes starting from this node upto (and including) the root node.
`String`
`getPlainText()`
Plain text after removal of possible HTML markup.
`String`
`getPlainTextContent()`
Deprecated.
since 1.2 - use getPlainText() or getTo().getPlain() instead.
`DependencyLookup`
`getPrecedents()`
`Node`
`getPrevious()`
returns the previous node with respect to this node in depth-first order.
`Reminder`
`getReminder()`
use it to create and inspect `Reminder`s.
`String`
`getShortText()`
Plain text of this node after possible transformation and forced text shortening.
`Side`
`getSideAtRoot()`
`NodeStyle`
`getStyle()`
The style attributes of a node can either be changed by assigning a named style like this:
`TagsRO`
`getTags()`
`String`
`getText()`
Raw text of this node which might be plain or HTML text.
`Convertible`
`getTo()`
returns an object that performs conversions (method name is choosen to give descriptive code): node.to.num Long or Double, see `Convertible.getDate()`.
`String`
`getTransformedText()`
Plain or HTML text of this node after possible transformation (formula evaluation, formatting, ...).
`Convertible`
`getValue()`
an alias for `getTo()`.
`default int`
`getVerticalShift()`
`Quantity<LengthUnit>`
`getVerticalShiftAsLength()`
`default int`
`getVerticalShiftInScreenPixels()`
`boolean`
`hasStyle(String styleName)`
returns true if the node has the style of this name - either manually set or as a conditional style or it is "default" which all nodes have.
`boolean`
`isDescendantOf(Node p)`
returns true if p is a parent, or grandparent, ...
`boolean`
`isFolded()`
if this node is folded.
`boolean`
`isFree()`
returns true if this node is freely positionable.
`boolean`
`isLeaf()`
`default boolean`
`isLeft()`
Deprecated.
since 1.11.1 - use `isTopOrLeft()`
`default boolean`
`isLeftOnViewsWithRoot(NodeRO viewRoot)`
Deprecated.
since 1.11.1 - use
invalid reference

    #isTopOrLeftOnViewsWithRoot()

`boolean`
`isMinimized()`
if this node's text is shortened for display.
`boolean`
`isRoot()`
`boolean`
`isTopOrLeft()`
`boolean`
`isTopOrLeftOnViewsWithRoot(NodeRO viewRoot)`
`boolean`
`isVisible()`
if this node is visible or not (due to filtering).
`boolean`
`isVisibleOnViewsWithRoot(NodeRO viewRoot)`
if this node is visible or not (due to filtering).

## Method Details

### at

Node at(String path)
Returns a single node located by path given as a string argument.

If no node or more than one node is available at the specified position, `NodeNotFoundException` is thrown.

The path is a concatenation of path elements described below.

## Path examples:

      node.at(":'house'/'kitchen'/~chairs/~2")
         - take global node with text 'house',
         - in its subtree node find with text 'kitchen'
         - find its child node with alias 'chairs'
         - return the second child node of the chairs

      node.at(".. 'house'/**/~dog")
          -- return node with alias 'dog' within subtree of ancestor node with text 'house'

Following path elements are defined:

## Child node:

     'node text' or /"node text" : child node with text 'node text'
     'node...' : child node containing text starting with 'node'
     * or '...' : any child node
     ~1 : child node at position 1 ( any number starting with 1 is allowed)
     ~nodeAlias : child node with alias 'nodeAlias', node alias can not be a number
     because numbers are reserved for the previous selector.

## Descendant node:

     /**/

## Parent node:

     ..

## Ancestor node:

     ..'node text' or "node text" : the closest ancestor node with text 'node text'
     ..'node...' : the closest ancestor node containing text starting with 'node'
     ..~2  : second ancestor node also the parent node of the parent node (any positive number is allowed)
     ..~nodeAlias : the closest ancestor node with alias 'nodeAlias', node alias can not be a number

## Root node

Prefix `/` as the first path character means the path starts from the root node.

     /'node text' or /"node text" : child node of the root with text 'node text'
     /'node...' : child node of the root containing text starting with 'node'
     /~nodeAlias : child node of the root with alias 'nodeAlias', node alias can not be a number

## Global node

(allowed only as the first path element). Here global node is a node carrying global flag which can be set using menu or by script.

     :'node text' or :"node text" : global node with text 'node text'
     :'node...' : global node containing text starting with 'node'
     :~nodeAlias : global node with alias 'nodeAlias', node alias can not be a number

Since:
  1.7.1

### allAt

List<? extends Node> allAt(String path)
Returns a list of all nodes matching given path. It can contain arbitrary node number or be empty. Path syntax is described in the `at` method.

Since:
  1.7.1

### getAttributes

Attributes getAttributes()

### getAt

Convertible getAt(String attributeName)
allows to access attribute values like array elements. Note that the returned type is a `Convertible`, not a String. Nevertheless it behaves like a String in almost all respects, that is, in Groovy scripts it understands all String methods like lenght(), matches() etc.

       // standard way
       node.attributes.set("attribute name", "12")
       // implicitely use getAt()
       def val = node["attribute name"]
       // use all conversions that Convertible provides (num, date, string, ...)
       assert val.num == new Long(12)
       // or use it just like a string
       assert val.startsWith("1")
       // check for availability of an attribute this way:
       if (node["unknown attribute"])
          // surprise: the node has an attribute with key "unknown attribute"

Throws:
  `org.freeplane.plugin.script.ExecuteScriptException`
Since:
  1.2

### getCloud

Cloud getCloud()
a reference to an accessor object for cloud properties of this node. This property is never null.

Since:
  1.2

### getChildPosition

int getChildPosition(Node childNode)
returns the index (0..) of this node in the (by Y coordinate sorted) list of this node's children. Returns -1 if childNode is not a child of this node.

### getChildren

List<? extends Node> getChildren()
returns the children of this node ordered by Y coordinate.

### getConnectorsIn

Collection<? extends Connector> getConnectorsIn()

### getConnectorsOut

Collection<? extends Connector> getConnectorsOut()

### getDetailsText

String getDetailsText()
returns the raw HTML text of the details if there is any or null otherwise.

Since:
  1.2

### getDetailsContentType

String getDetailsContentType()
Returns details content type.

Since:
  1.9.0

### getDetails

Convertible getDetails()
returns the text of the details as a Convertible like `getNote()` for notes:

- node.details.to.plain plain text of the node, possibly after formula evaluation
- node.details.plain the same.
- node.details.string the same.
- node.details.html the raw html text. No formula evaluation is applied.
- node.details.text the same.

Since:
  1.2

### getHideDetails

boolean getHideDetails()
returns true if node details are hidden.

Since:
  1.2

### getExternalObject

ExternalObject getExternalObject()

### getIcons

Icons getIcons()
a reference to an accessor object for icons of this node. This property is never null.

### getLink

Link getLink()
a reference to an accessor object for link properties of this node. This property is never null.

### getReminder

Reminder getReminder()
use it to create and inspect `Reminder`s. This property is never null.

### getMindMap

MindMap getMindMap()
The mind map this node belongs to.

Since:
  1.7.10

### getMap

@Deprecated default Map getMap()
Deprecated.
since 1.7.10 - use `getMindMap()`
The mind map this node belongs to.

Since:
  1.7.5

### getNodeID

@Deprecated String getNodeID()
Deprecated.
since 1.2 - use Node.getId() instead.

### getId

String getId()

Since:
  1.2

### getNodeLevel

int getNodeLevel(boolean countHidden)
if countHidden is false then only nodes that are matched by the current filter are counted.

### getNote

Convertible getNote()
returns the text of the note as a Convertible. Convertibles behave like Strings in most respects. Additionally String methods are overridden to handle Convertible arguments as if the argument were the result of Convertible.getText().

- node.note.to.plain plain text of the note, possibly after formula evaluation
- node.note.plain the same.
- node.note.text the same.
- node.note.html the raw html text. No formula evaluation is applied.
- node.note.string the same.

Returns:
  Convertible getString(), getText() and toString() will return plain text instead of the HTML. Use `getNoteText()` to get the HTML text.
Throws:
  `org.freeplane.plugin.script.ExecuteScriptException`
Since:
  1.2

### getNoteText

String getNoteText()
Returns the HTML text of the note. (Notes always contain HTML text.)

Throws:
  `org.freeplane.plugin.script.ExecuteScriptException`

### getNoteContentType

String getNoteContentType()
Returns note content type.

Since:
  1.9.0

### getParent

Node getParent()

Since:
  1.2

### getParentNode

@Deprecated Node getParentNode()
Deprecated.
since 1.2 - use `getParent()` instead.

### getAlias

String getAlias()
Alias of the node

Since:
  1.7.1

### getIsGlobal

boolean getIsGlobal()
True if the node can be accessed using global accessor, see `at(String)`

Since:
  1.7.1

### getPathToRoot

List<? extends Node> getPathToRoot()
a list of all nodes starting from this node upto (and including) the root node.

       def path = pathToRoot.collect{ it.plainText }.join('.')

Since:
  1.3.3

### getNext

Node getNext()
returns the next node with respect to this node in depth-first order. Returns null if this node is the only one in the map.

### getPrevious

Node getPrevious()
returns the previous node with respect to this node in depth-first order. Returns null if this node is the only one in the map.

### getStyle

NodeStyle getStyle()
The style attributes of a node can either be changed by assigning a named style like this:

    node.style.name = 'style.ok'

or by changing attributes for this node individually like this:

    node.style.textColorCode = '#FF0000'

Conditional styles of a node can only be investigated by `hasStyle(String)`. Here a script that creates an index of all nodes having the style 'todo':

     def todos = node.map.root.createChild('To Do')
     c.find{ it.hasStyle('todo') }.each {
         def child = todos.createChild(it.text)
         child.link.node = it
     }

### hasStyle

boolean hasStyle(String styleName)
returns true if the node has the style of this name - either manually set or as a conditional style or it is "default" which all nodes have. The following statement will always be true:

Since:
  1.2

### getConditionalStyles

ConditionalStyles getConditionalStyles()

Since:
  1.11.1

### getText

String getText()
Raw text of this node which might be plain or HTML text. Possible transformations (formula evaluation, formatting, ...) are not applied.

See

- `getPlainText()` for plain text or use `HtmlUtils.htmlToPlain(String)`.
- `getHtmlText()` for HTML text or use `HtmlUtils.plainToHTML(String)`.
- `getTransformedText()` or `getValue()` for text after formula evaluation.
- `getObject()` for possible typed content.
- `getTo()` for text/object conversions.

Since:
  1.2

### getPlainText

String getPlainText()
Plain text after removal of possible HTML markup. Possible transformations (formula evaluation, formatting, ...) are not applied.

Since:
  1.2

### getPlainTextContent

@Deprecated String getPlainTextContent()
Deprecated.
since 1.2 - use getPlainText() or getTo().getPlain() instead.
Plain text after removal of possible HTML markup. Formulas are not evaluated.

### getHtmlText

String getHtmlText()
The node text as HTML markup. Returns the same as `getText()` if the node text already is HTML or converts the plain text to HTML otherwise.

Since:
  1.2

### getTransformedText

String getTransformedText()
Plain or HTML text of this node after possible transformation (formula evaluation, formatting, ...).

Since:
  1.2

### getDisplayedText

String getDisplayedText()
Plain or HTML text of this node after possible transformation (formula evaluation, formatting, ...) and after text shortening. See `isMinimized()` for node shortening.

Since:
  1.2

### getShortText

String getShortText()
Plain text of this node after possible transformation and forced text shortening.

Since:
  1.2

### getObject

Object getObject()
The object that's displayed as the node text - normally the raw text of this node (then this method is equivalent to `getText()`). But in case of typed content (for numbers, dates and calendars) `getObject()` returns a proper `IFormattedObject`. Use `getPlainText()` to remove HTML. See `Node.setObject(Object)` for details.

Since:
  1.2

### getFormat

String getFormat()
returns the format string of the formatter if available and null otherwise.

Since:
  1.2

### getTo

Convertible getTo()
returns an object that performs conversions (method name is choosen to give descriptive code):

node.to.num
  Long or Double, see `Convertible.getDate()`.
node.to.date
  Date, see `Convertible.getDate()`.
node.to.string
  Text, see `Convertible.getString()`.
node.to.text
  an alias for getString(), see `Convertible.getText()`.
node.to.object
  returns what fits best, see `Convertible.getObject()`.

Returns:
  ConvertibleObject
Throws:
  `org.freeplane.plugin.script.ExecuteScriptException` - on formula evaluation errors
Since:
  1.2

### getValue

Convertible getValue()
an alias for `getTo()`.

Throws:
  `org.freeplane.plugin.script.ExecuteScriptException` - on formula evaluation errors
Since:
  1.2

### getBinary

byte[] getBinary()
Returns a BASE64 encoded node text (see `Node.setBinary(byte[])`) as a binary object. Errors are signaled by a null return value. Whitespace characters are ignored.
Note that this method is not able to catch all encoding errors!

Since:
  1.2

### isDescendantOf

boolean isDescendantOf(Node p)
returns true if p is a parent, or grandparent, ... of this node, or if it is equal to this node; returns false otherwise.

### isFolded

boolean isFolded()
if this node is folded. Note that the folding state only concerns the visibility of the child nodes.

### isFree

boolean isFree()
returns true if this node is freely positionable.

Since:
  1.2

### isLeaf

boolean isLeaf()

### isLeft

@Deprecated default boolean isLeft()
Deprecated.
since 1.11.1 - use `isTopOrLeft()`

Since:
  1.10.4

### isTopOrLeft

boolean isTopOrLeft()

Since:
  1.11.1

### isLeftOnViewsWithRoot

@Deprecated default boolean isLeftOnViewsWithRoot(NodeRO viewRoot)
Deprecated.
since 1.11.1 - use
invalid reference

    #isTopOrLeftOnViewsWithRoot()

Since:
  1.10.4

### isTopOrLeftOnViewsWithRoot

boolean isTopOrLeftOnViewsWithRoot(NodeRO viewRoot)

Since:
  1.11.1

### isRoot

boolean isRoot()

### getSideAtRoot

Side getSideAtRoot()

Since:
  1.10.4

### isVisible

boolean isVisible()
if this node is visible or not (due to filtering). Node folding and view roots are not considered. See `isFolded()` for folding state.

### isVisibleOnViewsWithRoot

boolean isVisibleOnViewsWithRoot(NodeRO viewRoot)
if this node is visible or not (due to filtering). Node folding is not considered.

Since:
  1.10.4

### isMinimized

boolean isMinimized()
if this node's text is shortened for display.

### getCountNodesSharingContent

int getCountNodesSharingContent()
The count of node sharing their content with this node. Use `if (node.countNodesSharingContent() > 0)` to check if a node has any clones.
Note: `getCountNodesSharingContent()` ≥ `getCountNodesSharingContentAndSubtree()`.

Returns:
  0 if this node is standalone or the number of other nodes sharing content otherwise.
Since:
  1.5
See Also:
  - `getNodesSharingContent()`
  - `Node.appendAsCloneWithSubtree(Proxy.NodeRO)`
  - `Node.appendAsCloneWithoutSubtree(Proxy.NodeRO)`

### getCountNodesSharingContentAndSubtree

int getCountNodesSharingContentAndSubtree()
The count of nodes sharing their content and subtree with this node.
Note: `getCountNodesSharingContent()` ≥ `getCountNodesSharingContentAndSubtree()`.

Returns:
  0 if this node has no other nodes it is sharing its content and subtree with or its count otherwise.
Since:
  1.5
See Also:
  - `getNodesSharingContentAndSubtree()`
  - `Node.appendAsCloneWithSubtree(Proxy.NodeRO)`
  - `Node.appendAsCloneWithoutSubtree(Proxy.NodeRO)`

### getNodesSharingContent

List<? extends Node> getNodesSharingContent()
The count of nodes sharing their content with this node.
Note: `getCountNodesSharingContent()` ≥ `getCountNodesSharingContentAndSubtree()`.

Returns:
  0 if this node is standalone or the number of other nodes sharing content otherwise.
Since:
  1.5
See Also:
  - `getCountNodesSharingContent()`
  - `Node.appendAsCloneWithSubtree(Proxy.NodeRO)`
  - `Node.appendAsCloneWithoutSubtree(Proxy.NodeRO)`

### getNodesSharingContentAndSubtree

List<? extends Node> getNodesSharingContentAndSubtree()
The nodes sharing their content and subtree with this node.

Returns:
  0 if this node has no other nodes it is sharing its content and subtree with or its count otherwise.
Since:
  1.5
See Also:
  - `getCountNodesSharingContentAndSubtree()`
  - `Node.appendAsCloneWithSubtree(Proxy.NodeRO)`
  - `Node.appendAsCloneWithoutSubtree(Proxy.NodeRO)`

### find

List<? extends Node> find(NodeCondition condition)
Starting from this node, recursively searches for nodes for which `closure.call(node)` returns true. See `ControllerRO.find(NodeCondition)` for details.

### find

List<? extends Node> find(boolean withAncestors, boolean withDescendants, NodeCondition condition)
Starting from this node, recursively searches for nodes for which `condition.check(node)` returns true and adds their ancestor or descendant nodes if required.

Since:
  1.7.4 See `ControllerRO.find(NodeCondition)` for details.

### findAll

List<? extends Node> findAll()
Returns all nodes of the branch that starts with this node in breadth-first order. See `ControllerRO.findAll()` for map-global searches.

Since:
  1.2

### findAllDepthFirst

List<? extends Node> findAllDepthFirst()
Returns all nodes of the branch that starts with this node in depth-first order. See `ControllerRO.findAllDepthFirst()` for map-global searches.

Since:
  1.2

### getLastModifiedAt

Date getLastModifiedAt()

### getCreatedAt

Date getCreatedAt()

### getHorizontalShift

default int getHorizontalShift()

Since:
  1.3.7

### getVerticalShift

default int getVerticalShift()

Since:
  1.3.7

### getMinimalDistanceBetweenChildren

default int getMinimalDistanceBetweenChildren()

Since:
  1.3.7

### getHorizontalShiftInScreenPixels

default int getHorizontalShiftInScreenPixels()

Since:
  1.8.11

### getVerticalShiftInScreenPixels

default int getVerticalShiftInScreenPixels()

Since:
  1.8.11

### getMinimalDistanceBetweenChildrenInScreenPixels

default int getMinimalDistanceBetweenChildrenInScreenPixels()

Since:
  1.8.11

### getVerticalShiftAsLength

Quantity<LengthUnit> getVerticalShiftAsLength()

Since:
  1.8.11

### getMinimalDistanceBetweenChildrenAsLength

Quantity<LengthUnit> getMinimalDistanceBetweenChildrenAsLength()

Since:
  1.8.11

### getBaseDistanceToChildrenAsLength

Quantity<LengthUnit> getBaseDistanceToChildrenAsLength()

Since:
  1.11.1

### getHorizontalShiftAsLength

Quantity<LengthUnit> getHorizontalShiftAsLength()

Since:
  1.8.11

### getLayoutOrientation

LayoutOrientation getLayoutOrientation()

Since:
  1.11.1

### getChildNodesLayout

ChildNodesLayout getChildNodesLayout()

Since:
  1.11.1

### getGeometry

NodeGeometryRO getGeometry()

Since:
  1.8.11

### getPrecedents

DependencyLookup getPrecedents()

Since:
  1.7.2

### getDependents

DependencyLookup getDependents()

Since:
  1.7.2

### getBranchAsTextOutline

String getBranchAsTextOutline()

Since:
  1.11.3

### getTags

TagsRO getTags()

Since:
  1.12.1

### getBookmark

NodeBookmark getBookmark()
Returns the bookmark for this node, if one exists.

Returns:
  the bookmark for this node, or null if this node is not bookmarked
Since:
  1.12.12