Package com.lowagie.toolbox
Class AbstractTool
- java.lang.Object
-
- com.lowagie.toolbox.AbstractTool
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.util.EventListener
- Direct Known Subclasses:
Add3D
,Bookmarks2XML
,Burst
,CompressDecompressPageContent
,Concat
,ConcatN
,Decrypt
,Divide
,DvdCover
,Encrypt
,ExtractAttachments
,Handouts
,HtmlBookmarks
,ImageXRefViewer
,InspectPDF
,Normalize
,NUp
,PhotoAlbum
,RemoveLaunchApplication
,ReversePages
,SelectedPages
,Split
,Txt2Pdf
,WatermarkerTool
,XML2Bookmarks
public abstract class AbstractTool extends java.lang.Object implements java.awt.event.ActionListener
Every iText tool has to extend this abstract class.- Since:
- 2.1.1 (imported from itexttoolbox project)
- Version:
- $Id: AbstractTool.java 3276 2008-04-19 00:32:58Z xlv $
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList<AbstractArgument>
arguments
The list of arguments needed by the tool.private java.awt.Desktop
awtdesktop
awtdesktopprotected javax.swing.JInternalFrame
internalFrame
The internal frame of the tool.static int
MENU_EXECUTE
a menu optionstatic int
MENU_EXECUTE_PRINT
a menu optionstatic int
MENU_EXECUTE_PRINT_SILENT
a menu optionstatic int
MENU_EXECUTE_SHOW
a menu optionprivate javax.swing.JMenuBar
menubar
protected int
menuoptions
Execute menu optionsstatic java.util.ArrayList<java.lang.String>
versionsarray
An array with the plugin_versions of the tool.
-
Constructor Summary
Constructors Constructor Description AbstractTool()
AbstractTool
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent evt)
protected static void
addVersion(java.lang.String version)
Add the version of the plugin to the plugin_versions array.protected abstract void
createFrame()
Creates the internal frame.abstract void
execute()
Executes the tool (in most cases this generates a PDF file).private java.lang.String
getArgs()
Gets the current arguments of the tool.java.util.ArrayList<AbstractArgument>
getArguments()
Gets the arguments.protected abstract java.io.File
getDestPathPDF()
Gets the PDF file that should be generated (or null if the output isn't a PDF file).javax.swing.JInternalFrame
getInternalFrame()
Returns the internal frame.javax.swing.JMenuBar
getMenubar()
Gets the menubar.java.lang.String
getUsage()
Gets the usage of the tool.java.lang.Object
getValue(java.lang.String name)
Gets the value of a given argument.void
setArguments(java.util.ArrayList<AbstractArgument> arguments)
Sets the arguments.void
setInternalFrame(javax.swing.JInternalFrame internalFrame)
Sets the internal frame.void
setMainArguments(java.lang.String[] args)
Sets the arguments.void
setMenubar(javax.swing.JMenuBar menubar)
abstract void
valueHasChanged(AbstractArgument arg)
Indicates that the value of an argument has changed.
-
-
-
Field Detail
-
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
-
versionsarray
public static java.util.ArrayList<java.lang.String> versionsarray
An array with the plugin_versions of the tool.
-
internalFrame
protected javax.swing.JInternalFrame internalFrame
The internal frame of the tool.
-
arguments
protected java.util.ArrayList<AbstractArgument> arguments
The list of arguments needed by the tool.
-
menuoptions
protected int menuoptions
Execute menu options
-
awtdesktop
private java.awt.Desktop awtdesktop
awtdesktop
-
menubar
private javax.swing.JMenuBar menubar
-
-
Method Detail
-
addVersion
protected static void addVersion(java.lang.String version)
Add the version of the plugin to the plugin_versions array.- Parameters:
version
- the version to add.
-
setMainArguments
public void setMainArguments(java.lang.String[] args)
Sets the arguments.- Parameters:
args
- the arguments as String-array.
-
getArguments
public java.util.ArrayList<AbstractArgument> getArguments()
Gets the arguments.- Returns:
- Returns the arguments.
-
setArguments
public void setArguments(java.util.ArrayList<AbstractArgument> arguments)
Sets the arguments.- Parameters:
arguments
- The arguments to set.
-
getValue
public java.lang.Object getValue(java.lang.String name) throws java.lang.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:
java.lang.InstantiationException
- on error
-
getInternalFrame
public javax.swing.JInternalFrame getInternalFrame()
Returns the internal frame. Creates one if it's null.- Returns:
- Returns the internalFrame.
-
setInternalFrame
public void setInternalFrame(javax.swing.JInternalFrame internalFrame)
Sets the internal frame.- Parameters:
internalFrame
- The internalFrame to set.
-
getMenubar
public javax.swing.JMenuBar getMenubar()
Gets the menubar.- Returns:
- a menubar for this tool
-
setMenubar
public void setMenubar(javax.swing.JMenuBar menubar)
-
getUsage
public java.lang.String getUsage()
Gets the usage of the tool.- Returns:
- a String describing how to use the tool.
-
getArgs
private java.lang.String getArgs()
Gets the current arguments of the tool.- Returns:
- a String with the list of arguments and their values.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Parameters:
evt
- ActionEvent- See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)
-
getDestPathPDF
protected abstract java.io.File getDestPathPDF() throws java.lang.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:
java.lang.InstantiationException
- on error
-
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(AbstractArgument arg)
Indicates that the value of an argument has changed.- Parameters:
arg
- the argument that has changed
-
-