org.jfree.report.modules.output.table.html
Class HtmlStyleCollection

java.lang.Object
  |
  +--org.jfree.report.modules.output.table.html.HtmlStyleCollection

public class HtmlStyleCollection
extends java.lang.Object

The HtmlStyleCollection is used to create HtmlCellStyles and to convert these cell styles into Cascading StyleSheet code.

The collection reuses previously generated styles to create optimized code.

Created StyleSheets are stored in the collection and can be used as keys to lookup the name of that style in the global style sheet.

Author:
Thomas Morgner

Constructor Summary
HtmlStyleCollection()
          Creates a new HtmlStyleCollection.
 
Method Summary
 java.lang.String addCellStyle(HtmlTableCellStyle style)
           
 java.lang.String addContentStyle(HtmlContentStyle style)
          Adds the given style to the cache, if not already contained in the cache.
 java.lang.String addRowStyle(HtmlTableRowStyle style)
           
 void clear()
          Removes all registered styles.
static java.lang.String getColorString(java.awt.Color color)
          Creates the color string for the given AWT color.
 java.util.Iterator getDefinedStyles()
          Gets a enumeration of all defined styles.
 HtmlTableCellStyle getEmptyCellStyle()
           
 java.lang.String getPublicName(HtmlStyle style)
           
 java.util.TreeMap getSortedStyleMap()
           
 boolean isRegistered(HtmlStyle style)
          Checks, whether the given style is contained in the cache.
 java.lang.String lookupName(HtmlStyle style)
          Try to find the registered name of the given style.
 HtmlStyle lookupStyle(java.lang.String name)
          Try to find the registered name of the given style.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlStyleCollection

public HtmlStyleCollection()
Creates a new HtmlStyleCollection.
Method Detail

addContentStyle

public java.lang.String addContentStyle(HtmlContentStyle style)
Adds the given style to the cache, if not already contained in the cache.
Parameters:
style - the generated style, that should be added to the style cache.
Returns:
the registered name for the stylesheet.

isRegistered

public boolean isRegistered(HtmlStyle style)
Checks, whether the given style is contained in the cache.
Parameters:
style - the style, that should be checked.
Returns:
true, if the style is registered, false otherwise.

getDefinedStyles

public java.util.Iterator getDefinedStyles()
Gets a enumeration of all defined styles.
Returns:
the styles as enumeration.

getSortedStyleMap

public java.util.TreeMap getSortedStyleMap()

lookupStyle

public HtmlStyle lookupStyle(java.lang.String name)
Try to find the registered name of the given style. Returns null, if the style is not registered.
Parameters:
name - the name of the style, that should be looked up.
Returns:
the style, or null, if the name is not registed.
See Also:
isRegistered(org.jfree.report.modules.output.table.html.HtmlStyle)

getEmptyCellStyle

public HtmlTableCellStyle getEmptyCellStyle()

lookupName

public java.lang.String lookupName(HtmlStyle style)
Try to find the registered name of the given style. Returns null, if the style is not registered.
Parameters:
style - the style, which should be looked up.
Returns:
the registered name for this style, or null, if the style is not registed.
See Also:
isRegistered(org.jfree.report.modules.output.table.html.HtmlStyle)

getPublicName

public java.lang.String getPublicName(HtmlStyle style)

clear

public void clear()
Removes all registered styles.

getColorString

public static java.lang.String getColorString(java.awt.Color color)
Creates the color string for the given AWT color. If the color is one of the predefined HTML colors, then the logical name is returned. For all other colors, the RGB-Tripple is returned.
Parameters:
color - the AWTColor that should be translated.
Returns:
the translated html color definition

addRowStyle

public java.lang.String addRowStyle(HtmlTableRowStyle style)

addCellStyle

public java.lang.String addCellStyle(HtmlTableCellStyle style)