Class LatexSpreadSheetWriter

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.io.EncodingSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, adams.core.Stoppable, adams.core.StoppableWithFeedback, adams.data.io.output.MultiSheetSpreadSheetWriter, adams.data.io.output.SpreadSheetWriter, Serializable

    public class LatexSpreadSheetWriter
    extends adams.data.io.output.AbstractMultiSheetFormattedSpreadSheetWriter
    Generates LaTeX tables from spreadsheets.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -sheet-prefix <java.lang.String> (property: sheetPrefix)
        The prefix for sheet names.
        default: Sheet
     
    -missing <java.lang.String> (property: missingValue)
        The placeholder for missing values.
        default:
     
    -locale <java.util.Locale> (property: locale)
        The locale to use for formatting the numbers.
        default: Default
     
    -number-format <java.lang.String> (property: numberFormat)
        The format for the numbers (see java.text.DecimalFormat), use empty string
        for default 'double' output.
        default:
     
    -header-bold <boolean> (property: headerBold)
        If enabled, the header gets output in bold face.
        default: false
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class adams.data.io.output.AbstractSpreadSheetWriter

        adams.data.io.output.AbstractSpreadSheetWriter.OutputType
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean m_HeaderBold
      whether to make header bold.
      • Fields inherited from class adams.data.io.output.AbstractMultiSheetFormattedSpreadSheetWriter

        m_Formatter, m_Locale, m_NumberFormat
      • Fields inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport

        m_MissingValue
      • Fields inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriter

        m_SheetPrefix
      • Fields inherited from class adams.data.io.output.AbstractSpreadSheetWriter

        m_Encoding, m_Stopped
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void defineOptions()
      Adds options to the internal list of options.
      protected boolean doWrite​(adams.data.spreadsheet.SpreadSheet[] content, Writer writer)
      Performs the actual writing.
      protected String escape​(String s)
      Turns the string into LaTeX-compliant text.
      adams.data.io.input.SpreadSheetReader getCorrespondingReader()
      Returns, if available, the corresponding reader.
      String getFormatDescription()
      Returns a string describing the format (used in the file chooser).
      String[] getFormatExtensions()
      Returns the extension(s) of the format.
      boolean getHeaderBold()
      Returns whether to make the header bold.
      protected adams.data.io.output.AbstractSpreadSheetWriter.OutputType getOutputType()
      Returns how the data is written.
      String globalInfo()
      Returns a string describing the object.
      String headerBoldTipText()
      Returns the tip text for this property.
      void setHeaderBold​(boolean value)
      Sets whether to make the header bold.
      • Methods inherited from class adams.data.io.output.AbstractMultiSheetFormattedSpreadSheetWriter

        format, getDefaultNumberFormat, getLocale, getNumberFormat, localeTipText, numberFormatTipText, setLocale, setNumberFormat
      • Methods inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriterWithMissingValueSupport

        getDefaultMissingValue, getMissingValue, missingValueTipText, setMissingValue
      • Methods inherited from class adams.data.io.output.AbstractMultiSheetSpreadSheetWriter

        canWriteMultiple, doWrite, doWrite, doWrite, doWrite, getDefaultSheetPrefix, getSheetPrefix, setSheetPrefix, sheetPrefixTipText, write, write, write, write
      • Methods inherited from class adams.data.io.output.AbstractSpreadSheetWriter

        canCompress, doWrite, encodingTipText, getAdditionalInformation, getDefaultFormatExtension, getEncoding, getWriters, initialize, isStopped, preWriteFile, reset, setEncoding, stopExecution, supportsCompressedOutput, write, write, write, write
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • 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
      • Methods inherited from interface adams.data.io.output.SpreadSheetWriter

        reset, write, write, write, write
      • Methods inherited from interface adams.core.Stoppable

        stopExecution
      • Methods inherited from interface adams.core.StoppableWithFeedback

        isStopped
    • Field Detail

      • m_HeaderBold

        protected boolean m_HeaderBold
        whether to make header bold.
    • Constructor Detail

      • LatexSpreadSheetWriter

        public LatexSpreadSheetWriter()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.data.io.output.AbstractMultiSheetFormattedSpreadSheetWriter
      • setHeaderBold

        public void setHeaderBold​(boolean value)
        Sets whether to make the header bold.
        Parameters:
        value - true if bold
      • getHeaderBold

        public boolean getHeaderBold()
        Returns whether to make the header bold.
        Returns:
        true if bold
      • headerBoldTipText

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

        public String getFormatDescription()
        Returns a string describing the format (used in the file chooser).
        Specified by:
        getFormatDescription in interface adams.data.io.output.SpreadSheetWriter
        Specified by:
        getFormatDescription in class adams.data.io.output.AbstractSpreadSheetWriter
        Returns:
        a description suitable for displaying in the file chooser
      • getFormatExtensions

        public String[] getFormatExtensions()
        Returns the extension(s) of the format.
        Specified by:
        getFormatExtensions in interface adams.data.io.output.SpreadSheetWriter
        Specified by:
        getFormatExtensions in class adams.data.io.output.AbstractSpreadSheetWriter
        Returns:
        the extension (without the dot!)
      • getCorrespondingReader

        public adams.data.io.input.SpreadSheetReader getCorrespondingReader()
        Returns, if available, the corresponding reader.
        Returns:
        the reader, null if none available
      • getOutputType

        protected adams.data.io.output.AbstractSpreadSheetWriter.OutputType getOutputType()
        Returns how the data is written.
        Specified by:
        getOutputType in class adams.data.io.output.AbstractSpreadSheetWriter
        Returns:
        the type
      • escape

        protected String escape​(String s)
        Turns the string into LaTeX-compliant text.
        Parameters:
        s - the string to process
        Returns:
        the processed string
      • doWrite

        protected boolean doWrite​(adams.data.spreadsheet.SpreadSheet[] content,
                                  Writer writer)
        Performs the actual writing. The caller must ensure that the writer gets closed.
        Overrides:
        doWrite in class adams.data.io.output.AbstractMultiSheetSpreadSheetWriter
        Parameters:
        content - the spreadsheets to write
        writer - the writer to write the spreadsheet to
        Returns:
        true if successfully written