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
Nested ClassesModifier and TypeClassDescriptionstatic classAccessor for Freeplane's configuration: In scripts available as "global variable"config. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected groovy.lang.BindingcreateBinding(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) voidopens a linkvoidopens aURIShortcut 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.12voidsetBinding(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, setPropertyMethods 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:
setBindingin classgroovy.lang.Script
-
createBinding
-
getProperty
- Specified by:
getPropertyin interfacegroovy.lang.GroovyObject- Overrides:
getPropertyin classgroovy.lang.Script
-
invokeMethod
- Specified by:
invokeMethodin interfacegroovy.lang.GroovyObject- Overrides:
invokeMethodin 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:
-
if object is formattable and the unchanged object otherwise.
invalid reference
IFormattedObject
-
format
Applies default date-time format for dates or default number format for numbers. All other objects are left unchanged.- Returns:
-
if object is formattable and the unchanged object otherwise.
invalid reference
IFormattedObject
-
formatDate
Applies default date format (instead of standard date-time) format on the given date.- Returns:
-
if object is formattable and the unchanged object otherwise.
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
-