Package adams.gui.core.spreadsheettable
Class DistinctValueCellRenderingCustomizer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.core.spreadsheettable.AbstractCellRenderingCustomizer
-
- adams.gui.core.spreadsheettable.DistinctValueCellRenderingCustomizer
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,CellRenderingCustomizer
,Serializable
public class DistinctValueCellRenderingCustomizer extends AbstractCellRenderingCustomizer
Each distinct value in the spreadsheet gets its own color.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ColorProvider
m_ColorProvider
the color provider to use for the background.protected Map<String,Color>
m_Colors
the value color mapping.protected SpreadSheet
m_LastSpreadSheet
the last spreadsheet that was used.protected BaseString[]
m_PredefinedValues
the predefined values.-
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 DistinctValueCellRenderingCustomizer()
-
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.Color
getBackgroundColor(SpreadSheetTable table, boolean isSelected, boolean hasFocus, int row, int column, Cell cell, Color defColor)
For customizing the background color of a cell.ColorProvider
getColorProvider()
Returns the color provider to use for generating the distinct values.protected ColorProvider
getDefaultColorProvider()
Returns the default color generator.BaseString[]
getPredefinedValues()
Returns the predefined values to highlight.String
globalInfo()
Returns a string describing the object.protected void
initColors(SpreadSheet sheet)
Initializes the color lookup table.String
predefinedValuesTipText()
Returns the tip text for this property.void
setColorProvider(ColorProvider value)
Sets the color provider to use for generating the distinct values.void
setPredefinedValues(BaseString[] value)
Sets the predefined values to highlight.-
Methods inherited from class adams.gui.core.spreadsheettable.AbstractCellRenderingCustomizer
getFont, getForegroundColor, getHorizontalAlignment, getToolTipText
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, 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, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_ColorProvider
protected ColorProvider m_ColorProvider
the color provider to use for the background.
-
m_PredefinedValues
protected BaseString[] m_PredefinedValues
the predefined values.
-
m_LastSpreadSheet
protected transient SpreadSheet m_LastSpreadSheet
the last spreadsheet that was used.
-
-
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
-
getDefaultColorProvider
protected ColorProvider getDefaultColorProvider()
Returns the default color generator.- Returns:
- the generator
-
setColorProvider
public void setColorProvider(ColorProvider value)
Sets the color provider to use for generating the distinct values.- Parameters:
value
- the provider
-
getColorProvider
public ColorProvider getColorProvider()
Returns the color provider to use for generating the distinct values.- Returns:
- the provider
-
colorProviderTipText
public String colorProviderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setPredefinedValues
public void setPredefinedValues(BaseString[] value)
Sets the predefined values to highlight.- Parameters:
value
- the values
-
getPredefinedValues
public BaseString[] getPredefinedValues()
Returns the predefined values to highlight.- Returns:
- the values
-
predefinedValuesTipText
public String predefinedValuesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
initColors
protected void initColors(SpreadSheet sheet)
Initializes the color lookup table.- Parameters:
sheet
- the spreadsheet to use for initializing
-
getBackgroundColor
public Color getBackgroundColor(SpreadSheetTable table, boolean isSelected, boolean hasFocus, int row, int column, Cell cell, Color defColor)
For customizing the background color of a cell.- Specified by:
getBackgroundColor
in interfaceCellRenderingCustomizer
- Overrides:
getBackgroundColor
in classAbstractCellRenderingCustomizer
- Parameters:
table
- the tableisSelected
- whether the cell is selectedhasFocus
- whether the cell is focusedrow
- the current rowcolumn
- the current columncell
- the actual celldefColor
- the default color- Returns:
- the color
-
-