Class ColorPerRegExpGroup
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.sequence.metadatacolor.AbstractMetaDataColor<XYSequencePoint>
-
- adams.gui.visualization.sequence.metadatacolor.ColorPerRegExpGroup
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,ColorProviderHandler
,Serializable
public class ColorPerRegExpGroup extends AbstractMetaDataColor<XYSequencePoint> implements ColorProviderHandler
Maintains an internal mapping between groups obtained from the meta-data via the regular expression extraction (using the specified key) and colors obtained from the color provider.
Makes use of color providers that implement the adams.gui.visualization.core.ColorProviderWithNameSupport interface, supplying it with the label obtained from the meta-data.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-color-provider <adams.gui.visualization.core.ColorProvider> (property: colorProvider) The color provider to use. default: adams.gui.visualization.core.DefaultColorProvider
-meta-data-key <java.lang.String> (property: metaDataKey) The key in the meta-data to obtain the label from. default:
-regexp <adams.core.base.BaseRegExp> (property: regExp) The regular expression to apply to the meta-data value. default: (.*) more: https://docs.oracle.com/javase/tutorial/essential/regex/ https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
-group <java.lang.String> (property: group) The group from the regular expression to use for determining the color. default: $1
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Color>
m_ColorMap
the mapping between labels and colors.protected ColorProvider
m_ColorProvider
the color provider to use.protected String
m_Group
the group to use for the coloring.protected String
m_MetaDataKey
the meta-data key to use for obtaining the label.protected BaseRegExp
m_RegExp
the regular expression to use.-
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 ColorPerRegExpGroup()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
colorProviderTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected String
determineGroup(XYSequencePoint point)
Determines the group for the point.Color
getColor(XYSequencePoint point, Color defColor)
Extracts the color from the meta-data.ColorProvider
getColorProvider()
Returns the color provider to use.String
getGroup()
Returns the group from the regular expression to use for determining the color.String
getMetaDataKey()
Returns the key in the meta-data to obtain the label from.protected Color
getNextColor(String group)
Returns the next color for the group.BaseRegExp
getRegExp()
Returns the regular expression to apply to the meta-data value.String
globalInfo()
Returns a string describing the object.String
groupTipText()
Returns the tip text for this property.protected void
initialize()
Initializes the members.void
initialize(List<XYSequencePoint> points)
Initializes the meta-data color scheme.String
metaDataKeyTipText()
Returns the tip text for this property.String
regExpTipText()
Returns the tip text for this property.protected void
reset()
Resets the mapping.void
setColorProvider(ColorProvider value)
Sets the color provider to use.void
setGroup(String value)
Sets the group from the regular expression to use for determining the color.void
setMetaDataKey(String value)
Sets the key in the meta-data to obtain the label from.void
setRegExp(BaseRegExp value)
Sets the regular expression to apply to the meta-data value.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_ColorProvider
protected ColorProvider m_ColorProvider
the color provider to use.
-
m_MetaDataKey
protected String m_MetaDataKey
the meta-data key to use for obtaining the label.
-
m_RegExp
protected BaseRegExp m_RegExp
the regular expression to use.
-
m_Group
protected String m_Group
the group to use for the coloring.
-
-
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
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
reset
protected void reset()
Resets the mapping.- Overrides:
reset
in classAbstractOptionHandler
-
setColorProvider
public void setColorProvider(ColorProvider value)
Sets the color provider to use.- Specified by:
setColorProvider
in interfaceColorProviderHandler
- Parameters:
value
- the provider
-
getColorProvider
public ColorProvider getColorProvider()
Returns the color provider to use.- Specified by:
getColorProvider
in interfaceColorProviderHandler
- Returns:
- the provider
-
colorProviderTipText
public String colorProviderTipText()
Returns the tip text for this property.- Specified by:
colorProviderTipText
in interfaceColorProviderHandler
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMetaDataKey
public void setMetaDataKey(String value)
Sets the key in the meta-data to obtain the label from.- Parameters:
value
- the key
-
getMetaDataKey
public String getMetaDataKey()
Returns the key in the meta-data to obtain the label from.- Returns:
- the key
-
metaDataKeyTipText
public String metaDataKeyTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRegExp
public void setRegExp(BaseRegExp value)
Sets the regular expression to apply to the meta-data value.- Parameters:
value
- the regular expression
-
getRegExp
public BaseRegExp getRegExp()
Returns the regular expression to apply to the meta-data value.- Returns:
- the regular expressions
-
regExpTipText
public String regExpTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setGroup
public void setGroup(String value)
Sets the group from the regular expression to use for determining the color.- Parameters:
value
- the group
-
getGroup
public String getGroup()
Returns the group from the regular expression to use for determining the color.- Returns:
- the group
-
groupTipText
public String groupTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getNextColor
protected Color getNextColor(String group)
Returns the next color for the group.- Parameters:
group
- the group to get the next color for- Returns:
- the color
-
determineGroup
protected String determineGroup(XYSequencePoint point)
Determines the group for the point.- Parameters:
point
- the point to process- Returns:
- the group, null if failed to determine
-
initialize
public void initialize(List<XYSequencePoint> points)
Initializes the meta-data color scheme.- Specified by:
initialize
in classAbstractMetaDataColor<XYSequencePoint>
- Parameters:
points
- the points to initialize with
-
getColor
public Color getColor(XYSequencePoint point, Color defColor)
Extracts the color from the meta-data.- Specified by:
getColor
in classAbstractMetaDataColor<XYSequencePoint>
- Parameters:
point
- the point to get the color fromdefColor
- the default color to use- Returns:
- the color
-
-