Package org.freeplane.plugin.script
Class FreeplaneScriptBaseClass
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Script
org.freeplane.plugin.script.FreeplaneScriptBaseClass
- All Implemented Interfaces:
groovy.lang.GroovyObject
public abstract class FreeplaneScriptBaseClass
extends groovy.lang.Script
All methods of this class are available as "global" methods in every script.
Only documented methods are meant to be used in scripts.
The following global objects are provided as shortcuts by the binding of this class:
- ui: see
invalid reference
UITools
- logger: see
LogUtils
- htmlUtils: see
invalid reference
HtmlUtils
- textUtils: see
invalid reference
TextUtils
- menuUtils: see
invalid reference
MenuUtils
- config: see
FreeplaneScriptBaseClass.ConfigProperties
-
invalid reference
FreeplaneVersion
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Accessor for Freeplane's configuration: In scripts available as "global variable"config
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected groovy.lang.Binding
createBinding
(NodeRO nodeProxy, ControllerRO controllerProxy) Applies default date-time format for dates or default number format for numbers.uses formatString to return a FormattedObject.formatDate
(Date date) Applies default date format (instead of standard date-time) format on the given date.getProperty
(String property) returns valueIfNull if value is null and value otherwise.invokeMethod
(String methodName, Object args) void
opens a linkvoid
opens aURI
Shortcut for node.map.node(id) - necessary for ids to other maps.parses text to the proper data type, if possible, setting format to the standard.rounds a number to integral type.round to the given number of decimal places:round(0.1234, 2) → 0.12
void
setBinding
(groovy.lang.Binding binding) Shortcut for node.map.node(id).text.toString()
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.Shortcut for node.map.node(id).value.Methods inherited from class groovy.lang.Script
evaluate, evaluate, getBinding, print, printf, printf, println, println, run, run, setProperty
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClass
-
Constructor Details
-
FreeplaneScriptBaseClass
public FreeplaneScriptBaseClass() -
FreeplaneScriptBaseClass
public FreeplaneScriptBaseClass(groovy.lang.Binding binding)
-
-
Method Details
-
setBinding
public void setBinding(groovy.lang.Binding binding) - Overrides:
setBinding
in classgroovy.lang.Script
-
createBinding
-
getProperty
- Specified by:
getProperty
in interfacegroovy.lang.GroovyObject
- Overrides:
getProperty
in classgroovy.lang.Script
-
invokeMethod
- Specified by:
invokeMethod
in interfacegroovy.lang.GroovyObject
- Overrides:
invokeMethod
in classgroovy.lang.Script
-
N
Shortcut for node.map.node(id) - necessary for ids to other maps. -
T
Shortcut for node.map.node(id).text. -
V
Shortcut for node.map.node(id).value. -
ifNull
returns valueIfNull if value is null and value otherwise. -
round
rounds a number to integral type. -
round
round to the given number of decimal places:round(0.1234, 2) → 0.12
-
parse
parses text to the proper data type, if possible, setting format to the standard. Parsing is configured via config file scanner.xmlassert 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"
-
format
uses formatString to return a FormattedObject.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'
- Returns:
-
invalid reference
IFormattedObject
-
format
Applies default date-time format for dates or default number format for numbers. All other objects are left unchanged.- Returns:
-
invalid reference
IFormattedObject
-
formatDate
Applies default date format (instead of standard date-time) format on the given date.- Returns:
-
invalid reference
IFormattedObject
-
toString
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.- See Also:
-
loadUri
opens aURI
-
loadUri
opens a link -
toString
-