Class PlainTextHandler

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, SizeOfHandler, ContentHandler, ObjectContentHandler, Serializable

    public class PlainTextHandler
    extends AbstractObjectContentHandler
    Displays the following plain text file types: *

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
        min-user-mode: Expert
     
    -tab-size <int> (property: tabSize)
        The number of characters to use for a tab.
        default: 8
        minimum: 0
     
    -line-wrap <boolean> (property: lineWrap)
        Whether to wrap lines or not.
        default: false
     
    -wrap-style-word <boolean> (property: wrapStyleWord)
        Whether to wrap lines at word boundaries or characters.
        default: true
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_TabSize

        protected int m_TabSize
        the tab size.
      • m_LineWrap

        protected boolean m_LineWrap
        whether to perform line wrap.
      • m_WrapStyleWord

        protected boolean m_WrapStyleWord
        whether to wrap word style.
    • Constructor Detail

      • PlainTextHandler

        public PlainTextHandler()
    • Method Detail

      • setTabSize

        public void setTabSize​(int value)
        Sets the tab size, i.e., the number of maximum width characters.
        Parameters:
        value - the number of maximum width chars
      • getTabSize

        public int getTabSize()
        Returns the tab size, i.e., the number of maximum width characters.
        Returns:
        the number of maximum width chars
      • tabSizeTipText

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

        public void setLineWrap​(boolean value)
        Enables/disables line wrap.
        Parameters:
        value - if true line wrap gets enabled
      • getLineWrap

        public boolean getLineWrap()
        Returns whether line wrap is enabled.
        Returns:
        true if line wrap enabled
      • lineWrapTipText

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

        public void setWrapStyleWord​(boolean word)
        Sets the style of wrapping used if the text area is wrapping lines. If set to true the lines will be wrapped at word boundaries (whitespace) if they are too long to fit within the allocated width. If set to false, the lines will be wrapped at character boundaries. By default this property is false.
        Parameters:
        word - indicates if word boundaries should be used for line wrapping
        See Also:
        getWrapStyleWord()
      • getWrapStyleWord

        public boolean getWrapStyleWord()
        Gets the style of wrapping used if the text area is wrapping lines. If set to true the lines will be wrapped at word boundaries (ie whitespace) if they are too long to fit within the allocated width. If set to false, the lines will be wrapped at character boundaries.
        Returns:
        if the wrap style should be word boundaries instead of character boundaries
        See Also:
        setWrapStyleWord(boolean)
      • wrapStyleWordTipText

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

        public String[] getExtensions()
        Returns the list of extensions (without dot) that this handler can take care of.
        Returns:
        the list of extensions (no dot)
      • canHandle

        public boolean canHandle​(Class cls)
        Checks whether the class is handled by this content handler.
        Parameters:
        cls - the class to check
        Returns:
        true if handled
      • createPreview

        public PreviewPanel createPreview​(Object obj)
        Creates the actual preview.
        Parameters:
        obj - the object to create the view for
        Returns:
        the preview