Scripting: API Changes

From Freeplane - free mind mapping and knowledge management software
Revision as of 15:55, 4 November 2011 by Jokro (talk | contribs) (Adjustments for Formulas)

The Scripting API, which is defined by the <groovy>org.freeplane.plugin.script.proxy.Proxy</groovy> interface, will evolve over time but Freeplane's developers will do whatever possible to keep new API versions downward compatible. On the other hand there might be changes in parts of the Freeplane code that are not part of the official API but on which some scripts might depend nevertheless. This mostly applies to the utility classes.

This page lists changes in Freeplane that you might want or sometimes have to care about when changing to new Freeplane versions.


Before Release 1.1

1.41 beta

Attributes: <groovy> List<String> getAll(String) public List<String> getAttributeNames() String get(final int index) void set(final int index, final String value) void set(final int index, final String name, final String value) boolean removeAll(final String name) void remove(final int index) void add(final String name, final String value) int size() </groovy>

1.43 rc

<groovy>

 File Map.getFile()

</groovy>

After Release 1.1

Refactoring of utility classes

In package org.freeplane.core.util:

  • ResUtil => FileUtils
  • HtmlTools => HtmlUtils
  • LogTool => LogUtils
  • MenuTools => MenuUtils
  • SysUtil => SysUtils
  • XmlTool => XmlUtils

Other:

  • org.freeplane.core.resources.FpStringUtils => org.freeplane.core.util.TextUtil
  • org.freeplane.core.util.MultipleValueMap => org.freeplane.core.util.collection.MultipleValueMap

The following Perl script will adjust all scripts in the current directory with a ".groovy" suffix. The original file will be saved with a ".bak" suffix. <groovy> perl -i.bak -pe 's,\b(Res|Sys)Util\b,$1Utils,g;

 s,\b(Html|Log|Menu|Xml)Tools?\b,$1Utils,g;
 s,resources\.FpStringUtils\b,util\.FpStringUtils,g;
 s,\bFpStringUtils\b,TextUtils,g;
 s,(util).(MultipleValueMap)\b,$1.collection.$2,g' *.groovy

</groovy>

Adjustments for Formulas

The new Formula plugin has driven changes that allows to write more compact code. For the newest development API version and the changes therein see Scripting API (Pre-Release)