Support | Links

Miscallaneous

Mathematical Functions

In the source generator panel, the expression parser takes in account user-defined functions. To introduce a new function of your own, simply define it as a static public function taking some numeric argument(s) and returning another numeric argument.

Example :

public static double plus(double a, double b) { return a+b; }


Type conversions and parameter checking will be done by the system. Overloading functions is possible, too, though not recommended. Efforts were made so that user-defined function overloading works in the expression parser the same way as Java overloading, but this was not thoroughly tested.

In addition to the plugins, the java.lang.Math class is also used in this way. Thus, all public static functions in java.lang.Math are available in the expression parser.

Note : Hyperbolic trigonometric functions (tanh...) are introduced in Java 1.5. Thus, running JSynoptic on a version 1.5 JVM should make these functions available.


Index of contents

Translating the plugin

JSynoptic uses the Java mechanism for loading localized resources. See the Javadoc for java.util.ResourceBundle for more information on Java localization.

In the simtools help library, two classes were created to extend the Java ResourceBundle. Using them is not at all mandatory, but you may find them handy. Those classes are MenuResourceBundle and StringsResourceBundle, in the simtools.ui package. The main advantage of using them is to be consistent with the rest of JSynoptic.

Also, to reduce the code you have to write with the standard Java API, there is a utility class in JSynoptic, simtools.ui.ResourceFinder, that helps find and create resource objects. It works by looking for a resource named after the class passed as argument, in a sub-package named 'resources'. So, just adding a line at the beginning of your class, and putting the localized versions of the resources in this package, and you're done with it.

See any class in JSynoptic using resources for more information, for example the look and feel plugin.


Index of contents

Development and deployment process

To develop a plugin for JSynoptic, the easiest way is to download the JSynoptic source code. A jar file is provided in the package as a commodity, so you won't have to re-compile JSynoptic yourself.

You can develop the plugin in the environment of your choice. For users not using the Eclipse IDE already, there is a little FAQ in the source directory to set up such an environment. Eclipse is easy, and really handy!

Deployment process is very simple : just copy a compiled version of your plugin (jar file or directory containing the .class files) in the plugins subdirectory where JSynoptic was installed.

It is also possible to create a dedicated subdirectory for your plugin at this location, and put jar files and class directories inside it. The JFreeChart and Look & Feel plugins are deployed this way by the installer, and yu may refer to those examples if you wish.

On Linux, the plugins directory would be in /usr/local/lib/jsynoptic by default, and on Windows in C:\JSynoptic\plugins. Starting with JSynoptic 0.8, the .jsynoptic directory in the user $HOME is also taken in account in the search for plugins. This is done in the same way as describe above as for the system path. This works well on Linux and probably all Unix systems, and this should work for Windows too, though the $HOME there is not really user-friendly...


Index of contents