com.lowagie.tools.plugins

Class AbstractTool

public abstract class AbstractTool extends Object implements ToolMenuItems, ActionListener

Every iText tool has to implement this interface.
Field Summary
protected ArrayListarguments
The list of arguments needed by the tool.
protected JInternalFrameinternalFrame
The internal frame of the tool.
protected intmenuoptions
Execute menu options
static intMENU_EXECUTE
a menu option
static intMENU_EXECUTE_PRINT
a menu option
static intMENU_EXECUTE_PRINT_SILENT
a menu option
static intMENU_EXECUTE_SHOW
a menu option
static ArrayListversionsarray
An array with the versions of the tool.
Method Summary
voidactionPerformed(ActionEvent evt)
protected static voidaddVersion(String version)
Add the version of the plugin to the versions array.
protected abstract voidcreateFrame()
Creates the internal frame.
abstract voidexecute()
Executes the tool (in most cases this generates a PDF file).
StringgetArgs()
Gets the current arguments of the tool.
ArrayListgetArguments()
Gets the arguments.
protected abstract FilegetDestPathPDF()
Gets the PDF file that should be generated (or null if the output isn't a PDF file).
JInternalFramegetInternalFrame()
Returns the internal frame.
JMenuBargetMenubar()
Gets the menubar.
StringgetUsage()
Gets the usage of the tool.
ObjectgetValue(String name)
Gets the value of a given argument.
voidsetArguments(ArrayList arguments)
Sets the arguments.
voidsetArguments(String[] args)
Sets the arguments.
voidsetInternalFrame(JInternalFrame internalFrame)
Sets the internal frame.
abstract voidvalueHasChanged(ToolArgument arg)
Indicates that the value of an argument has changed.

Field Detail

arguments

protected ArrayList arguments
The list of arguments needed by the tool.

internalFrame

protected JInternalFrame internalFrame
The internal frame of the tool.

menuoptions

protected int menuoptions
Execute menu options

MENU_EXECUTE

public static final int MENU_EXECUTE
a menu option

MENU_EXECUTE_PRINT

public static final int MENU_EXECUTE_PRINT
a menu option

MENU_EXECUTE_PRINT_SILENT

public static final int MENU_EXECUTE_PRINT_SILENT
a menu option

MENU_EXECUTE_SHOW

public static final int MENU_EXECUTE_SHOW
a menu option

versionsarray

public static ArrayList versionsarray
An array with the versions of the tool.

Method Detail

actionPerformed

public void actionPerformed(ActionEvent evt)

See Also: java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)

addVersion

protected static void addVersion(String version)
Add the version of the plugin to the versions array.

Parameters: version the version to add.

createFrame

protected abstract void createFrame()
Creates the internal frame.

execute

public abstract void execute()
Executes the tool (in most cases this generates a PDF file).

getArgs

public String getArgs()
Gets the current arguments of the tool.

Returns: a String with the list of arguments and their values.

getArguments

public ArrayList getArguments()
Gets the arguments.

Returns: Returns the arguments.

getDestPathPDF

protected abstract File getDestPathPDF()
Gets the PDF file that should be generated (or null if the output isn't a PDF file).

Returns: the PDF file that should be generated

Throws: InstantiationException

getInternalFrame

public JInternalFrame getInternalFrame()
Returns the internal frame. Creates one if it's null.

Returns: Returns the internalFrame.

getMenubar

public JMenuBar getMenubar()
Gets the menubar.

Returns: a menubar for this tool

getUsage

public String getUsage()
Gets the usage of the tool.

Returns: a String describing how to use the tool.

getValue

public Object getValue(String name)
Gets the value of a given argument.

Parameters: name the name of the argument

Returns: the value of an argument as an Object.

Throws: InstantiationException

setArguments

public void setArguments(ArrayList arguments)
Sets the arguments.

Parameters: arguments The arguments to set.

setArguments

public void setArguments(String[] args)
Sets the arguments.

Parameters: args the arguments as String-array.

setInternalFrame

public void setInternalFrame(JInternalFrame internalFrame)
Sets the internal frame.

Parameters: internalFrame The internalFrame to set.

valueHasChanged

public abstract void valueHasChanged(ToolArgument arg)
Indicates that the value of an argument has changed.

Parameters: arg the argument that has changed