get the html header comment right!
[jalview.git] / help / html / features / groovy.html
index 66edaf9..4b63c61 100644 (file)
  * PURPOSE.  See the GNU General Public License for more details.\r
  * \r
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
--->\r
+-->
+<head><title>Groovy Shell</title></head>\r
+<body>\r
+<p><strong>The Groovy Shell</strong></p>\r
+<p><a href="http://groovy.codehaus.org/">Groovy</a> is an &quot;<em>agile and dynamic \r
+language for the Java platform</em>&quot;. The groovy scripting language makes it \r
+extremely easy to programmatically interact with Java programs, in much the same \r
+way that Javascript is used to generate and interact with applets and other \r
+objects on the page.</p>\r
+<p><strong><em>Getting Groovy...</em></strong><br>\r
+Jalview Groovy support is only possible if the core groovy \r
+jars which include the GroovyShell are present on the CLASSPATH \r
+when Jalview is started.</p><p>The jars are obtained from the \r
+<em>embedded</em> directory within the <a \r
+href="http://dist.codehaus.org/groovy/distributions">groovy \r
+distribution</a>. The easiest way of adding them to the \r
+Jalview classpath is to download and build jalview from \r
+it's source distribution, and then add the groovy-all-*.jar \r
+to the lib directory whose path is given in the java.ext.dirs property.</p>\r
+<p><strong>Opening Jalview's Groovy Console</strong><br>If groovy is available, then the \r
+<strong>Tools&#8594;Groovy Console...</strong> menu entry will be available \r
+from the Jalview Desktop's drop-down menu. Selecting this will open the\r
+<a href="http://groovy.codehaus.org/Groovy+Console">Groovy Console</a> which \r
+allows you to interactively execute Groovy scripts within the Jalview run-time environment.</p>\r
+<p><strong>Executing groovy scripts on Jalview startup</strong><br>\r
+The -groovy &lt;script&gt; option on the <a href="commandline.html"/>\r
+Jalview command line</a> will execute the contents of \r
+&lt;script&gt;. &lt;script&gt; may be a file, or alternatively if it is &quot;STDIN&quot; \r
+then the standard input will be used.</p>\r
+<p><strong>Access to Jalview's functions from Groovy Scripts</strong><br>\r
+There is as yet no properly defined scripting interface to Jalview, but all the\r
+public methods of the jalview class hierarchy can be called from Groovy scripts. \r
+The access point for this is the <strong>Jalview</strong> object defined in\r
+the groovy environent which corresponds to the <pre>jalview.gui.Desktop</pre> object which\r
+manages all the Jalview windows.</p>  \r
+Here's an example to get you started:<br>\r
+<ul><li>Getting the title, alignment and first sequence from the current alignFrame<br>\r
+<pre>\r
+def alf = Jalview.getAlignframes();\r
+print alf[0].getTitle();\r
+def alignment = alf[0].viewport.alignment;\r
+def seq = alignment.getSequenceAt(0);\r
+</pre>\r
+</li>\r
+</ul>\r
+</p>\r
+\r
+<p>&nbsp;</p>\r
+</body>\r
+</html>\r