org.pentaho.reporting.engine.classic.core.modules.output.table.xls.helper
Class StaticExcelColorSupport

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.modules.output.table.xls.helper.StaticExcelColorSupport
All Implemented Interfaces:
ExcelColorProducer

public final class StaticExcelColorSupport
extends Object
implements ExcelColorProducer

POI Excel utility methods.

Author:
Heiko Evermann

Constructor Summary
StaticExcelColorSupport()
          DefaultConstructor.
 
Method Summary
 org.apache.poi.hssf.util.HSSFColor getColor(short index)
           
 short getNearestColor(Color awtColor)
          Find a suitable color for the cell.
static short getNearestColor(Color awtColor, Map triplets)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticExcelColorSupport

public StaticExcelColorSupport()
DefaultConstructor.

Method Detail

getNearestColor

public short getNearestColor(Color awtColor)
Find a suitable color for the cell.

The algorithm searches all available triplets, weighted by tripletvalue and tripletdifference to the other triplets. The color wins, which has the smallest triplet difference and where all triplets are nearest to the requested color. Damn, why couldn't these guys from microsoft implement a real color system.

Specified by:
getNearestColor in interface ExcelColorProducer
Parameters:
awtColor - the awt color that should be transformed into an Excel color.
Returns:
the excel color index that is nearest to the supplied color.

getNearestColor

public static short getNearestColor(Color awtColor,
                                    Map triplets)

getColor

public org.apache.poi.hssf.util.HSSFColor getColor(short index)