Class 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 Detail

      • m_DefaultColor

        protected Color m_DefaultColor
        the default color.
      • m_RegExps

        protected BaseRegExp[] m_RegExps
        the regular expressions.
      • m_ColorValues

        protected Color[] m_ColorValues
        the regular expressions.
    • Constructor Detail

      • RegExpColorProvider

        public RegExpColorProvider()
    • Method Detail

      • 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 interface ColorProvider
        Returns:
        the default color
      • recycle

        public void recycle​(Color c)
        Ignored.
        Specified by:
        recycle in interface ColorProvider
        Parameters:
        c - the color to re-use
      • exclude

        public void exclude​(Color c)
        Ignored.
        Specified by:
        exclude in interface ColorProvider
        Parameters:
        c - the color to exclude