Class AbstractPdfProclet
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.transformer.pdfproclet.AbstractPdfProclet
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,PdfProclet
,Serializable
- Direct Known Subclasses:
AbstractMetaPdfProclet
,AbstractPdfProcletWithFilenameOutput
,Circle
,FixedText
,Headline
,Line
,NewPage
,Rectangle
public abstract class AbstractPdfProclet extends AbstractOptionHandler implements PdfProclet
Abstract ancestor for processors that add the content of files to a PDF document.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseRegExp
m_RegExpFilename
the regexp to use on the filename.static String
MATCH_ALL_EXTENSION
the "match-all" file extension.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractPdfProclet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected com.itextpdf.text.pdf.ColumnText
addColumnTextAt(PDFGenerator generator, float x, float y)
Adds the column text to the document at the specified location.protected boolean
addElement(PDFGenerator generator, com.itextpdf.text.Element element)
Adds the element to the document.boolean
canProcess(PDFGenerator generator, File file)
Whether the processor can handle this particular file.abstract boolean
canProcess(PDFGenerator generator, Object obj)
Whether the processor can handle this particular object.void
defineOptions()
Adds options to the internal list of options.protected abstract boolean
doProcess(PDFGenerator generator, File file)
The actual processing of the document.protected abstract boolean
doProcess(PDFGenerator generator, Object obj)
The actual processing of the document.abstract BaseString[]
getExtensions()
Returns the extensions that the processor can process.BaseRegExp
getRegExpFilename()
Returns the regular expression that the filename must match.protected boolean
postProcess(PDFGenerator generator, File file)
For post-processing the document.protected boolean
postProcess(PDFGenerator generator, Object obj)
For post-processing the document.protected boolean
preProcess(PDFGenerator generator, File file)
For pre-processing the document.protected boolean
preProcess(PDFGenerator generator, Object obj)
For pre-processing the document.boolean
process(PDFGenerator generator, File file)
Processes the given file.boolean
process(PDFGenerator generator, Object obj)
Processes the given object.String
regExpFilenameTipText()
Returns the tip text for this property.void
setRegExpFilename(BaseRegExp value)
Sets the regular expression that the filename must match.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
MATCH_ALL_EXTENSION
public static final String MATCH_ALL_EXTENSION
the "match-all" file extension.- See Also:
- Constant Field Values
-
m_RegExpFilename
protected BaseRegExp m_RegExpFilename
the regexp to use on the filename.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setRegExpFilename
public void setRegExpFilename(BaseRegExp value)
Sets the regular expression that the filename must match.- Specified by:
setRegExpFilename
in interfacePdfProclet
- Parameters:
value
- the expression
-
getRegExpFilename
public BaseRegExp getRegExpFilename()
Returns the regular expression that the filename must match.- Specified by:
getRegExpFilename
in interfacePdfProclet
- Returns:
- the expression
-
regExpFilenameTipText
public String regExpFilenameTipText()
Returns the tip text for this property.- Specified by:
regExpFilenameTipText
in interfacePdfProclet
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getExtensions
public abstract BaseString[] getExtensions()
Returns the extensions that the processor can process.- Specified by:
getExtensions
in interfacePdfProclet
- Returns:
- the extensions (no dot)
-
addElement
protected boolean addElement(PDFGenerator generator, com.itextpdf.text.Element element) throws Exception
Adds the element to the document.- Parameters:
generator
- the contextelement
- the element to add- Returns:
- true if successfully added
- Throws:
Exception
- if adding fails
-
addColumnTextAt
protected com.itextpdf.text.pdf.ColumnText addColumnTextAt(PDFGenerator generator, float x, float y) throws Exception
Adds the column text to the document at the specified location. Dimension: x to page width, 0 to y.- Parameters:
generator
- the context- Returns:
- the column text
- Throws:
Exception
- if adding fails
-
preProcess
protected boolean preProcess(PDFGenerator generator, File file) throws Exception
For pre-processing the document.- Parameters:
generator
- the contextfile
- the file to add- Returns:
- true if successfully added
- Throws:
Exception
- if something goes wrong
-
doProcess
protected abstract boolean doProcess(PDFGenerator generator, File file) throws Exception
The actual processing of the document.- Parameters:
generator
- the contextfile
- the file to add- Returns:
- true if successfully added
- Throws:
Exception
- if something goes wrong
-
postProcess
protected boolean postProcess(PDFGenerator generator, File file) throws Exception
For post-processing the document.- Parameters:
generator
- the contextfile
- the file to add- Returns:
- true if successfully added
- Throws:
Exception
- if something goes wrong
-
canProcess
public boolean canProcess(PDFGenerator generator, File file)
Whether the processor can handle this particular file.- Specified by:
canProcess
in interfacePdfProclet
- Parameters:
generator
- the contextfile
- the file to check- Returns:
- true if the file can be handled
-
process
public boolean process(PDFGenerator generator, File file)
Processes the given file.- Specified by:
process
in interfacePdfProclet
- Parameters:
generator
- the contextfile
- the file to add- Returns:
- true if successfully added
-
canProcess
public abstract boolean canProcess(PDFGenerator generator, Object obj)
Whether the processor can handle this particular object.- Specified by:
canProcess
in interfacePdfProclet
- Parameters:
generator
- the contextobj
- the object to check- Returns:
- true if the object can be handled
-
preProcess
protected boolean preProcess(PDFGenerator generator, Object obj) throws Exception
For pre-processing the document.- Parameters:
generator
- the contextobj
- the object to add- Returns:
- true if successfully added
- Throws:
Exception
- if something goes wrong
-
doProcess
protected abstract boolean doProcess(PDFGenerator generator, Object obj) throws Exception
The actual processing of the document.- Parameters:
generator
- the contextobj
- the object to add- Returns:
- true if successfully added
- Throws:
Exception
- if something goes wrong
-
postProcess
protected boolean postProcess(PDFGenerator generator, Object obj) throws Exception
For post-processing the document.- Parameters:
generator
- the contextobj
- the object to add- Returns:
- true if successfully added
- Throws:
Exception
- if something goes wrong
-
process
public boolean process(PDFGenerator generator, Object obj)
Processes the given object.- Specified by:
process
in interfacePdfProclet
- Parameters:
generator
- the contextobj
- the object to process- Returns:
- true if successfully added
-
-