net.sf.jtreemap.ktreemap.example
Class HSBTreeMapColorProvider

java.lang.Object
  extended by net.sf.jtreemap.ktreemap.example.HSBTreeMapColorProvider
All Implemented Interfaces:
ITreeMapColorProvider, org.eclipse.jface.viewers.IColorProvider

public class HSBTreeMapColorProvider
extends java.lang.Object
implements ITreeMapColorProvider

An HSB color space color provider for KTreeMap. Uses a specified function to map the values onto the HSB color space. The default is a linear function, but in my experience one of the logarithmic ones works best for this color space.

 

Nested Class Summary
static class HSBTreeMapColorProvider.ColorDistributionTypes
           
 
Field Summary
protected  KTreeMap m_jTreeMap
           
protected  double m_maxValue
           
protected  double m_minValue
           
 
Constructor Summary
HSBTreeMapColorProvider(KTreeMap treeMap, org.eclipse.swt.graphics.Color color)
           
HSBTreeMapColorProvider(KTreeMap treeMap, org.eclipse.swt.graphics.Color positiveColor, org.eclipse.swt.graphics.Color negativeColor)
           
HSBTreeMapColorProvider(KTreeMap treeMap, float hue, float saturation)
           
HSBTreeMapColorProvider(KTreeMap treeMap, float positiveHue, float positiveSaturation, float negativeHue, float negativeSaturation)
           
HSBTreeMapColorProvider(KTreeMap treeMap, HSBTreeMapColorProvider.ColorDistributionTypes colorDistribution, org.eclipse.swt.graphics.Color color)
           
HSBTreeMapColorProvider(KTreeMap treeMap, HSBTreeMapColorProvider.ColorDistributionTypes colorDistribution, org.eclipse.swt.graphics.Color positiveColor, org.eclipse.swt.graphics.Color negativeColor)
           
HSBTreeMapColorProvider(KTreeMap treeMap, HSBTreeMapColorProvider.ColorDistributionTypes colorDistribution, float hue, float saturation)
           
HSBTreeMapColorProvider(KTreeMap treeMap, HSBTreeMapColorProvider.ColorDistributionTypes colorDistribution, float positiveHue, float positiveSaturation, float negativeHue, float negativeSaturation)
           
 
Method Summary
 void adjustColor(org.eclipse.swt.graphics.Color color)
           
 void adjustColor(org.eclipse.swt.graphics.Color positiveColor, org.eclipse.swt.graphics.Color negativeColor)
           
 void adjustColor(float hue, float saturation)
           
 void adjustColor(float positiveHue, float positiveSaturation, float negativeHue, float negativeSaturation)
           
 org.eclipse.swt.graphics.Color getBackground(java.lang.Object value)
           
 org.eclipse.swt.graphics.Color getForeground(java.lang.Object value)
           
 org.eclipse.swt.widgets.Composite getLegend(org.eclipse.swt.widgets.Composite parent, int style)
          Return a Composite for the color legend of a KTreeMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_jTreeMap

protected KTreeMap m_jTreeMap

m_maxValue

protected double m_maxValue

m_minValue

protected double m_minValue
Constructor Detail

HSBTreeMapColorProvider

public HSBTreeMapColorProvider(KTreeMap treeMap,
                               org.eclipse.swt.graphics.Color color)
Parameters:
treeMap -
color -

HSBTreeMapColorProvider

public HSBTreeMapColorProvider(KTreeMap treeMap,
                               org.eclipse.swt.graphics.Color positiveColor,
                               org.eclipse.swt.graphics.Color negativeColor)
Parameters:
treeMap -
positiveColor -
negativeColor -

HSBTreeMapColorProvider

public HSBTreeMapColorProvider(KTreeMap treeMap,
                               HSBTreeMapColorProvider.ColorDistributionTypes colorDistribution,
                               org.eclipse.swt.graphics.Color color)
Parameters:
treeMap -
colorDistribution -
color -

HSBTreeMapColorProvider

public HSBTreeMapColorProvider(KTreeMap treeMap,
                               HSBTreeMapColorProvider.ColorDistributionTypes colorDistribution,
                               org.eclipse.swt.graphics.Color positiveColor,
                               org.eclipse.swt.graphics.Color negativeColor)
Parameters:
treeMap -
colorDistribution -
positiveColor -
negativeColor -

HSBTreeMapColorProvider

public HSBTreeMapColorProvider(KTreeMap treeMap,
                               HSBTreeMapColorProvider.ColorDistributionTypes colorDistribution,
                               float hue,
                               float saturation)
Parameters:
treeMap -
colorDistribution -
hue -
saturation -

HSBTreeMapColorProvider

public HSBTreeMapColorProvider(KTreeMap treeMap,
                               HSBTreeMapColorProvider.ColorDistributionTypes colorDistribution,
                               float positiveHue,
                               float positiveSaturation,
                               float negativeHue,
                               float negativeSaturation)
Parameters:
treeMap -
colorDistribution -
positiveHue -
positiveSaturation -
negativeHue -
negativeSaturation -

HSBTreeMapColorProvider

public HSBTreeMapColorProvider(KTreeMap treeMap,
                               float hue,
                               float saturation)
Parameters:
treeMap -
hue -
saturation -

HSBTreeMapColorProvider

public HSBTreeMapColorProvider(KTreeMap treeMap,
                               float positiveHue,
                               float positiveSaturation,
                               float negativeHue,
                               float negativeSaturation)
Parameters:
treeMap -
positiveHue -
positiveSaturation -
negativeHue -
negativeSaturation -
Method Detail

adjustColor

public void adjustColor(org.eclipse.swt.graphics.Color color)
Parameters:
color -

adjustColor

public void adjustColor(org.eclipse.swt.graphics.Color positiveColor,
                        org.eclipse.swt.graphics.Color negativeColor)
Parameters:
positiveColor -
negativeColor -

adjustColor

public void adjustColor(float hue,
                        float saturation)
Parameters:
hue -
saturation -

adjustColor

public void adjustColor(float positiveHue,
                        float positiveSaturation,
                        float negativeHue,
                        float negativeSaturation)
Parameters:
positiveHue -
positiveSaturation -
negativeHue -
negativeSaturation -

getBackground

public org.eclipse.swt.graphics.Color getBackground(java.lang.Object value)
Specified by:
getBackground in interface org.eclipse.jface.viewers.IColorProvider

getForeground

public org.eclipse.swt.graphics.Color getForeground(java.lang.Object value)
Specified by:
getForeground in interface org.eclipse.jface.viewers.IColorProvider

getLegend

public org.eclipse.swt.widgets.Composite getLegend(org.eclipse.swt.widgets.Composite parent,
                                                   int style)
Description copied from interface: ITreeMapColorProvider
Return a Composite for the color legend of a KTreeMap

Specified by:
getLegend in interface ITreeMapColorProvider
Parameters:
parent - parent Composite
style - style
Returns:
a Composite for the color legend of a KTreeMap