Proxy.NodeRO
public static interface Proxy.Node extends Proxy.NodeRO
node
- read-write.Modifier and Type | Method | Description |
---|---|---|
Proxy.Connector |
addConnectorTo(java.lang.String targetNodeId) |
as above, using String targetNodeId instead of Node object to establish the connector.
|
Proxy.Connector |
addConnectorTo(Proxy.Node target) |
adds a new Connector to the given target node and returns the new
connector for optional further editing (style); also enlists the
Connector on the target Node object.
|
Proxy.Node |
appendAsCloneWithoutSubtree(Proxy.NodeRO toBeCloned) |
inserts the node as a clone of toBeCloned without its current and/or future
subtree.
|
Proxy.Node |
appendAsCloneWithSubtree(Proxy.NodeRO toBeCloned) |
inserts the node as a clone of toBeCloned including its current and/or future
subtree.
|
Proxy.Node |
appendBranch(Proxy.NodeRO node) |
inserts a copy of the branch starting with node as a new child branch.
|
Proxy.Node |
appendChild(Proxy.NodeRO node) |
inserts a copy of node as a new child.
|
Proxy.Node |
createChild() |
inserts *new* node as child, takes care of all construction work and
internal stuff inserts as last child.
|
Proxy.Node |
createChild(int position) |
inserts *new* node as child, takes care of all construction work and
internal stuff
|
Proxy.Node |
createChild(java.lang.Object value) |
like
createChild() but sets the node text to the given text. |
void |
decrypt(java.lang.String password) |
decrypts a node without removing the encryption.
|
void |
delete() |
|
void |
encrypt(java.lang.String password) |
encrypts a node.
|
boolean |
hasEncryption() |
Returns true if the node is password protected, no matter if currently accessible (password entered) or not.
|
boolean |
isEncrypted() |
Returns true if the node has password protection and is currently unaccessible (password has to be entered).
|
void |
moveTo(Proxy.Node parentNode) |
|
void |
moveTo(Proxy.Node parentNode,
int position) |
|
void |
pasteAsClone() |
inserts the node(s) copied from clipboard as clone(s).
|
java.lang.Object |
putAt(java.lang.String attributeName,
java.lang.Object value) |
Allows to set and to change attribute like array (or map) elements.
|
void |
removeConnector(Proxy.Connector connectorToBeRemoved) |
removes the given connector on both sides.
|
void |
removeEncryption(java.lang.String password) |
decrypts a node and remove the password protection.
|
void |
setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes) |
allows to set all attributes at once:
|
void |
setBinary(byte[] data) |
Converts data to a BASE64 encoded string and
sets it as this node's text.
|
void |
setCreatedAt(java.util.Date date) |
|
void |
setDateTime(java.util.Date date) |
sets the node text to a default formatted datetime object.
|
void |
setDetails(java.lang.Object details) |
A node's text is String valued.
|
void |
setDetailsText(java.lang.String html) |
Sets the raw (HTML) note text.
|
void |
setFolded(boolean folded) |
|
void |
setFormat(java.lang.String format) |
sets the format string of the formatter.
|
void |
setFree(boolean free) |
set to true if this node should be freely positionable:
|
void |
setHideDetails(boolean hide) |
use node.hideDetails = true/false to control visibility of details.
|
void |
setHorizontalShift(int horizontalShift) |
|
void |
setHorizontalShift(java.lang.String verticalShift) |
use length units like "1 cm" or "6 pt"
|
void |
setHorizontalShift(org.freeplane.core.util.Quantity<org.freeplane.core.ui.LengthUnits> verticalShift) |
|
void |
setLastModifiedAt(java.util.Date date) |
|
void |
setLeft(boolean isLeft) |
|
void |
setMinimalDistanceBetweenChildren(int minimalDistanceBetweenChildren) |
|
void |
setMinimalDistanceBetweenChildren(java.lang.String verticalShift) |
use length units like "1 cm" or "6 pt"
|
void |
setMinimalDistanceBetweenChildren(org.freeplane.core.util.Quantity<org.freeplane.core.ui.LengthUnits> verticalShift) |
|
void |
setMinimized(boolean shortened) |
|
void |
setNote(java.lang.Object value) |
Set the note text:
This methods provides automatic conversion to String in a way that node.getNote().getXyz()
methods will be able to convert the string properly to the wanted type.
|
void |
setNoteText(java.lang.String html) |
Sets the raw (HTML) note text.
|
void |
setObject(java.lang.Object value) |
A node's text object is normally String valued but it can be of any type since every Object can be converted
to String for display.
|
void |
setText(java.lang.Object value) |
If
value is a String the node object is set to it verbatim. |
void |
setVerticalShift(int verticalShift) |
|
void |
setVerticalShift(java.lang.String verticalShift) |
use length units like "1 cm" or "6 pt"
|
void |
setVerticalShift(org.freeplane.core.util.Quantity<org.freeplane.core.ui.LengthUnits> verticalShift) |
|
void |
sortChildrenBy(groovy.lang.Closure<java.lang.Comparable<java.lang.Object>> closure) |
A sort method that uses the result of the Groovy closure ("block") for comparison.
|
find, find, findAll, findAllDepthFirst, getAt, getAttributes, getBinary, getChildPosition, getChildren, getCloud, getConnectorsIn, getConnectorsOut, getCountNodesSharingContent, getCountNodesSharingContentAndSubtree, getCreatedAt, getDetails, getDetailsText, getDisplayedText, getExternalObject, getFormat, getHideDetails, getHorizontalShift, getHtmlText, getIcons, getId, getLastModifiedAt, getLink, getMap, getMinimalDistanceBetweenChildren, getNext, getNodeID, getNodeLevel, getNodesSharingContent, getNodesSharingContentAndSubtree, getNote, getNoteText, getObject, getParent, getParentNode, getPathToRoot, getPlainText, getPlainTextContent, getPrevious, getReminder, getShortText, getStyle, getText, getTo, getTransformedText, getValue, getVerticalShift, hasStyle, isDescendantOf, isFolded, isFree, isLeaf, isLeft, isMinimized, isRoot, isVisible
Proxy.Connector addConnectorTo(Proxy.Node target)
Proxy.Connector addConnectorTo(java.lang.String targetNodeId)
Proxy.Node createChild()
Proxy.Node createChild(java.lang.Object value)
createChild()
but sets the node text to the given text.
// instead of def child = node.createChild(); child.setObject(value); // use def child = node.createChild(value);
Proxy.Node createChild(int position)
Proxy.Node appendChild(Proxy.NodeRO node)
Proxy.Node appendBranch(Proxy.NodeRO node)
Proxy.Node appendAsCloneWithSubtree(Proxy.NodeRO toBeCloned)
java.lang.IllegalArgumentException
- if
a) this node (the to-be-parent) is contained in the subtree of toBeCloned,
b) toBeCloned is the root node,
c) toBeCloned comes from a different map.Proxy.Node appendAsCloneWithoutSubtree(Proxy.NodeRO toBeCloned)
java.lang.IllegalArgumentException
- if
a) this node (the to-be-parent) is contained in the subtree of toBeCloned,
b) toBeCloned is the root node,
c) toBeCloned comes from a different map.void pasteAsClone()
appendAsCloneWithSubtree(Proxy.NodeRO)
or appendAsCloneWithoutSubtree(Proxy.NodeRO)
instead if possible - they give you more control.void delete()
void moveTo(Proxy.Node parentNode)
void moveTo(Proxy.Node parentNode, int position)
void removeConnector(Proxy.Connector connectorToBeRemoved)
void setDetails(java.lang.Object details)
setText(Object)
, that is special conversion is provided for dates and calendars, other
types are converted via value.toString().
If the conversion result is not valid HTML it will be automatically converted to HTML.details
- An object for conversion to String. Use null to unset the details. Works well for all types
that Convertible
handles, particularly Convertible
s itself.void setDetailsText(java.lang.String html)
void setHideDetails(boolean hide)
void setFolded(boolean folded)
void setFree(boolean free)
node.free = true node.style.floating = true
void setMinimized(boolean shortened)
void setNote(java.lang.Object value)
// converts numbers and other stuff with toString()
node.note = 1.2
assert node.note.text == "<html><body><p>1.2"
assert node.note.plain == "1.2"
assert node.note.num == 1.2d
// == dates
// a date in some non-UTC time zone
def date = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ").
parse("1970-01-01 00:00:00.000-0200")
// converts to "1970-01-01T02:00:00.000+0000" (GMT)
// - note the shift due to the different time zone
// - the missing end tags don't matter for rendering
node.note = date
assert node.note == "<html><body><p>1970-01-01T02:00:00.000+0000"
assert node.note.plain == "1970-01-01T02:00:00.000+0000"
assert node.note.date == date
// == remove note
node.note = null
assert node.note.text == null
value
- An object for conversion to String. Works well for all types that Convertible
handles, particularly Convertible
s itself.void setNoteText(java.lang.String html)
void setText(java.lang.Object value)
value
is a String the node object is set to it verbatim. For all other argument types it's
an alias for setObject(Object)
.
node.text = '006' assert node.object.class.simpleName == "String" node.object = '006' assert node.text == '6' assert node.object.class.simpleName == "Long"
setObject(Object)
void setObject(java.lang.Object value)
Special support is provided for numbers, dates and calendars that are stored unconverted. For display of
them a standard formatter is used (use #setFormat() to change it). You may also pass IFormattedObject
instances (FormattedDate
, FormattedNumber
or FormattedObject
) directly to determine
the format in one pass.
All other types are converted via value.toString().
Numbers
double number = 1.2222222d node.object = number // to enable math with node.object its type is not FormattedNumber assert node.object.class.simpleName == "Double" assert node.to.object.class.simpleName == "Double" // use globally bound TextUtils object def defaultNumberFormat = textUtils.defaultNumberFormat assert node.format != null // e.g. "1.22" assert node.text == defaultNumberFormat.format(number) assert node.to.num == number assert node.to.num + 1.0 == number + 1.0 assert node.object + 1.0 == number + 1.0
Dates
def date = new Date(0) // when Unix time began node.object = date assert node.object.class.simpleName == "FormattedDate" assert node.to.object.class.simpleName == "FormattedDate" // use globally bound TextUtils object def defaultDateFormat = textUtils.defaultDateFormat assert node.object.toString() == defaultDateFormat.format(date) assert node.format == defaultDateFormat.pattern // e.g. "01/01/1970" assert node.text == defaultDateFormat.format(date) assert node.to.date == date
Date/Time
def date = new Date(0) // when Unix time began // the default format for dates does not contain a time component. Use node.dateTime to override it. node.dateTime = date assert node.object.class.simpleName == "FormattedDate" assert node.to.object.class.simpleName == "FormattedDate" // use globally bound TextUtils object def defaultDateFormat = textUtils.defaultDateTimeFormat assert node.object.toString() == defaultDateFormat.format(date) assert node.format == defaultDateFormat.pattern // e.g. "01/01/1970 01:00" assert node.text == defaultDateFormat.format(date) assert node.to.date == date
value
- A not-null object.void setDateTime(java.util.Date date)
setObject(Object)
void setBinary(byte[] data)
void setFormat(java.lang.String format)
node.object = new Date() node.format = "dd.MMM.yyyy" // ok: "13.07.2011" node.format = "#.00" // still "13.07.2011". See log: "cannot format 13.07.2011 with #.00: multiple points"Numbers:
node.object = 1.122 node.format = "#.##" // ok: "1.12" (US, GB, ...) or "1,12" (Germany, ...) node.format = "#.0000" // ok: "1.1220" (US, GB, ...) or "1,1220" (Germany, ...)
setObject(Object)
void setLastModifiedAt(java.util.Date date)
void setCreatedAt(java.util.Date date)
java.lang.Object putAt(java.lang.String attributeName, java.lang.Object value)
Proxy.Attributes
for details.value
- An object for conversion to String. Works well for all types that Convertible
handles, particularly Convertible
s itself. Use null to unset an attribute.void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
node.attributes = [:] // clear the attributes assert node.attributes.size() == 0 node.attributes = ["1st" : "a value", "2nd" : "another value"] // create 2 attributes assert node.attributes.size() == 2 node.attributes = ["one attrib" : new Double(1.22)] // replace all attributes assert node.attributes.size() == 1 assert node.attributes.getFirst("one attrib") == "1.22" // note the type conversion assert node["one attrib"] == "1.22" // here we compare Convertible with String
void setLeft(boolean isLeft)
boolean hasEncryption()
void removeEncryption(java.lang.String password)
boolean isEncrypted()
void encrypt(java.lang.String password)
void decrypt(java.lang.String password)
void setHorizontalShift(int horizontalShift)
void setHorizontalShift(org.freeplane.core.util.Quantity<org.freeplane.core.ui.LengthUnits> verticalShift)
void setHorizontalShift(java.lang.String verticalShift)
void setVerticalShift(int verticalShift)
void setVerticalShift(org.freeplane.core.util.Quantity<org.freeplane.core.ui.LengthUnits> verticalShift)
void setVerticalShift(java.lang.String verticalShift)
void setMinimalDistanceBetweenChildren(int minimalDistanceBetweenChildren)
void setMinimalDistanceBetweenChildren(org.freeplane.core.util.Quantity<org.freeplane.core.ui.LengthUnits> verticalShift)
void setMinimalDistanceBetweenChildren(java.lang.String verticalShift)
void sortChildrenBy(groovy.lang.Closure<java.lang.Comparable<java.lang.Object>> closure)
it
) the search can
evaluate every node property, like attributes, icons, node text or notes.
Examples:
// sort by details text node.sortChildrenBy{ it.details.to.plain } // sort numerically node.sortChildrenBy{ it.to.num0 }
closure
- a Groovy closure that returns a Comparable value like a String. The closure will receive
a NodeModel as an argument.