Package adams.gui.tools.previewbrowser
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 Summary
Fields Modifier and Type Field Description protected boolean
m_LineWrap
whether to perform line wrap.protected int
m_TabSize
the tab size.protected boolean
m_WrapStyleWord
whether to wrap word style.-
Fields inherited from class adams.gui.tools.previewbrowser.AbstractObjectContentHandler
m_ObjectHandlerMapping
-
Fields inherited from class adams.gui.tools.previewbrowser.AbstractContentHandler
m_Relation
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.gui.tools.previewbrowser.ContentHandler
MATCH_ALL
-
-
Constructor Summary
Constructors Constructor Description PlainTextHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle(Class cls)
Checks whether the class is handled by this content handler.PreviewPanel
createPreview(File file)
Creates the actual view.PreviewPanel
createPreview(Object obj)
Creates the actual preview.void
defineOptions()
Adds options to the internal list of options.String[]
getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.boolean
getLineWrap()
Returns whether line wrap is enabled.int
getTabSize()
Returns the tab size, i.e., the number of maximum width characters.boolean
getWrapStyleWord()
Gets the style of wrapping used if the text area is wrapping lines.String
globalInfo()
Returns a string describing the object.String
lineWrapTipText()
Returns the tip text for this property.void
setLineWrap(boolean value)
Enables/disables line wrap.void
setTabSize(int value)
Sets the tab size, i.e., the number of maximum width characters.void
setWrapStyleWord(boolean word)
Sets the style of wrapping used if the text area is wrapping lines.String
tabSizeTipText()
Returns the tip text for this property.String
wrapStyleWordTipText()
Returns the tip text for this property.-
Methods inherited from class adams.gui.tools.previewbrowser.AbstractObjectContentHandler
canHandle, checkObject, getObjectHandlers, getObjectHandlersFor, getObjectHandlersFor, getPreview, hasObjectHandler, hasObjectHandler, reusePreview
-
Methods inherited from class adams.gui.tools.previewbrowser.AbstractContentHandler
checkFile, getHandlers, getHandlersForFile, getHandlersForFile, getPreview, getRelation, hasHandler, hasHandler, reusePreview
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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.gui.tools.previewbrowser.ContentHandler
getPreview, reusePreview
-
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
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- 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 interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
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)
-
createPreview
public PreviewPanel createPreview(File file)
Creates the actual view.- Specified by:
createPreview
in interfaceContentHandler
- Specified by:
createPreview
in classAbstractContentHandler
- Parameters:
file
- the file to create the view for- Returns:
- the view
-
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
-
-