Client / Server Conversion Howto (version 1.0)
The document describes some of the details into taking a current Fiswidgets wrapper program and converting it into one that is client / server capable.
The document assumes that the wrapper is compliant with the standards in the FisWidgets programming guide.
Please keep in mind that this is a work in progress and that not all issues have been addressed yet.
If there are any problems or find mistakes in this document, please send an email to cunninghamd@msx.upmc.edu.
To summarize the process, the getGUIdata method from the FisRunManager must be moved to the FisBase class.
Also, a class extending FisParameters must be created to pass information from the FisBase to the FisRunManager.
Do the following in the FisBase derived front end.
- Replace activateRunButton method of the FisBase.
The change that needs to be made is that the instance of the FisRunManager needs to be replaced with a String containing the name of the class.
Look at this example code to figure out what is going on.
Please note the the activateRunButton method may be inside of a common setup routine if your package has one (e.g Afni).
- Add the line import fiswidgets.fisremote.*; to the top of the java file.
Please see this example if this is unclear.
- Add the line setClientServerCapable(true); right after the call to super(); in the constructor.
Please look at this example code to figure out where to place the line.
-
Create a class that extends FisParameters.
Here are the steps to make the class.
- Create a class which extends FisParameters to store GUI information needed by the backend.
Please put this class in the same file as the FisBase class.
Go here to see an example.
- Move the variables corresponding to GUI information to the FisParameters class from the FisRunManager class.
Look at this code snippet before c/s conversion and the corresponding FisParameters object to understand what is to be moved.
- Please make sure that the class contains only serializable data.
- Move getGUIdata() from FisRemoteManager to FisBase and convert the method.
To convert the method the following will have to be done:
- Make the getGUIdata return a FisParameters object instead of void.
- In first line of getGUIdata, create an instance of the derived FisParameters object.
- In last line of getGUIdata, return the instance of the derived FisParameters object.
- In the code in the middle, remove the FisBase reference that came from the FisRunManager and reference the variables in the FisParameters object.
To understand this better, here is an example getGUIdata method from Afni3dinfo.
- Remove any remaining instances of the FisRunManager.
Do the following in FisRunManager derived back end.
- Modify the constructor to take a FisParameters as input.
Look at the example to understand this change.
- Move getGUIdata() from FisRemoteManager to FisBase and convert the method.
Please look at step #4 in the FisBase to find out how to do this.
- Remove the getGUIdata call in the run method.
This is a comparison of an example run method before and after conversion.
- Reference variables that are part of the FisParameters object.
This usually involves putting params. in front of all of the GUI related variables.
Look a this example to understand.
- Modify all Dialogs methods calls to use FisRunManager instead off FisBase.
This usually involves replacing name of the first parameter of the method call with this.
Look at an example to clarify this step.
- Remove any remaining instances of the FisBase.