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

java.lang.Object
  extended byorg.umber.crucible.old.layout.style.DatumStyleWrapper
All Implemented Interfaces:
AlignStyle, AllStyle, AreaStyle, BorderStyle, ExtentStyle, FontStyle, InsetStyle, TextStyle

public class DatumStyleWrapper
extends java.lang.Object
implements AllStyle

Convenience wrapper that exports all known style interfaces from a single Datum object. Parameters of the constructor can control whether the style Datum attempts to search its Datum parents for properties if it doesn't exist in the local Datum.

Author:
jsheets

Field Summary
static int NOT_FOUND
          The standard tag for 'style value not found'
 
Fields inherited from interface org.umber.crucible.old.layout.style.FontStyle
FONT_STYLE_BOLD, FONT_STYLE_ITALIC, FONT_STYLE_PLAIN, STYLE_ENUM
 
Fields inherited from interface org.umber.crucible.old.layout.style.TextStyle
WRAP_CHARACTER, WRAP_ENUM, WRAP_LINE, WRAP_NEVER, WRAP_PHRASE, WRAP_SENTENCE, WRAP_WORD
 
Fields inherited from interface org.umber.crucible.old.layout.style.AlignStyle
ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_ENUM, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_TOP
 
Constructor Summary
DatumStyleWrapper()
          Creates a new instance of DatumStyleWrapper with all default values.
DatumStyleWrapper(Datum datum)
          Creates a new instance of DatumStyleWrapper with given datum.
DatumStyleWrapper(Datum datum, boolean inherit)
          Creates a new instance of DatumStyleWrapper with given datum, StyleMap, and inheritance flag.
 
Method Summary
 java.awt.Color getBackgroundColor()
          Returns the background color of this area.
 java.awt.Color getBorderColor()
          Returns the color of the border enclosing this area.
 int getBorderWidth()
          Returns the width of the border enclosing this area.
 FontStyle getDefaultFont()
          Returns the default FontStyle of this text.
 java.lang.String getDescription()
          Returns an optional text description of this area.
 int getFirstLineIndent()
          Returns the first line indent property of this text.
 java.awt.Color getFontColor()
          Returns the color of this run of text.
 int getFontHeight()
          Estimates the height of the font in point size.
 java.lang.String getFontName()
          Returns the font name property of the style.
 int getFontSize()
          Returns the font size property of the style.
 int getFontStyle()
          Returns the font style property of the style.
 int getHAlign()
          Returns the horizontal alignment property of the style.
 int getIndent()
          Returns the left indent spacing of this area.
 java.awt.Insets getInsets()
          Returns an Insets object set to the values of all four InsetStyle properties, indent, rightIndent, spaceBefore, and spaceAfter.
 java.awt.Dimension getMaximum()
          Returns the maximum geometrical extents of this area.
 java.awt.Dimension getMinimum()
          Returns the minimum geometrical extents of this area.
 java.awt.Dimension getPreferred()
          Returns the preferred geometrical extents of this area.
 int getRightIndent()
          Returns the right indent spacing of this area.
 int getSpaceAfter()
          Returns the bottom indent spacing of this area.
 int getSpaceBefore()
          Returns the top indent spacing of this area.
 int getVAlign()
          Returns the vertical alignment property of the style.
 int getWrap()
          Returns the wrap style of this text, according to the WRAP_xxx enumeration.
 boolean isBreakable()
          Returns the breakable property of this text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_FOUND

public static final int NOT_FOUND
The standard tag for 'style value not found'

See Also:
Constant Field Values
Constructor Detail

DatumStyleWrapper

public DatumStyleWrapper()
Creates a new instance of DatumStyleWrapper with all default values. Does not perform any named style lookups.


DatumStyleWrapper

public DatumStyleWrapper(Datum datum)
Creates a new instance of DatumStyleWrapper with given datum. Does not perform any named style lookups.

Parameters:
datum - the Datum object to wrap

DatumStyleWrapper

public DatumStyleWrapper(Datum datum,
                         boolean inherit)
Creates a new instance of DatumStyleWrapper with given datum, StyleMap, and inheritance flag. If a requested property does not exist in the Datum, but a 'style' property does, the wrapper will search for the property in the StyleMap. If datum is null, uses default style properties; if styleMap is null, uses a default StyleMap instance.

Parameters:
datum - the Datum object to wrap
inherit - whether or not to use Datum property inheritance
Method Detail

getFontName

public java.lang.String getFontName()
Returns the font name property of the style.

Specified by:
getFontName in interface FontStyle
Returns:
the font name for this style

getFontStyle

public int getFontStyle()
Returns the font style property of the style.

