com.lowagie.tools.plugins
Class AbstractTool

java.lang.Object
  extended by com.lowagie.tools.plugins.AbstractTool
All Implemented Interfaces:
ToolMenuItems, ActionListener, EventListener
Direct Known Subclasses:
Bookmarks2XML, Burst, Concat, Decrypt, DvdCover, Encrypt, ExtractAttachments, Handouts, HtmlBookmarks, InspectPDF, KnitTiff, LPRClient, NUp, PhotoAlbum, RemoveLaunchApplication, ReversePages, SelectedPages, Split, Tiff2Pdf, TreeViewPDF, Txt2Pdf, Watermarker, XML2Bookmarks

public abstract class AbstractTool
extends Object
implements ToolMenuItems, ActionListener

Every iText tool has to implement this interface.


Field Summary
protected  ArrayList arguments
          The list of arguments needed by the tool.
protected  JInternalFrame internalFrame
          The internal frame of the tool.
static int MENU_EXECUTE
          a menu option
static int MENU_EXECUTE_PRINT
          a menu option
static int MENU_EXECUTE_PRINT_SILENT
          a menu option
static int MENU_EXECUTE_SHOW
          a menu option
protected  int menuoptions
          Execute menu options
static ArrayList versionsarray
          An array with the versions of the tool.
 
Fields inherited from interface com.lowagie.tools.ToolMenuItems
ABOUT, ARGUMENTS, CLOSE, EXECUTE, EXECUTEPRINT, EXECUTEPRINTSILENT, EXECUTESHOW, FILE, HELP, TOOL, TOOLS, USAGE, VERSION
 
Constructor Summary
AbstractTool()
           
 
Method Summary
 void actionPerformed(ActionEvent evt)
           
protected static void addVersion(String version)
          Add the version of the plugin to the versions array.
protected abstract  void createFrame()
          Creates the internal frame.
abstract  void execute()
          Executes the tool (in most cases this generates a PDF file).
 String getArgs()
          Gets the current arguments of the tool.
 ArrayList getArguments()
          Gets the arguments.
protected abstract  File getDestPathPDF()
          Gets the PDF file that should be generated (or null if the output isn't a PDF file).
 JInternalFrame getInternalFrame()
          Returns the internal frame.
 JMenuBar getMenubar()
          Gets the menubar.
 String getUsage()
          Gets the usage of the tool.
 Object getValue(String name)
          Gets the value of a given argument.
 void setArguments(ArrayList arguments)
          Sets the arguments.
 void setArguments(String[] args)
          Sets the arguments.
 void setInternalFrame(JInternalFrame internalFrame)
          Sets the internal frame.
abstract  void valueHasChanged(ToolArgument arg)
          Indicates that the value of an argument has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionsarray

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


internalFrame

protected JInternalFrame internalFrame
The internal frame of the tool.


arguments

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


menuoptions

protected int menuoptions
Execute menu options


MENU_EXECUTE

public static final int MENU_EXECUTE
a menu option

See Also:
Constant Field Values

MENU_EXECUTE_SHOW

public static final int MENU_EXECUTE_SHOW
a menu option

See Also:
Constant Field Values

MENU_EXECUTE_PRINT

public static final int MENU_EXECUTE_PRINT
a menu option

See Also:
Constant Field Values

MENU_EXECUTE_PRINT_SILENT

public static final int MENU_EXECUTE_PRINT_SILENT
a menu option

See Also:
Constant Field Values
Constructor Detail

AbstractTool

public AbstractTool()
Method Detail

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.

getArguments

public ArrayList getArguments()
Gets the arguments.

Returns:
Returns the arguments.

getValue

public Object getValue(String name)
                throws InstantiationException
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

setInternalFrame

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

Parameters:
internalFrame - The internalFrame to set.

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.

getArgs

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

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

actionPerformed

public void actionPerformed(ActionEvent evt)
Specified by:
actionPerformed in interface ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

getDestPathPDF

protected abstract File getDestPathPDF()
                                throws InstantiationException
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

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).


valueHasChanged

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

Parameters:
arg - the argument that has changed

addVersion

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

Parameters:
version - the version to add.