BeanShell Scripts
A description of the BeanShell programming language, which is heavily based on the Java Language, is available from www.beanshell.org.
"BeanShell is a small, free, embeddable Java source interpreter with object scripting language features, written in Java. BeanShell dynamically executes standard Java syntax and extends it with common scripting conveniences such as loose types, commands, and method closures like those in Perl and JavaScript." (www.beanshell.org)
The creation of new additional scripts may be based on the example scripts or on the API documentation, available at gravisto.fim.uni-passau.de.
JavaDoc
The VANTED API documentation (JavaDoc) is now available: VANTED JavaDoc
Example Scripts
- Node-Grid-Generator Algorithm
- Number-Nodes Algorithm
- Manual Assignment of Cluster IDs
- Specification of a proxy server
Naming of Menu Commands
By default bsh-commands that are stored in the user-home folder (e.g. /home/user under Linux and c:\documents and settings\user under Windows) are scanned for the special tag "//@" in the first or second line. Following the @ character, the corresponding script menu title is defined. If the character ":" is found in the description, the command is not included in the context menu of the graph view, but in the main menu.
The following text in the first or second line of bsh file will result in a new menu command Node/Color Blue:
//@Node:Color Blue
In order to add a menu command to one of the default menu items, it is possible to just name the corresponding menu items. E.g. "Node", "Edge". Additionally the internal identifiers of the default menu items may be used:
- menu.window : Window menu
- menu.file : File menu (e.g. @menu.file:Show Info -> File/Show Info)
- menu.edit : Edit menu
Automatic Startup of Scripts
A special meaning has the target menu name "runonce". If a script file specifies this target menu name (e.g. "//@runonce:setproxy"), the corresponding script will be automatically executed upon start of the system.
Execution of a Script for each Node
If the specified menu title ends with the character "�" or "^", the script will be executed several times, for each node once. Upon each execution the variable "node" will be instanciated with a "NodeHelper" object, as described here. Various commands are available with this object. For example the following script will modify the tooltip-text in status bar for each node
//@Node:Set Status-Text^
node.setTooltip("Hello, this is node #"+node.getID());
Source File Locations
By default bsh-commands that are stored in the user-home folder (e.g. /home/user under Linux and c:\documents and settings\user under Windows) are scanned for the special tag "//@" in the first or second line. If this text is found, a corresponding menu item is created.
You can customize the search folder for your BeanShell scripts as follows:
Open or create the file ".bshrc" in your home folder. Add or edit a line as follows (Windows Example):
scriptHomes = "C:\myScripts;C:\teamScripts;C:\downloadedScripts";
Additionally to the home folder the listed folders will be scanned for files with the extension ".bsh".