com.jrefinery.report.targets.table.html
Class HtmlStyleCollection

java.lang.Object
  |
  +--com.jrefinery.report.targets.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.

Author:
Thomas Morgner

Constructor Summary
HtmlStyleCollection()
          Creates a new HtmlStyleCollection.
 
Method Summary
 java.lang.String addStyle(HtmlCellStyle style)
          Adds the given style to the cache, if not already contained in the cache.
 void clear()
          Removes all registered styles.
 java.lang.String createStyleSheetDefinition(HtmlCellStyle style)
          Transforms the given HtmlCellStyle into a Cascading StyleSheet definition.
 java.lang.String getBackgroundStyle(TableCellBackground bg)
          Transforms the given TableCellBackground into a Cascading StyleSheet definition.
 java.util.Iterator getDefinedStyles()
          Gets a enumeration of all defined styles.
 boolean isRegistered(HtmlCellStyle style)
          Checks, whether the given style is contained in the cache.
 java.lang.String lookupName(HtmlCellStyle style)
          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

addStyle

public java.lang.String addStyle(HtmlCellStyle 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(HtmlCellStyle 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.

lookupName

public java.lang.String lookupName(HtmlCellStyle 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(com.jrefinery.report.targets.table.html.HtmlCellStyle)

clear

public void clear()
Removes all registered styles.


createStyleSheetDefinition

public java.lang.String createStyleSheetDefinition(HtmlCellStyle style)
Transforms the given HtmlCellStyle into a Cascading StyleSheet definition.

Parameters:
style - the HtmlCellStyle, that should be translated.
Returns:
the generated stylesheet definition.

getBackgroundStyle

public java.lang.String getBackgroundStyle(TableCellBackground bg)
Transforms the given TableCellBackground into a Cascading StyleSheet definition.

Parameters:
bg - the background definition, that should be translated.
Returns:
the generated stylesheet definition.