
The best way to get started coding with fiswidgets is to look at the
example code and take off from there. These notes are very sparse and
will be expanded as we get more user feedback.
The fiswidgets API is designed to be very, very easy to code with. (You
have traded flexibility and breadth for ease and speed.).
To program with fiswidgets, you really should have some experience coding
in C, C++, or Java.
If you haven't coded in Java before, but at least have an idea of how object
oriented coding works, you may be able to extrapolate from the example code
and your C, C++ knowledge successfully. We strongly recommend the "JAVA in
a Nutshell", by David Flanagan, O'Reilly series book as a reference if you haven't
used Java before.
Once the external call has been spawned, or Java code is done,
or the new Java object has been instantiated, the run() method
simply returns.
The fiswidget components use the Swing components, so you
need to install Swing (aka JFC, Java Foundation Classes) on any machine that
uses fiswidgets. You should not have to worry about that since Swing comes
with the JDK for Java versions 1.2 and higher.
You also need to have the fiswidgets-system and fiswidgets-all jar files in your CLASSPATH. For example,
if you have installed fiswidgets in /usr/local/pkg/fiswidgets, you need to
add /usr/local/pkg/fiswidgets/fiswidgets-system.jar and
/usr/local/pkg/fiswidgets/fiswidgets-all.jar to your path.
Finally, since you are creating a new Java class (your fiswidget) in the
current directory, you will need to add the current working directory (.)
to your CLASSPATH.
In order to run the Java compiler (javac) and the Java interpreter,
(java), you need to add the Java bin directory (usually /usr/java/bin)
for your site to your path.
So, the instructions to set up your environment, compile your fiswidget,
and run it might look like:
To write a fiswidget application
You need to write 2 Java classes (ie
2 "programs"). First, you write a FisBase class. This is the program
where you specify all the widgets that will appear in the GUI.
Then, you write a FisRunManager class. This is the program where you
specify what happens when the user clicks on the RUN button.
There are 2 methods in this class:
this is the constructor function. There are some standard calls, such
as super(), activateRunButton(), and display() that must be made (see
Hello1.java). Then, each widget that will appear in the GUI is
constructed; the call to the constructor will automatically add the
widget to the GUI.
just copy this main function as is from the example code. It
would only change if you wanted to pass parameters to a fiswidget
application from the command line.
There are 2 methods in this class:
this is the constructor function. It takes the associated FisBase
object as a parameter. You can copy this method from the example
code as is, it doesn't change.
This is where you have to do all your work. Whatever happens
when RUN is clicked, happens here. Typically, this method will
pull all the information out of the fields in the FisBase class,
(it can do that because the FisBase class is passed as a parameter
to the constructor), to determine what selections the user has
made. Then, some sanity checking of those selections may be
performed using the standard Java language calls. For example,
if the user has specified an output file, the Java io package
File.exists() call can be used to check if the file already
exists. Then, typically, one of three things is done:
To compile and run a fiswidget application
You need to have both the Fiswidget classes in your CLASSPATH.
set path = ($path /usr/java/bin)
setenv CLASSPATH /usr/local/pkg/fiswidgets/fiswidgets-system.jar:/usr/local/pkg/fiswidgets/fiswidgets-all.jar:.
javac MyApp.java MyAppRun.java
java MyApp