groovy.lang.GroovyObjectpublic abstract class FreeplaneScriptBaseClass
extends groovy.lang.Script
The following global objects are provided as shortcuts by the binding of this class:
The following classes may also be useful in scripting:| Modifier and Type | Class | Description |
|---|---|---|
static class |
FreeplaneScriptBaseClass.ConfigProperties |
Accessor for Freeplane's configuration: In scripts available
as "global variable"
config. |
| Constructor | Description |
|---|---|
FreeplaneScriptBaseClass() |
| Modifier and Type | Method | Description |
|---|---|---|
Object |
format(Object object) |
Applies default date-time format for dates or default number format for numbers.
|
Object |
format(Object object,
String formatString) |
uses formatString to return a FormattedObject.
|
Object |
formatDate(Date date) |
Applies default date format (instead of standard date-time) format on the given date.
|
Object |
getProperty(String property) |
|
Object |
ifNull(Object value,
Object valueIfNull) |
returns valueIfNull if value is null and value otherwise.
|
void |
initBinding() |
|
Object |
invokeMethod(String methodName,
Object args) |
|
void |
loadUri(URI uri) |
opens a
URI |
Proxy.NodeRO |
N(String id) |
Shortcut for node.map.node(id) - necessary for ids to other maps.
|
Object |
parse(String text) |
parses text to the proper data type, if possible, setting format to the standard.
|
Long |
round(Double d) |
rounds a number to integral type.
|
Double |
round(Double d,
int precision) |
round to the given number of decimal places:
round(0.1234, 2) → 0.12 |
void |
setBinding(groovy.lang.Binding binding) |
|
String |
T(String id) |
Shortcut for node.map.node(id).text.
|
String |
toString(Object o) |
formats according to the internal standard, that is the conversion will be reversible
for types that are handled special by the scripting api namely Dates and Numbers.
|
Object |
V(String id) |
Shortcut for node.map.node(id).value.
|
public void initBinding()
public void setBinding(groovy.lang.Binding binding)
setBinding in class groovy.lang.Scriptpublic Object getProperty(String property)
getProperty in interface groovy.lang.GroovyObjectgetProperty in class groovy.lang.Scriptpublic Object invokeMethod(String methodName, Object args)
invokeMethod in interface groovy.lang.GroovyObjectinvokeMethod in class groovy.lang.Scriptpublic Proxy.NodeRO N(String id)
public Object ifNull(Object value, Object valueIfNull)
public Double round(Double d, int precision)
round(0.1234, 2) → 0.12public Object parse(String text)
assert parse('2012-11-30') instanceof Date
assert parse('1.22') instanceof Number
// if parsing fails the original string is returned
assert parse('2012XX11-30') == '2012XX11-30'
def d = parse('2012-10-30')
c.statusInfo = "${d} is ${new Date() - d} days ago"
public Object format(Object object, String formatString)
Note: If you want to format the node core better use the format node attribute instead:
node.object = new Date() node.format = 'dd/MM/yy'
IFormattedObject if object is formattable and the unchanged object otherwise.public Object format(Object object)
IFormattedObject if object is formattable and the unchanged object otherwise.public Object formatDate(Date date)
IFormattedObject if object is formattable and the unchanged object otherwise.public String toString(Object o)
Convertible.toString(Object)