Package adams.gui.visualization.core
Class AbstractColorProvider
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.core.AbstractColorProvider
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<ColorProvider>
,SizeOfHandler
,ColorProvider
,Serializable
- Direct Known Subclasses:
AbstractCustomColorProvider
,DefaultColorProvider
,GradientColorProvider
,PeriodicityColorProvider
,TranslucentColorProvider
,X11ColorProvider
public abstract class AbstractColorProvider extends AbstractOptionHandler implements ColorProvider
A class for providing colors.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_AllowDarkening
whether darkening of colors is allowed.protected boolean
m_CheckTooDark
whether to ensure that colors aren't too dark.protected List<Color>
m_Colors
contains the current colors.protected List<Color>
m_DefaultColors
contains the default colors.protected List<Color>
m_ExcludedColors
excluded colors (already used).protected boolean
m_FirstIteration
whether it is the first iteration.protected int
m_Index
the current index.protected List<Color>
m_RecycledColors
recycled, i.e., returned colors.static int
MIN_VALUE
the minimum value for R, G and B before restarting the color provider.-
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 AbstractColorProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
exclude(Color c)
"Excludes" the specified colors, i.e., makes it unavailable for future use.protected void
finishInit()
Finishes the initialization.static ColorProvider
forCommandLine(String cmdline)
Instantiates the provider from the given commandline (i.e., classname and optional options).static ColorProvider
forName(String classname, String[] options)
Instantiates the provider with the given options.protected void
initialize()
Initializes the members.Color
next()
Returns the next color.void
recycle(Color c)
"Recycles" the specified colors, i.e., makes it available for future use.void
resetColors()
Resets the colors.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, defineOptions, destroy, getDefaultLoggingLevel, getOptionManager, globalInfo, 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.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
MIN_VALUE
public static final int MIN_VALUE
the minimum value for R, G and B before restarting the color provider.- See Also:
- Constant Field Values
-
m_Index
protected int m_Index
the current index.
-
m_FirstIteration
protected boolean m_FirstIteration
whether it is the first iteration.
-
m_AllowDarkening
protected boolean m_AllowDarkening
whether darkening of colors is allowed.
-
m_CheckTooDark
protected boolean m_CheckTooDark
whether to ensure that colors aren't too dark.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInit
in classAbstractOptionHandler
-
next
public Color next()
Returns the next color.- Specified by:
next
in interfaceColorProvider
- Returns:
- the next color
-
resetColors
public void resetColors()
Resets the colors.- Specified by:
resetColors
in interfaceColorProvider
-
recycle
public void recycle(Color c)
"Recycles" the specified colors, i.e., makes it available for future use.- Specified by:
recycle
in interfaceColorProvider
- Parameters:
c
- the color to re-use
-
exclude
public void exclude(Color c)
"Excludes" the specified colors, i.e., makes it unavailable for future use.- Specified by:
exclude
in interfaceColorProvider
- Parameters:
c
- the color to exclude
-
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
-
forName
public static ColorProvider forName(String classname, String[] options)
Instantiates the provider with the given options.- Parameters:
classname
- the classname of the provider to instantiateoptions
- the options for the provider- Returns:
- the instantiated provider or null if an error occurred
-
forCommandLine
public static ColorProvider forCommandLine(String cmdline)
Instantiates the provider from the given commandline (i.e., classname and optional options).- Parameters:
cmdline
- the classname (and optional options) of the provider to instantiate- Returns:
- the instantiated provider or null if an error occurred
-
-