Package adams.gui.visualization.core
Class RegExpColorProvider
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.core.RegExpColorProvider
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<ColorProvider>
,SizeOfHandler
,ColorProvider
,ColorProviderWithNameSupport
,Serializable
public class RegExpColorProvider extends AbstractOptionHandler implements ColorProviderWithNameSupport
Uses the provided regular expressions to determine the colors. If no regular expression matches or no name given to match against, the default color is returned.
The regular expressions and colors are provided as pairs, with the regexp being the key and the color the value.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-default-color <java.awt.Color> (property: defaultColor) The default color to use if no regular expression matches or no name provided to match against. default: #000000
-color <adams.core.base.BaseKeyValuePair> [-color ...] (property: colors) The key-value pairs of regular expression ('key') and color ('value'). default:
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseKeyValuePair[]
m_Colors
the regexp/color pairs.protected Color[]
m_ColorValues
the regular expressions.protected Color
m_DefaultColor
the default color.protected BaseRegExp[]
m_RegExps
the regular expressions.-
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 RegExpColorProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
colorsTipText()
Returns the tip text for this property.String
defaultColorTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.void
exclude(Color c)
Ignored.BaseKeyValuePair[]
getColors()
Returns the regexp/color key-value pairs.Color
getDefaultColor()
Returns the default color in use.String
globalInfo()
Returns a string describing the object.Color
next()
Just returns the default color.Color
next(String name)
Returns the next color for this name.void
recycle(Color c)
Ignored.protected void
reset()
Resets the scheme.void
resetColors()
Ignored.void
setColors(BaseKeyValuePair[] value)
Sets the regexp/color key-value pairs.void
setDefaultColor(Color value)
Sets the default color to use.ColorProvider
shallowCopy()
Returns a shallow copy of itself.ColorProvider
shallowCopy(boolean expand)
Returns a shallow copy of itself.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, 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
-
m_DefaultColor
protected Color m_DefaultColor
the default color.
-
m_Colors
protected BaseKeyValuePair[] m_Colors
the regexp/color pairs.
-
m_RegExps
protected BaseRegExp[] m_RegExps
the regular expressions.
-
m_ColorValues
protected Color[] m_ColorValues
the regular expressions.
-
-
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
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractOptionHandler
-
setDefaultColor
public void setDefaultColor(Color value)
Sets the default color to use.- Parameters:
value
- the default color to use
-
getDefaultColor
public Color getDefaultColor()
Returns the default color in use.- Returns:
- the default color in use
-
defaultColorTipText
public String defaultColorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setColors
public void setColors(BaseKeyValuePair[] value)
Sets the regexp/color key-value pairs.- Parameters:
value
- the pairs
-
getColors
public BaseKeyValuePair[] getColors()
Returns the regexp/color key-value pairs.- Returns:
- the pairs
-
colorsTipText
public String colorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
next
public Color next()
Just returns the default color.- Specified by:
next
in interfaceColorProvider
- Returns:
- the default color
-
resetColors
public void resetColors()
Ignored.- Specified by:
resetColors
in interfaceColorProvider
-
recycle
public void recycle(Color c)
Ignored.- Specified by:
recycle
in interfaceColorProvider
- Parameters:
c
- the color to re-use
-
exclude
public void exclude(Color c)
Ignored.- Specified by:
exclude
in interfaceColorProvider
- Parameters:
c
- the color to exclude
-
next
public Color next(String name)
Returns the next color for this name.- Specified by:
next
in interfaceColorProviderWithNameSupport
- Parameters:
name
- the name to use- Returns:
- the next color
-
shallowCopy
public ColorProvider shallowCopy()
Returns a shallow copy of itself.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<ColorProvider>
- Returns:
- the shallow copy
-
shallowCopy
public ColorProvider shallowCopy(boolean expand)
Returns a shallow copy of itself.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<ColorProvider>
- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
-