Class FixedText

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, SizeOfHandler, PdfProclet, PdfProcletWithAbsolutePosition, PdfProcletWithOptionalAbsolutePosition, PdfProcletWithPageBreaks, PdfProcletWithVariableFileExtension, Serializable

    public class FixedText
    extends AbstractPdfProclet
    implements PdfProcletWithPageBreaks, PdfProcletWithVariableFileExtension, PdfProcletWithOptionalAbsolutePosition
    Adds the fixed text line by line, variables get expanded automatically.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -regexp-filename <adams.core.base.BaseRegExp> (property: regExpFilename)
        The regular expression that the filename must match.
        default: .*
        more: https://docs.oracle.com/javase/tutorial/essential/regex/
        https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
     
    -text-content <adams.core.base.BaseText> (property: textContent)
        The content to insert; variables get expanded automatically.
        default:
     
    -page-break-before <boolean> (property: pageBreakBefore)
        If true, then a page-break is added before the content of the file is inserted.
        default: false
     
    -page-break-after <boolean> (property: pageBreakAfter)
        If true, then a page-break is added after the content of the file is inserted.
        default: false
     
    -num-files <int> (property: numFilesPerPage)
        The number of files to put on a page before adding an automatic page break;
         use -1 for unlimited.
        default: -1
        minimum: -1
     
    -font-content <adams.core.io.PdfFont> (property: fontContent)
        The font to use for the file content.
        default: Helvetica-Normal-12
     
    -color-content <java.awt.Color> (property: colorContent)
        The color to use for the content.
        default: #000000
     
    -extension <adams.core.base.BaseString> [-extension ...] (property: extensions)
        The file extension(s) that the processor will be used for.
        default: txt
     
    -use-absolute-position <boolean> (property: useAbsolutePosition)
        If enabled, the absolute position is used (from bottom-left corner).
        default: false
     
    -x <float> (property: X)
        The absolute X position.
        default: 0.0
        minimum: 0.0
     
    -y <float> (property: Y)
        The absolute Y position.
        default: 0.0
        minimum: 0.0
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_TextContent

        protected BaseText m_TextContent
        the content to add.
      • m_PageBreakBefore

        protected boolean m_PageBreakBefore
        whether to add a page-break before adding the file.
      • m_PageBreakAfter

        protected boolean m_PageBreakAfter
        whether to add a page-break after adding the file.
      • m_NumFilesPerPage

        protected int m_NumFilesPerPage
        the number of files per page.
      • m_FontContent

        protected PdfFont m_FontContent
        the font for the content.
      • m_ColorContent

        protected Color m_ColorContent
        the color for the content.
      • m_Extensions

        protected BaseString[] m_Extensions
        the file extensions.
      • m_UseAbsolutePosition

        protected boolean m_UseAbsolutePosition
        whether to use absolute position.
      • m_X

        protected float m_X
        the absolute X position.
      • m_Y

        protected float m_Y
        the absolute Y position.
    • Constructor Detail

      • FixedText

        public FixedText()
    • Method Detail

      • setTextContent

        public void setTextContent​(BaseText value)
        Sets the text to insert (variables get expanded automatically).
        Parameters:
        value - the content
      • getTextContent

        public BaseText getTextContent()
        Returns the text to insert (variables get expanded automatically).
        Returns:
        the content
      • textContentTipText

        public String textContentTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPageBreakBefore

        public void setPageBreakBefore​(boolean value)
        Whether to add a page break before the file is inserted.
        Specified by:
        setPageBreakBefore in interface PdfProcletWithPageBreaks
        Parameters:
        value - if true then a page-break is added before the file is inserted
      • getPageBreakBefore

        public boolean getPageBreakBefore()
        Returns whether a page break is added before the file is inserted.
        Specified by:
        getPageBreakBefore in interface PdfProcletWithPageBreaks
        Returns:
        true if a page break is added before the file is inserted
      • pageBreakBeforeTipText

        public String pageBreakBeforeTipText()
        Returns the tip text for this property.
        Specified by:
        pageBreakBeforeTipText in interface PdfProcletWithPageBreaks
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPageBreakAfter

        public void setPageBreakAfter​(boolean value)
        Whether to add a page break after the file is inserted.
        Specified by:
        setPageBreakAfter in interface PdfProcletWithPageBreaks
        Parameters:
        value - if true then a page-break is added after the file is inserted
      • getPageBreakAfter

        public boolean getPageBreakAfter()
        Returns whether a page break is added after the file is inserted.
        Specified by:
        getPageBreakAfter in interface PdfProcletWithPageBreaks
        Returns:
        true if a page break is added after the file is inserted
      • pageBreakAfterTipText

        public String pageBreakAfterTipText()
        Returns the tip text for this property.
        Specified by:
        pageBreakAfterTipText in interface PdfProcletWithPageBreaks
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setNumFilesPerPage

        public void setNumFilesPerPage​(int value)
        Sets the number of files per page.
        Specified by:
        setNumFilesPerPage in interface PdfProcletWithPageBreaks
        Parameters:
        value - the number of files
      • numFilesPerPageTipText

        public String numFilesPerPageTipText()
        Returns the tip text for this property.
        Specified by:
        numFilesPerPageTipText in interface PdfProcletWithPageBreaks
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setFontContent

        public void setFontContent​(PdfFont value)
        Sets the font to use for adding the content.
        Parameters:
        value - the font
      • getFontContent

        public PdfFont getFontContent()
        Returns the font to use for adding the content.
        Returns:
        the font
      • fontContentTipText

        public String fontContentTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setColorContent

        public void setColorContent​(Color value)
        Sets the color to use for the content.
        Parameters:
        value - the color
      • getColorContent

        public Color getColorContent()
        Returns the color to use for the content.
        Returns:
        the color
      • colorContentTipText

        public String colorContentTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • doProcess

        protected boolean doProcess​(PDFGenerator generator,
                                    List<String> paragraphs)
                             throws Exception
        The actual processing of the document.
        Parameters:
        generator - the context
        paragraphs - the paragraphs to add
        Returns:
        true if successfully added
        Throws:
        Exception - if something goes wrong
      • insertContent

        protected boolean insertContent​(PDFGenerator generator)
                                 throws Exception
        Inserts the text content (after expanding the variables).
        Parameters:
        generator - the context
        Returns:
        true if successfully added
        Throws:
        Exception - if something goes wrong
      • doProcess

        protected boolean doProcess​(PDFGenerator generator,
                                    File file)
                             throws Exception
        The actual processing of the document.
        Specified by:
        doProcess in class AbstractPdfProclet
        Parameters:
        generator - the context
        file - the file to add
        Returns:
        true if successfully added
        Throws:
        Exception - if something goes wrong
      • canProcess

        public boolean canProcess​(PDFGenerator generator,
                                  Object obj)
        Whether the processor can handle this particular object.
        Specified by:
        canProcess in interface PdfProclet
        Specified by:
        canProcess in class AbstractPdfProclet
        Parameters:
        generator - the context
        obj - the object to check
        Returns:
        true if the object can be handled
      • doProcess

        protected boolean doProcess​(PDFGenerator generator,
                                    Object obj)
                             throws Exception
        The actual processing of the document.
        Specified by:
        doProcess in class AbstractPdfProclet
        Parameters:
        generator - the context
        obj - the object to add
        Returns:
        true if successfully added
        Throws:
        Exception - if something goes wrong