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:- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseKeyValuePair[]m_Colorsthe regexp/color pairs.protected Color[]m_ColorValuesthe regular expressions.protected Colorm_DefaultColorthe default color.protected BaseRegExp[]m_RegExpsthe 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 StringcolorsTipText()Returns the tip text for this property.StringdefaultColorTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.voidexclude(Color c)Ignored.Color[]generate(int numColors)Generates the specified number of colors.BaseKeyValuePair[]getColors()Returns the regexp/color key-value pairs.ColorgetDefaultColor()Returns the default color in use.StringglobalInfo()Returns a string describing the object.Colornext()Just returns the default color.Colornext(String name)Returns the next color for this name.voidrecycle(Color c)Ignored.protected voidreset()Resets the scheme.voidresetColors()Ignored.voidsetColors(BaseKeyValuePair[] value)Sets the regexp/color key-value pairs.voidsetDefaultColor(Color value)Sets the default color to use.ColorProvidershallowCopy()Returns a shallow copy of itself.ColorProvidershallowCopy(boolean expand)Returns a shallow copy of itself.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, toCommandLine, toString
-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin 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:
nextin interfaceColorProvider- Returns:
- the default color
-
resetColors
public void resetColors()
Ignored.- Specified by:
resetColorsin interfaceColorProvider
-
recycle
public void recycle(Color c)
Ignored.- Specified by:
recyclein interfaceColorProvider- Parameters:
c- the color to re-use
-
exclude
public void exclude(Color c)
Ignored.- Specified by:
excludein interfaceColorProvider- Parameters:
c- the color to exclude
-
next
public Color next(String name)
Returns the next color for this name.- Specified by:
nextin interfaceColorProviderWithNameSupport- Parameters:
name- the name to use- Returns:
- the next color
-
generate
public Color[] generate(int numColors)
Generates the specified number of colors.- Specified by:
generatein interfaceColorProvider- Parameters:
numColors- the number of colors- Returns:
- the colors
-
shallowCopy
public ColorProvider shallowCopy()
Returns a shallow copy of itself.- Specified by:
shallowCopyin interfaceShallowCopySupporter<ColorProvider>- Returns:
- the shallow copy
-
shallowCopy
public ColorProvider shallowCopy(boolean expand)
Returns a shallow copy of itself.- Specified by:
shallowCopyin interfaceShallowCopySupporter<ColorProvider>- Parameters:
expand- whether to expand variables to their current values- Returns:
- the shallow copy
-
-