Specified by:
getFontStyle in interface FontStyle
Returns:
the font style for this style

getFontSize

public int getFontSize()
Returns the font size property of the style.

Specified by:
getFontSize in interface FontStyle
Returns:
the font size (in points) for this style

getFontHeight

public int getFontHeight()
Estimates the height of the font in point size. Not a true measure of the font height, but can be used for rough estimates.

Specified by:
getFontHeight in interface FontStyle
Returns:
the height of the font in point size

getFontColor

public java.awt.Color getFontColor()
Returns the color of this run of text.

Specified by:
getFontColor in interface FontStyle
Returns:
the text color

getDefaultFont

public FontStyle getDefaultFont()
Returns the default FontStyle of this text.

Specified by:
getDefaultFont in interface TextStyle
Returns:
the default FontStyle for this text

getWrap

public int getWrap()
Returns the wrap style of this text, according to the WRAP_xxx enumeration. The behavior of phrase and sentence wrapping may be dependent on the nature of the text.

Specified by:
getWrap in interface TextStyle
Returns:
the wrap style

getFirstLineIndent

public int getFirstLineIndent()
Returns the first line indent property of this text.

Specified by:
getFirstLineIndent in interface TextStyle
Returns:
the first line indent value for this text

isBreakable

public boolean isBreakable()
Returns the breakable property of this text. If text is breakable, it can be wrapped to another page.

Specified by:
isBreakable in interface AreaStyle
Returns:
the breakable value for this text

getHAlign

public int getHAlign()
Returns the horizontal alignment property of the style. The returned value should be one of ALIGN_LEFT, ALIGN_CENTER, or ALIGN_RIGHT.

Specified by:
getHAlign in interface AlignStyle
Returns:
the horizontal alignment

getVAlign

public int getVAlign()
Returns the vertical alignment property of the style. The returned value should be one of ALIGN_TOP, ALIGN_CENTER, or ALIGN_BOTTOM.

Specified by:
getVAlign in interface AlignStyle
Returns:
the vertical alignment

getIndent

public int getIndent()
Returns the left indent spacing of this area.

Specified by:
getIndent in interface InsetStyle
Returns:
the left indent spacing

getRightIndent

public int getRightIndent()
Returns the right indent spacing of this area.

Specified by:
getRightIndent in interface InsetStyle
Returns:
the right indent spacing

getSpaceBefore

public int getSpaceBefore()
Returns the top indent spacing of this area.

Specified by:
getSpaceBefore in interface InsetStyle
Returns:
the top indent spacing

getSpaceAfter

public int getSpaceAfter()
Returns the bottom indent spacing of this area.

Specified by:
getSpaceAfter in interface InsetStyle
Returns:
the bottom indent spacing

getInsets

public java.awt.Insets getInsets()
Returns an Insets object set to the values of all four InsetStyle properties, indent, rightIndent, spaceBefore, and spaceAfter.

Specified by:
getInsets in interface InsetStyle
Returns:
an Insets object for this style

getPreferred

public java.awt.Dimension getPreferred()
Returns the preferred geometrical extents of this area. These extents should be followed if possible, but can be ignored if necessary.

Specified by:
getPreferred in interface ExtentStyle
Returns:
the preferred extents

getMinimum

public java.awt.Dimension getMinimum()
Returns the minimum geometrical extents of this area. These extents should be followed at all costs, even if clipping or overflow occurs because of it.

Any unspecified extent should fall back on the StyleMap value. If the extent is not specified in the StyleMap, it should carry the preferred value. Each extent, width and height, is calculated separately.

Specified by:
getMinimum in interface ExtentStyle
Returns:
the minimum extents

getMaximum

public java.awt.Dimension getMaximum()
Returns the maximum geometrical extents of this area. These extents should be followed at all costs, even if clipping or overflow occurs because of it.

Specified by:
getMaximum in interface ExtentStyle
Returns:
the maximum extents

getBorderWidth

public int getBorderWidth()
Returns the width of the border enclosing this area.

Specified by:
getBorderWidth in interface BorderStyle
Returns:
the border width

getBorderColor

public java.awt.Color getBorderColor()
Returns the color of the border enclosing this area.

Specified by:
getBorderColor in interface BorderStyle
Returns:
the border color

getBackgroundColor

public java.awt.Color getBackgroundColor()
Returns the background color of this area.

Specified by:
getBackgroundColor in interface AreaStyle
Returns:
the background color

getDescription

public java.lang.String getDescription()
Returns an optional text description of this area. This implementation checks the 'description' property of the Datum. If the 'description' property is not defined, it falls back on the 'hint' property.

Specified by:
getDescription in interface AreaStyle
Returns:
text description