![]()
How to integrate your algorithm
A description how to install a
module is available at the main
page of the ASV Toolbox project.
The line you have to copy into the toolbox.start file looks like this:
de.uni_leipzig.asv.toolbox.yourTool.YourTool
Your Tool show you how you
are able to integrate your own algorithm as module in the ASV Toolbox.
There already existing 4
classes in the package de.uni_leipzig.asv.toolbox.yourTool.
The ASV Toolbox framework
will create an instance of this class. For it is necessary that it is extended
from ToolboxModule.
So you have to implement
some methods of this class.
·
activated():
implement what is to do if your tool is chosen by the user. In the most cases
it is enough to call the repaint() method.
·
getIcon():
This method should return the Icon of your Tool. Use createImageIcon(<path to your icon image
file>) to create the Icon-Object.
·
getMnemonic():
return the mnemonic as char of your tool(how about the first char of the name?)
·
getModulePanel():
returns the actual instance of your module panel. In the most cases it should return
this.
·
getName():
method to get the name of your tool
·
getToolTip():method
to get the tool tip of your tool as string, shoulb be short and concise
·
YourTool(Toolbox
toolbox): constructor of your module panel. Please call super(toolbox).This will create a panel with the right dimension.
In YourTool. java you will
find the init() method. Here the tabbed panel are created. So take a look at
the code.
This is the class
representing the welcome panel of your tool. You should change the information
presented on it.
Here a short list with
information you should change:
·
name
of your tool, a short description and the actual version of your tool(you will
find all in line 30-33)
·
path
to the documentation of your tool(you will be find it on line 48)
·
names
of the author of the tool(you will find it on line 64)
Here the database
connectivity could be entered. there are already all fields for the database
connection and the combo boxes for a table and a column. If you need more
tables and columns for your algorithm you have to do :
1.
Add
JComboBoxes for them to the panel(and JLabel for the description).
For
tables: Add DatabasePanel as action listener and action command to the
JComboBox(needed to update the combo boxes for the columns belonging to the
table).
2.
In the connect method delete all items from the
JComboBoxes at the beginning.
3.
For
tables: in loadTables() add all keys from the hash map databaseinfo as items to
the JComboBox. Try to set the table which is specified in the property file at
the end of this method.
For columns: write one method for all columns of a table where you add to the
JComboBox all values you find in the hash map databaseinfo for the currently
selected item in the JcomboBox for the table of these columns. Try to set the
columns which are specified in the property file at the end of this method.
This method should also be called in the action performed method in the case of
an action event belonging to the table.
4.
Write
methods that return the currently selected items of the JComboBoxes and save
them in the property file of your tool.
Here you can add all
components which the user will need to use your algorithm.
Create components and add
them to the main panel in the init() method. The main panel also implements the
interface ActionListener, so use them as action listener placed on the main
panel. The functionality should be implemented in the actionPerformed() method.