org.umber.crucible.old.layout.style
Class DatumStyleMap

java.lang.Object
  extended byorg.umber.crucible.old.layout.style.DatumStyleMap
All Implemented Interfaces:
StyleMap

public class DatumStyleMap
extends java.lang.Object
implements StyleMap

StyleMap wrapper around a <style-map> Datum tree. Each named style resides in a <style> sub-element. The default style values can be overridden in the single <default> sub-element. If a style cannot be found in the <style> or the <default>, a not-found value is returned, e.g., null or DefaultStyle.NOT_FOUND. Also provides a String ==> Color mapping with the findColor() method.

Author:
jsheets

Constructor Summary
DatumStyleMap(Datum datum)
          Creates a new instance of DatumStyleMap.
 
Method Summary
 java.awt.Color findColor(java.lang.String colorName)
          Returns a Color object corresponding to the given name.
 AreaStyle getAreaStyle(java.lang.String styleName)
          Returns the named area style from this map.
 AreaStyle getDefaultAreaStyle()
          Returns the default area style from this map.
 FontStyle getDefaultFontStyle()
          Returns the default font style from this map.
 TextStyle getDefaultTextStyle()
          Returns the default text style from this map.
 FontStyle getFontStyle(java.lang.String styleName)
          Returns the named font style from this map.
 TextStyle getTextStyle(java.lang.String styleName)
          Returns the named text style from this map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatumStyleMap

public DatumStyleMap(Datum datum)
Creates a new instance of DatumStyleMap.

Parameters:
datum - the style map to wrap, as a Datum tree
Method Detail

getDefaultFontStyle

public FontStyle getDefaultFontStyle()
Returns the default font style from this map.

Specified by:
getDefaultFontStyle in interface StyleMap
Returns:
the font style

getFontStyle

public FontStyle getFontStyle(java.lang.String styleName)
Returns the named font style from this map.

Specified by:
getFontStyle in interface StyleMap
Parameters:
styleName - the name of the style
Returns:
the named font style

getDefaultTextStyle

public TextStyle getDefaultTextStyle()
Returns the default text style from this map.

Specified by:
getDefaultTextStyle in interface StyleMap
Returns:
the text style

getTextStyle

public TextStyle getTextStyle(java.lang.String styleName)
Returns the named text style from this map.

Specified by:
getTextStyle in interface StyleMap
Parameters:
styleName - the name of the style
Returns:
the named text style

getDefaultAreaStyle

public AreaStyle getDefaultAreaStyle()
Returns the default area style from this map.

Specified by:
getDefaultAreaStyle in interface StyleMap
Returns:
the area style

getAreaStyle

public AreaStyle getAreaStyle(java.lang.String styleName)
Returns the named area style from this map.

Specified by:
getAreaStyle in interface StyleMap
Parameters:
styleName - the name of the style
Returns:
the named area style

findColor

public java.awt.Color findColor(java.lang.String colorName)
Returns a Color object corresponding to the given name. Changing the implementation of findColor() will alter the colors generated by the renderer.

Specified by:
findColor in interface StyleMap
Parameters:
colorName - the name of the color
Returns:
the Color object for the given name