The Template Tree Window
s
Templates
The function templates define the
structure of the functions and are used to build functions. Function templatesdon't belong to
projects, but to the machine: every machine that runs a Matrex desktop
or, from version 2.0, a Matrex server application has a set of templates.
Even if it should be seldom needed, you can add or change function templates
(also remove them). You can build your own library of templates and, if you
like, share it with others. Templates are composed by:
- The template definition, a structure defining which
input matrices, output matrices and parameters the function needs to
work. We say that a template contains the input matrices, the output
matrices and the parameter
definitions: how they are called
in the template, the types of them and if they are mandatory or optional.
In other words definitions are used to show which matrices or parameters
are expected when a function is built from a template and to verify that
matrices and parameters are correct.
- The code that has to be executed to produce the output matrices
when the function is recalculated. This can either be written:
- in Java and compiled as a class. In this case, the class or
the jar library that contains the code need to be added to the
plugins class path of s Matrex.
- using a script language.
Matrex already allows to write template code using Jython. In
this case you can load the script file in the application and
associate it directly with the template.
The locations (directories and jar files) for templates definitions, code
and script languages can be defined using the files locations dialog.
The template tree window contains:
- on the left side, a tree
showing all the available templates.
- on the right side, the complete description of the currently selected
template.
As with the other trees, if you know at least a part of the name-package of
the template, just write it on the search
bar on the top of the templates tree and either press�enter or click
on the green arrow button. The first template matching the text in the search
bar gets visualized and selected. Pressing again enter or clicking on the
green arrow button selects the next matching template, and so on.
The tree's popup menu
Clicking with the right mouse button on an item in the Function
templates tree, a popup menu appears. With it you can:
Add a template
The menu item New template opens the template editor, used to add templates.
Edit a template
Edit the selected item with the Edit Template menu. The template editor opens, with the entered input
and output matrices definitions and parameter definitions in place. You can
change them and save the template again.
Remove a template
Remove the selected item with the Remove Template menu.
This is a very risky operation, because there can be functions in some
projects that are built on that template and will not work again when the
template is removed. Therefore it is requested to confirm.
Rename a template
Rename the selected item with the Rename Template menu. This is a very
risky operation, because there can be functions in some projects that are
built on that template and will not work again when the template changes its
name. Therefore a confirmation is requested.
After you confirmed the choice, you can rename the template using the name-package dialog. The template is
renamed, both in the template tree view and as file.
There is no view menu, because it does not make sense (at least in version
1.x) to view a template.
The template tree top menu
The menu on the top of the template tree has the expand and collapse choices like the other trees, but
it has two more choices:
Search a template
You can do a full text search on the
templates descriptions. In the top
menu select the Search menu and search the template with the template search dialog that appears.
Build an HTML page listing all templates
In the top menu select the Build HTML Page menu.
This will save an HTML page with all the templates, their description,
matrices and parameter definitions in the file that you choose.